text
stringlengths 2
100k
| meta
dict |
---|---|
// The MIT License (MIT)
// Copyright (c) 2016, Microsoft
// 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 <iostream>
#include "CompilerCommand.h"
#include "Environment.h"
namespace BitFunnel
{
//*************************************************************************
//
// CompilerCommand
//
//*************************************************************************
CompilerCommand::CompilerCommand(Environment & environment,
Id id,
char const * /*parameters*/)
: TaskBase(environment, id, Type::Synchronous)
{
}
void CompilerCommand::Execute()
{
GetEnvironment().SetCompilerMode(true);
std::cout
<< "Using the native x64 compiler."
<< std::endl
<< std::endl;
}
ICommand::Documentation CompilerCommand::GetDocumentation()
{
return Documentation(
"compiler",
"Use the native x64 compiler for query processing.",
"compiler\n"
" Use the native x64 compiler for query processing."
);
}
}
| {
"pile_set_name": "Github"
} |
/*
* Created by Angel Leon (@gubatron), Alden Torres (aldenml)
* Copyright (c) 2011-2019, FrostWire(R). All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.frostwire.gui.components.slides;
import com.frostwire.util.HttpClientFactory;
import com.frostwire.util.JsonUtils;
import com.frostwire.util.Logger;
import com.frostwire.util.http.HttpClient;
import com.limegroup.gnutella.gui.GUIMediator;
import com.limegroup.gnutella.settings.ApplicationSettings;
import com.limegroup.gnutella.util.FrostWireUtils;
import org.limewire.util.OSUtils;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.regex.Pattern;
/**
* Contains all the SlideshowPanels.
*
* @author gubatron
* @author aldenml
*/
public class MultimediaSlideshowPanel extends JPanel implements SlideshowPanel {
private static final Logger LOG = Logger.getLogger(MultimediaSlideshowPanel.class);
private SlideshowListener listener;
private List<Slide> slides;
private List<Slide> fallbackSlides;
private JPanel container;
private boolean useControls;
private Timer timer;
public MultimediaSlideshowPanel(List<Slide> slides) {
setupUI();
setup(slides);
}
public MultimediaSlideshowPanel(final String url, List<Slide> defaultSlides) {
fallbackSlides = defaultSlides;
setupUI();
new Thread(() -> load(url)).start();
}
@Override
public void setListener(SlideshowListener listener) {
this.listener = listener;
}
@Override
public int getCurrentSlideIndex() {
Component[] components = getComponents();
for (Component c : components) {
if (c.isVisible() && c instanceof SlidePanel) {
return ((SlidePanel) c).getIndex();
}
}
return -1;
}
@Override
public void switchToSlide(int slideIndex) {
if (slideIndex >= 0 && slideIndex < getNumSlides() && getLayout() instanceof CardLayout) {
((CardLayout) getLayout()).show(this, String.valueOf(slideIndex));
}
if (timer != null) {
timer.cancel();
}
}
@Override
public int getNumSlides() {
if (slides == null) {
return 0;
} else {
return slides.size();
}
}
private void setupUI() {
setLayout(new CardLayout());
}
private void setup(List<Slide> slides) {
this.slides = filter(slides);
GUIMediator.safeInvokeLater(() -> {
if (MultimediaSlideshowPanel.this.slides != null) {
List<Slide> slides1 = MultimediaSlideshowPanel.this.slides;
try {
int i = 0;
for (Slide s : slides1) {
add(new SlidePanel(s, i), String.valueOf(i));
i++;
}
if (container != null && useControls) {
container.add(new SlideshowPanelControls(MultimediaSlideshowPanel.this), BorderLayout.PAGE_END);
}
if (!slides1.isEmpty()) {
timer = new Timer("SlideShow Timer");
timer.schedule(new SlideSwitcher(), slides1.get(0).duration);
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
});
}
private void load(final String url) {
try {
HttpClient client = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.MISC);
String jsonString = client.get(url);
if (jsonString != null) {
final SlideList slideList = JsonUtils.toObject(jsonString, SlideList.class);
try {
setup(slideList.slides);
} catch (Exception e) {
LOG.info("Failed load of Slide Show:" + url, e);
setup(fallbackSlides);
// nothing happens
}
} else {
setup(fallbackSlides);
}
} catch (Exception e) {
LOG.info("Failed load of Slide Show:" + url, e);
setup(fallbackSlides);
// nothing happens
}
}
/*
* Examples of when this returns true
* given == lang in app
* es_ve == es_ve
* es == es_ve
* * == es_ve
*/
private boolean isMessageEligibleForMyLang(String lang) {
if (lang == null || lang.equals("*"))
return true;
String langinapp = ApplicationSettings.getLanguage().toLowerCase();
if (langinapp.length() > 2) {
langinapp = langinapp.substring(0, 2);
}
return lang.toLowerCase().contains(langinapp);
}
private boolean isMessageEligibleForMyOs(String os) {
if (os == null)
return true;
boolean im_mac_msg_for_me = os.contains("mac") && OSUtils.isMacOSX();
boolean im_windows_msg_for_me = os.contains("windows") && OSUtils.isWindows();
boolean im_linux_msg_for_me = os.contains("linux") && OSUtils.isLinux();
return im_mac_msg_for_me || im_windows_msg_for_me || im_linux_msg_for_me;
}
private boolean isMessageEligibleForMyVersion(String versions) {
if (versions == null || versions.equals("*")) {
return true;
}
String frostWireVersion = FrostWireUtils.getFrostWireVersion();
for (String pattern : versions.split(",")) {
if (Pattern.matches(pattern, frostWireVersion)) {
return true; // for-loop-break?
}
}
return false;
}
private List<Slide> filter(List<Slide> slides) {
List<Slide> result = new ArrayList<>(slides.size());
for (Slide slide : slides) {
if (isMessageEligibleForMyLang(slide.language) && isMessageEligibleForMyOs(slide.os) && isMessageEligibleForMyVersion(slide.includedVersions)) {
result.add(slide);
}
}
return result;
}
@Override
public void setupContainerAndControls(JPanel container, boolean useControls) {
this.container = container;
this.useControls = useControls;
}
private SlidePanel getCurrentSlidePanel() {
Component[] components = getComponents();
for (Component c : components) {
if (c.isVisible() && c instanceof SlidePanel) {
return ((SlidePanel) c);
}
}
return null;
}
class SlideSwitcher extends TimerTask {
@Override
public void run() {
SlidePanel currentSlidePanel = getCurrentSlidePanel();
if (currentSlidePanel == null || !currentSlidePanel.isOverlayVisible()) {
if (getLayout() instanceof CardLayout) {
((CardLayout) getLayout()).next(MultimediaSlideshowPanel.this);
if (listener != null) {
listener.onSlideChanged();
}
}
}
if (currentSlidePanel != null) {
timer.schedule(new SlideSwitcher(), currentSlidePanel.getSlide().duration);
}
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2013 Matt T. Proud
//
// 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 pbutil
import (
"encoding/binary"
"errors"
"io"
"github.com/golang/protobuf/proto"
)
var errInvalidVarint = errors.New("invalid varint32 encountered")
// ReadDelimited decodes a message from the provided length-delimited stream,
// where the length is encoded as 32-bit varint prefix to the message body.
// It returns the total number of bytes read and any applicable error. This is
// roughly equivalent to the companion Java API's
// MessageLite#parseDelimitedFrom. As per the reader contract, this function
// calls r.Read repeatedly as required until exactly one message including its
// prefix is read and decoded (or an error has occurred). The function never
// reads more bytes from the stream than required. The function never returns
// an error if a message has been read and decoded correctly, even if the end
// of the stream has been reached in doing so. In that case, any subsequent
// calls return (0, io.EOF).
func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) {
// Per AbstractParser#parsePartialDelimitedFrom with
// CodedInputStream#readRawVarint32.
var headerBuf [binary.MaxVarintLen32]byte
var bytesRead, varIntBytes int
var messageLength uint64
for varIntBytes == 0 { // i.e. no varint has been decoded yet.
if bytesRead >= len(headerBuf) {
return bytesRead, errInvalidVarint
}
// We have to read byte by byte here to avoid reading more bytes
// than required. Each read byte is appended to what we have
// read before.
newBytesRead, err := r.Read(headerBuf[bytesRead : bytesRead+1])
if newBytesRead == 0 {
if err != nil {
return bytesRead, err
}
// A Reader should not return (0, nil), but if it does,
// it should be treated as no-op (according to the
// Reader contract). So let's go on...
continue
}
bytesRead += newBytesRead
// Now present everything read so far to the varint decoder and
// see if a varint can be decoded already.
messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead])
}
messageBuf := make([]byte, messageLength)
newBytesRead, err := io.ReadFull(r, messageBuf)
bytesRead += newBytesRead
if err != nil {
return bytesRead, err
}
return bytesRead, proto.Unmarshal(messageBuf, m)
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: eb0d7f0880e02ff40b3558480ced4bfa
ModelImporter:
serializedVersion: 18
fileIDToRecycleName:
100000: Body
100002: //RootNode
100004: Eye
100006: L_BackLeg_1
100008: L_BackLeg_2
100010: L_BackLeg_Toe
100012: L_FrontLeg_1
100014: L_FrontLeg_2
100016: L_FrontLeg_Toe
100018: L_MiddleLeg_1
100020: L_MiddleLeg_2
100022: L_MiddleLeg_Toe
100024: R_BackLeg_1
100026: R_BackLeg_2
100028: R_BackLeg_Toe
100030: R_FrontLeg_1
100032: R_FrontLeg_2
100034: R_FrontLeg_Toe
100036: R_MiddleLeg_1
100038: R_MiddleLeg_2
100040: R_MiddleLeg_Toe
100042: Root
400000: Body
400002: //RootNode
400004: Eye
400006: L_BackLeg_1
400008: L_BackLeg_2
400010: L_BackLeg_Toe
400012: L_FrontLeg_1
400014: L_FrontLeg_2
400016: L_FrontLeg_Toe
400018: L_MiddleLeg_1
400020: L_MiddleLeg_2
400022: L_MiddleLeg_Toe
400024: R_BackLeg_1
400026: R_BackLeg_2
400028: R_BackLeg_Toe
400030: R_FrontLeg_1
400032: R_FrontLeg_2
400034: R_FrontLeg_Toe
400036: R_MiddleLeg_1
400038: R_MiddleLeg_2
400040: R_MiddleLeg_Toe
400042: Root
7400000: Take 001
9500000: //RootNode
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
optimizeGameObjects: 0
motionNodeName:
pivotNodeName:
animationCompression: 0
animationRotationError: .5
animationPositionError: .5
animationScaleError: .5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
splitTangentsAcrossUV: 1
normalImportMode: 0
tangentImportMode: 1
importAnimation: 1
copyAvatar: 1
humanDescription:
human: []
skeleton: []
armTwist: .5
foreArmTwist: .5
upperLegTwist: .5
legTwist: .5
armStretch: .0500000007
legStretch: .0500000007
feetSpacing: 0
rootMotionBoneName: Root
lastHumanDescriptionAvatarSource: {fileID: 9000000, guid: 620216aa4858015458322c245690e761,
type: 3}
animationType: 2
additionalBone: 0
userData:
assetBundleName:
| {
"pile_set_name": "Github"
} |
/var/log/rkhunter/*.log {
daily
missingok
rotate 7
compress
notifempty
nocreate
}
| {
"pile_set_name": "Github"
} |
CodeMirror.defineMode('ocaml', function() {
var words = {
'true': 'atom',
'false': 'atom',
'let': 'keyword',
'rec': 'keyword',
'in': 'keyword',
'of': 'keyword',
'and': 'keyword',
'succ': 'keyword',
'if': 'keyword',
'then': 'keyword',
'else': 'keyword',
'for': 'keyword',
'to': 'keyword',
'while': 'keyword',
'do': 'keyword',
'done': 'keyword',
'fun': 'keyword',
'function': 'keyword',
'val': 'keyword',
'type': 'keyword',
'mutable': 'keyword',
'match': 'keyword',
'with': 'keyword',
'try': 'keyword',
'raise': 'keyword',
'begin': 'keyword',
'end': 'keyword',
'open': 'builtin',
'trace': 'builtin',
'ignore': 'builtin',
'exit': 'builtin',
'print_string': 'builtin',
'print_endline': 'builtin'
};
function tokenBase(stream, state) {
var ch = stream.next();
if (ch === '"') {
state.tokenize = tokenString;
return state.tokenize(stream, state);
}
if (ch === '(') {
if (stream.eat('*')) {
state.commentLevel++;
state.tokenize = tokenComment;
return state.tokenize(stream, state);
}
}
if (ch === '~') {
stream.eatWhile(/\w/);
return 'variable-2';
}
if (ch === '`') {
stream.eatWhile(/\w/);
return 'quote';
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\d]/);
if (stream.eat('.')) {
stream.eatWhile(/[\d]/);
}
return 'number';
}
if ( /[+\-*&%=<>!?|]/.test(ch)) {
return 'operator';
}
stream.eatWhile(/\w/);
var cur = stream.current();
return words[cur] || 'variable';
}
function tokenString(stream, state) {
var next, end = false, escaped = false;
while ((next = stream.next()) != null) {
if (next === '"' && !escaped) {
end = true;
break;
}
escaped = !escaped && next === '\\';
}
if (end && !escaped) {
state.tokenize = tokenBase;
}
return 'string';
};
function tokenComment(stream, state) {
var prev, next;
while(state.commentLevel > 0 && (next = stream.next()) != null) {
if (prev === '(' && next === '*') state.commentLevel++;
if (prev === '*' && next === ')') state.commentLevel--;
prev = next;
}
if (state.commentLevel <= 0) {
state.tokenize = tokenBase;
}
return 'comment';
}
return {
startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
token: function(stream, state) {
if (stream.eatSpace()) return null;
return state.tokenize(stream, state);
},
blockCommentStart: "(*",
blockCommentEnd: "*)"
};
});
CodeMirror.defineMIME('text/x-ocaml', 'ocaml');
| {
"pile_set_name": "Github"
} |
20322051544,1979.0,8.8017226E7,ABC,45,2000-01-01
28392898392,1974.0,8.8392926E7,DEF,23,2050-11-27
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>HT32</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<TargetCommonOption>
<Device>HT32F50343</Device>
<Vendor>Holtek</Vendor>
<PackID>Holtek.HT32_DFP.1.0.13</PackID>
<PackURL>http://mcu.holtek.com.tw/pack</PackURL>
<Cpu>IROM(0x00000000-0x0000FBFF) IRAM(0x20000000-0x20002FFF) CLOCK(8000000) CPUTYPE("Cortex-M0+")</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile>"STARTUP\Holtek\HT32F5xxxx\startup_ht32f5xxxx_06.s" ("Holtek HT32F5xxxx Startup Code")</StartupFile>
<FlashDriverDll>UL2CM3(-O142 -S0 -C0 -FO7 -FD20000000 -FC800 -FN2 -FF0HT32F -FS00 -FL0FC00 -FF1HT32F_OPT -FS11FF00000 -FL1400)</FlashDriverDll>
<DeviceId>6409</DeviceId>
<RegisterFile></RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:HT32F50343$SVD\HT32F50343.svd</SFDFile>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\HT32\50343\Obj\</OutputDirectory>
<OutputName>HT32</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\HT32\50343\List\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>cmd.exe /Q /C rmdir "!L.bin" /S /Q > NUL 2>&1</UserProg1Name>
<UserProg2Name>cmd.exe /Q /C del "!L.bin" /S /Q > NUL 2>&1</UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf --bin -o "!L.bin" "!L"</UserProg1Name>
<UserProg2Name>fromelf --text -c -o "!L.text" "!L"</UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
</AfterMake>
<SelectedForBatchBuild>1</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments></SimDllArguments>
<SimDlgDll>DARMCM1.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM0+</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM0+</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
<Simulator>
<UseSimulator>0</UseSimulator>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>1</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>1</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
<LimitSpeedToRealTime>1</LimitSpeedToRealTime>
</Simulator>
<Target>
<UseTarget>1</UseTarget>
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
<RunToMain>0</RunToMain>
<RestoreBreakpoints>1</RestoreBreakpoints>
<RestoreWatchpoints>1</RestoreWatchpoints>
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
<RestoreFunctions>0</RestoreFunctions>
<RestoreToolbox>1</RestoreToolbox>
</Target>
<RunDebugAfterBuild>0</RunDebugAfterBuild>
<TargetSelection>12</TargetSelection>
<SimDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile></InitializationFile>
</SimDlls>
<TargetDlls>
<CpuDll></CpuDll>
<CpuDllArguments></CpuDllArguments>
<PeripheralDll></PeripheralDll>
<PeripheralDllArguments></PeripheralDllArguments>
<InitializationFile>.\HT32F5xxxx_01_DebugSupport.ini</InitializationFile>
<Driver>BIN\CMSIS_AGDI.dll</Driver>
</TargetDlls>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4096</DriverSelection>
</Flash1>
<Flash2>BIN\CMSIS_AGDI.dll</Flash2>
<Flash3>"" ()</Flash3>
<Flash4></Flash4>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>0</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M0+"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>0</RvdsVP>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>1</useUlib>
<EndSel>0</EndSel>
<uLtcg>0</uLtcg>
<RoSelD>3</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x3000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0xfc00</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>3</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>1</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>2</wLevel>
<uThumb>0</uThumb>
<VariousControls>
<MiscControls></MiscControls>
<Define>USE_HT32_DRIVER, USE_HT32F50343_SK, USE_HT32F50343, USE_MEM_HT32F50343</Define>
<Undefine></Undefine>
<IncludePath>..\;..\..\..\..\library\CMSIS\Include;..\..\..\..\library\Device\Holtek\HT32F5xxxx\Include;..\..\..\..\library\HT32F5xxxx_Driver\inc;..\..\..\..\library\HT32_USBD_Library\inc;..\..\..\..\utilities</IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<VariousControls>
<MiscControls></MiscControls>
<Define>USE_HT32_CHIP=15</Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>1</RepFail>
<useFile>0</useFile>
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
<ScatterFile></ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc>--entry Reset_Handler</Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>User</GroupName>
<Files>
<File>
<FileName>main.c</FileName>
<FileType>1</FileType>
<FilePath>..\main.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_01_it.c</FileName>
<FileType>1</FileType>
<FilePath>..\ht32f5xxxx_01_it.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Config</GroupName>
<Files>
<File>
<FileName>ht32f5xxxx_conf.h</FileName>
<FileType>5</FileType>
<FilePath>..\ht32f5xxxx_conf.h</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_01_usbdconf.h</FileName>
<FileType>5</FileType>
<FilePath>..\ht32f5xxxx_01_usbdconf.h</FilePath>
</File>
<File>
<FileName>ht32_op.s</FileName>
<FileType>2</FileType>
<FilePath>.\ht32_op.s</FilePath>
</File>
<File>
<FileName>HT32F5xxxx_01_DebugSupport.ini</FileName>
<FileType>5</FileType>
<FilePath>.\HT32F5xxxx_01_DebugSupport.ini</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>CMSIS</GroupName>
<Files>
<File>
<FileName>system_ht32f5xxxx_06.c</FileName>
<FileType>1</FileType>
<FilePath>..\system_ht32f5xxxx_06.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>MDK-ARM</GroupName>
<Files>
<File>
<FileName>startup_ht32f5xxxx_06.s</FileName>
<FileType>2</FileType>
<FilePath>.\startup_ht32f5xxxx_06.s</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>USBD_Library</GroupName>
<Files>
<File>
<FileName>ht32_usbd_core.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32_USBD_Library\src\ht32_usbd_core.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Library</GroupName>
<Files>
<File>
<FileName>ht32_cm0plus_misc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32_cm0plus_misc.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_adc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_adc.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_bftm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_bftm.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_ckcu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_ckcu.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_crc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_crc.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_div.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_div.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_exti.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_exti.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_flash.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_gpio.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_gpio.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_i2c.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_i2c.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_pdma.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_pdma.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_pwrcu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_pwrcu.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_rstcu.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_rstcu.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_rtc.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_rtc.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_sled.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_sled.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_spi.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_spi.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_tm.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_tm.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_usart.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_usart.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_usbd.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_usbd.c</FilePath>
</File>
<File>
<FileName>ht32f5xxxx_wdt.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32f5xxxx_wdt.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Retarget</GroupName>
<Files>
<File>
<FileName>ht32_retarget.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32_retarget.c</FilePath>
</File>
<File>
<FileName>ht32_serial.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\library\HT32F5xxxx_Driver\src\ht32_serial.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Utilities</GroupName>
<Files>
<File>
<FileName>ht32_board.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\utilities\ht32_board.c</FilePath>
</File>
<File>
<FileName>i2c_eeprom.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\utilities\common\i2c_eeprom.c</FilePath>
</File>
<File>
<FileName>spi_flash.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\utilities\common\spi_flash.c</FilePath>
</File>
<File>
<FileName>spi_lcd.c</FileName>
<FileType>1</FileType>
<FilePath>..\..\..\..\utilities\common\spi_lcd.c</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>Doc</GroupName>
<Files>
<File>
<FileName>readme.txt</FileName>
<FileType>5</FileType>
<FilePath>..\readme.txt</FilePath>
</File>
</Files>
</Group>
</Groups>
</Target>
</Targets>
</Project>
| {
"pile_set_name": "Github"
} |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// very simple module used soley for unit testing - see module.js for use
module.exports.sayHello = function() {
return 'hello';
}; | {
"pile_set_name": "Github"
} |
%%%
%%% Author:
%%% Leif Kornstaedt <[email protected]>
%%%
%%% Contributors:
%%% Christian Schulte <[email protected]>
%%% Denys Duchier <[email protected]>
%%%
%%% Copyright:
%%% Leif Kornstaedt, 1997
%%% Christian Schulte, 1998
%%% Denys Duchier, 1998
%%%
%%% Last change:
%%% $Date$ by $Author$
%%% $Revision$
%%%
%%% This file is part of Mozart, an implementation of Oz 3:
%%% http://www.mozart-oz.org
%%%
%%% See the file "LICENSE" or
%%% http://www.mozart-oz.org/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%
functor
import
%Debug at 'x-oz://boot/Debug'
Application(getCmdArgs)
System(printError)
Property(get put)
OS(getEnv)
Open(file)
Compiler(engine)
Emacs(interface attentionPrefix)
OPIEnv(full)
export
compiler: OPICompiler
interface: CompilerUI
prepare
Spec = record(host(single type: string default: unit))
define
%{Debug.setRaiseOnBlock {Thread.this} true}
Args = {Application.getCmdArgs Spec}
local
OZVERSION = {Property.get 'oz.version'}
OZDATE = {Property.get 'oz.date'}
in
{System.printError
'Mozart Engine '#OZVERSION#' ('#OZDATE#') playing Oz 3\n\n'}
end
{Property.put 'oz.standalone' false}
{Property.put 'errors.prefix' Emacs.attentionPrefix}
OPICompiler = {New Compiler.engine init()}
{OPICompiler enqueue(mergeEnv(OPIEnv.full))}
CompilerUI = {New Emacs.interface init(OPICompiler Args.host)}
{Property.put 'opi.compiler' CompilerUI}
%% Make the error handler non-halting
{Property.put 'errors.toplevel' proc {$} skip end}
{Property.put 'errors.subordinate' proc {$} fail end}
%% Try to load some ozrc file
local
fun {FileExists FileName}
try F in
F = {New Open.file init(name: FileName flags: [read])}
{F close()}
true
catch _ then false
end
end
in
case {OS.getEnv 'HOME'} of false then skip
elseof HOME then
OZRC = {OS.getEnv 'OZRC'}
in
if OZRC \= false andthen {FileExists OZRC} then
{OPICompiler enqueue(feedFile(OZRC))}
elseif {FileExists {Property.get 'oz.dotoz'}#'/ozrc'} then
{OPICompiler enqueue(feedFile({Property.get 'oz.dotoz'}#'/ozrc'))}
elseif {FileExists HOME#'/.oz/ozrc'} then
{OPICompiler enqueue(feedFile(HOME#'/.oz/ozrc'))}
elseif {FileExists HOME#'/.ozrc'} then % note: deprecated
{OPICompiler enqueue(feedFile(HOME#'/.ozrc'))}
end
end
end
thread {CompilerUI readQueries()} end
end
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env node
/**
* Copyright (c) 2016-present Alibaba Group Holding Limited
* @author Houfeng <[email protected]>
*/
const pkg = require('../package.json');
const semver = require('semver');
const debug = require('debug')('cli');
debug('process.version', process.version);
debug('pkg.engines.node', pkg.engines.node);
if (!semver.satisfies(process.version, pkg.engines.node)) {
let console = require('console3');
return console.error([`The Node version requirement is ${pkg.engines.node}`,
`but the current version is ${process.version}`].join(', '));
}
debug('process.argv', process.argv);
require('./cli-core').ready(); | {
"pile_set_name": "Github"
} |
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in D:\AndroidStudio\StudioSDK/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
| {
"pile_set_name": "Github"
} |
[email protected]
[email protected]
[email protected]
[email protected]
aldeed:[email protected]
aldeed:[email protected]
aldeed:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
dburles:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
fourseven:[email protected]
[email protected]
grigio:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
iron:[email protected]
iron:[email protected]
iron:[email protected]
iron:[email protected]
iron:[email protected]
iron:[email protected]
iron:[email protected]
iron:[email protected]
[email protected]_2
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
maxharris9:[email protected]
[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
meteor-gazelle:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
momentjs:[email protected]
[email protected]
[email protected]_2
[email protected]
[email protected]
[email protected]
practicalmeteor:[email protected]_1
practicalmeteor:[email protected]_2
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
sanjo:[email protected]
sanjo:[email protected]
sanjo:[email protected]
sanjo:[email protected]_7
sanjo:[email protected]
[email protected]
[email protected]
[email protected]
softwarerero:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
useraccounts:[email protected]
useraccounts:[email protected]
useraccounts:[email protected]
velocity:[email protected]_1
velocity:[email protected]
velocity:[email protected]
velocity:[email protected]_7
velocity:[email protected]
velocity:[email protected]
velocity:[email protected]_1
[email protected]
[email protected]
zimme:[email protected]
| {
"pile_set_name": "Github"
} |
groupId=in.clouthink.daas.sbb
artifactId=audit-rest
version=1.0.0-SNAPSHOT
| {
"pile_set_name": "Github"
} |
#begin document (wb/sel/33/sel_3398); part 000
wb/sel/33/sel_3398 -1 0 [WORD] DT (TOP(S(NP(NP* - - - - * -
wb/sel/33/sel_3398 -1 1 [WORD] NN *) - - - - * -
wb/sel/33/sel_3398 -1 2 [WORD] WRB (SBAR(WHADVP*) - - - - * -
wb/sel/33/sel_3398 -1 3 [WORD] PRP (S(NP*) - - - - * -
wb/sel/33/sel_3398 -1 4 [WORD] VBP (VP* - - - - * -
wb/sel/33/sel_3398 -1 5 [WORD] VBG (VP*))))) - - - - * -
wb/sel/33/sel_3398 -1 6 [WORD] VBZ (VP* - - - - * -
wb/sel/33/sel_3398 -1 7 [WORD] IN (SBAR* - - - - * -
wb/sel/33/sel_3398 -1 8 [WORD] PRP (S(S(NP*) - - - - * -
wb/sel/33/sel_3398 -1 9 [WORD] VBP (VP* - - - - * -
wb/sel/33/sel_3398 -1 10 [WORD] VBG (VP* - - - - * -
wb/sel/33/sel_3398 -1 11 [WORD] DT (NP*) - - - - * -
wb/sel/33/sel_3398 -1 12 [WORD] IN (PP* - - - - * -
wb/sel/33/sel_3398 -1 13 [WORD] DT (NP(NP* - - - - * -
wb/sel/33/sel_3398 -1 14 [WORD] NN *) - - - - * -
wb/sel/33/sel_3398 -1 15 [WORD] TO (SBAR(S(VP* - - - - * -
wb/sel/33/sel_3398 -1 16 [WORD] VB (VP* - - - - * -
wb/sel/33/sel_3398 -1 17 [WORD] NNS (NP(NP*) - - - - * -
wb/sel/33/sel_3398 -1 18 [WORD] IN (PP* - - - - * -
wb/sel/33/sel_3398 -1 19 [WORD] NN (NP*)))))))))))) - - - - * -
wb/sel/33/sel_3398 -1 20 [WORD] , * - - - - * -
wb/sel/33/sel_3398 -1 21 [WORD] CC * - - - - * -
wb/sel/33/sel_3398 -1 22 [WORD] EX (S(NP*) - - - - * -
wb/sel/33/sel_3398 -1 23 [WORD] VBZ (VP* - - - - * -
wb/sel/33/sel_3398 -1 24 [WORD] NNS (NP(NP(NP*) - - - - * -
wb/sel/33/sel_3398 -1 25 [WORD] RB (ADVP* - - - - * -
wb/sel/33/sel_3398 -1 26 [WORD] RB *)) - - - - * -
wb/sel/33/sel_3398 -1 27 [WORD] WDT (SBAR(WHNP*) - - - - * -
wb/sel/33/sel_3398 -1 28 [WORD] RB (S(ADVP*) - - - - * -
wb/sel/33/sel_3398 -1 29 [WORD] VBP (VP* - - - - * -
wb/sel/33/sel_3398 -1 30 [WORD] DT (NP* - - - - * -
wb/sel/33/sel_3398 -1 31 [WORD] NN *)))))))))) - - - - * -
wb/sel/33/sel_3398 -1 32 [WORD] . *)) - - - - * -
#end document
| {
"pile_set_name": "Github"
} |
From 59d8570d4b61af8544fc295d5e83ab7c28294bb8 Mon Sep 17 00:00:00 2001
From: John Crispin <[email protected]>
Date: Tue, 22 Mar 2016 03:52:07 +0100
Subject: [PATCH 56/91] mtd: add get/set of_node/flash_node helpers
We are going to begin using the mtd->dev.of_node field for MTD device
nodes, so let's add helpers for it. Also, we'll be making some
conversions on spi_nor (and nand_chip eventually) too, so get that ready
with their own helpers.
Signed-off-by: Brian Norris <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
---
include/linux/mtd/mtd.h | 11 +++++++++++
include/linux/mtd/nand.h | 11 +++++++++++
include/linux/mtd/spi-nor.h | 11 +++++++++++
3 files changed, 33 insertions(+)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index f17fa75..cc84923 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -254,6 +254,17 @@ struct mtd_info {
int usecount;
};
+static inline void mtd_set_of_node(struct mtd_info *mtd,
+ struct device_node *np)
+{
+ mtd->dev.of_node = np;
+}
+
+static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
+{
+ return mtd->dev.of_node;
+}
+
int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
void **virt, resource_size_t *phys);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 1ded588..3c34ca4 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -741,6 +741,17 @@ static inline void nand_set_controller_data(struct nand_chip *chip, void *priv)
chip->priv = priv;
}
+static inline void nand_set_flash_node(struct nand_chip *chip,
+ struct device_node *np)
+{
+ chip->flash_node = np;
+}
+
+static inline struct device_node *nand_get_flash_node(struct nand_chip *chip)
+{
+ return chip->flash_node;
+}
+
/*
* NAND Flash Manufacturer ID Codes
*/
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index c8723b6..6d991df 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -185,6 +185,17 @@ struct spi_nor {
void *priv;
};
+static inline void spi_nor_set_flash_node(struct spi_nor *nor,
+ struct device_node *np)
+{
+ nor->flash_node = np;
+}
+
+static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor)
+{
+ return nor->flash_node;
+}
+
/**
* spi_nor_scan() - scan the SPI NOR
* @nor: the spi_nor structure
--
1.7.10.4
| {
"pile_set_name": "Github"
} |
<?php
$fname = dirname(__FILE__) . '/write22.phar';
@unlink($fname);
$phar = new Phar($fname);
$phar->setStub('<?php
$p = new Phar(__FILE__);
var_dump($p["test.txt"]->isCompressed());
$p["test.txt"]->decompress();
var_dump($p["test.txt"]->isCompressed());
echo "ok\n";
__HALT_COMPILER();
?>');
$phar['test.txt'] = "<?php __HALT"."_COMPILER();";
$phar['test.txt']->compress(Phar::GZ);
?>
| {
"pile_set_name": "Github"
} |
const fs = require("fs");
// 异步读取
fs.readFile("./index.txt", "utf8", (err, data) => {
console.log(data); // Hello Nodejs
});
// 同步读取
const data = fs.readFileSync("./index.txt", "utf8");
console.log(data); // Hello Nodejs
// 创建读取流
const stream = fs.createReadStream("./index.txt", "utf8");
// 这里可以看到fs.createReadStream用到了我们前面介绍的events eventEmitter.on() 方法来监听事件
stream.on("data", data => {
console.log(data); // Hello Nodejs
});
| {
"pile_set_name": "Github"
} |
# Copyright (c) 1991-2013 Kawahara Lab., Kyoto University
# Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
# Copyright (c) 2005-2013 Julius project team, Nagoya Institute of Technology
# All rights reserved
SHELL=/bin/sh
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
LIBSENT=../../libsent
CC=@CC@
CFLAGS=@CFLAGS@
CPPFLAGS=@CPPFLAGS@ @DEFS@ -I$(LIBSENT)/include `$(LIBSENT)/libsent-config --cflags`
LDFLAGS=@LDFLAGS@ @LIBS@ @READLINE_LIBS@ -L$(LIBSENT) `$(LIBSENT)/libsent-config --libs`
RM=@RM@ -f
prefix=@prefix@
exec_prefix=@exec_prefix@
INSTALL=@INSTALL@
############################################################
OBJ = nextword.o get_next.o wtoken.o rdterm.o readline.o
TARGET=nextword@EXEEXT@
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJ) $(LDFLAGS)
############################################################
install: install.bin
install.bin: $(TARGET)
${INSTALL} -d @bindir@
@INSTALL_PROGRAM@ $(TARGET) @bindir@
############################################################
clean:
$(RM) *.o *~ core
$(RM) $(TARGET) $(TARGET).exe
distclean:
$(RM) *.o *~ core
$(RM) $(TARGET) $(TARGET).exe
$(RM) Makefile
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<head>
<title>{% block title %}My Webpage{% endblock %}</title>
<style type="text/css">
{% block style %}
body {
background-color: #333;
color: #eee;
font-family: 'Arial', sans-serif;
font-size: 0.9em;
}
a {
color: #d00;
}
{% endblock %}
</style>
</head>
<body>
{% block body %}
<div id="header">
<h1>My Webpage</h1>
<h2>My Subtitle</h2>
</div>
<div id="navigation">
<ul>
{% block navigation %}
<li><a href="index.html">My Home</a></li>
<li><a href="downloads.html">Download</a></li>
<li><a href="about.html">About us</a></li>
{% endblock %}
</ul>
</div>
<div id="content">
{% block content %}{% endblock %}
</div>
<div id="footer">
© Copyright 2007 by Yourself
</div>
{% endblock %}
</body>
</html>
| {
"pile_set_name": "Github"
} |
{include file='user/header_info.tpl'}
<main class="content">
<div class="content-header ui-content-header">
<div class="container">
<h1 class="content-heading">节点信息</h1>
</div>
</div>
<div class="container">
<section class="content-inner margin-top-no">
<div class="ui-card-wrap">
<div class="row">
<div class="col-lg-12 col-sm-12">
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<p class="card-heading">注意!</p>
<p>下面为您的 SSH 配置。</p>
</div>
</div>
</div>
</div>
<div class="col-lg-12 col-sm-12">
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<p class="card-heading">配置信息</p>
<p>{$json_show}</p>
</div>
</div>
</div>
</div>
<div class="col-lg-12 col-sm-12">
<div class="card">
<div class="card-main">
<div class="card-inner margin-bottom-no">
<p class="card-heading">配置方法</p>
<p>未完待续</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</main>
{include file='user/footer.tpl'}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2016-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.vault.config.rabbitmq;
import java.net.InetSocketAddress;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.junit.Before;
import org.junit.Test;
import org.springframework.cloud.vault.config.VaultConfigTemplate;
import org.springframework.cloud.vault.config.VaultProperties;
import org.springframework.cloud.vault.util.CanConnect;
import org.springframework.cloud.vault.util.IntegrationTestSupport;
import org.springframework.cloud.vault.util.Settings;
import org.springframework.cloud.vault.util.Version;
import org.springframework.vault.core.VaultOperations;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.springframework.cloud.vault.config.rabbitmq.VaultConfigRabbitMqBootstrapConfiguration.RabbitMqSecretBackendMetadataFactory.forRabbitMq;
/**
* Integration tests for {@link VaultConfigTemplate} using the rabbitmq secret backend.
* This test requires a running RabbitMQ instance, see {@link #RABBITMQ_URI}.
*
* @author Mark Paluch
*/
public class RabbitMqSecretIntegrationTests extends IntegrationTestSupport {
private static final int RABBITMQ_HTTP_MANAGEMENT_PORT = 15672;
private static final String RABBITMQ_HOST = "localhost";
private static final String RABBITMQ_USERNAME = "guest";
private static final String RABBITMQ_PASSWORD = "guest";
private static final String RABBITMQ_URI = String.format("http://%s:%d", RABBITMQ_HOST,
RABBITMQ_HTTP_MANAGEMENT_PORT);
private static final String VHOSTS_ROLE = "{\"/\":{\"write\": \".*\", \"read\": \".*\"}}";
private VaultProperties vaultProperties = Settings.createVaultProperties();
private VaultConfigTemplate configOperations;
private VaultRabbitMqProperties rabbitmq = new VaultRabbitMqProperties();
/**
* Initialize the rabbitmq secret backend.
*/
@Before
public void setUp() {
assumeTrue(CanConnect.to(new InetSocketAddress(RABBITMQ_HOST, RABBITMQ_HTTP_MANAGEMENT_PORT)));
assumeTrue(prepare().getVersion().isGreaterThanOrEqualTo(Version.parse("0.6.2")));
this.rabbitmq.setEnabled(true);
this.rabbitmq.setRole("readonly");
if (!prepare().hasSecretBackend(this.rabbitmq.getBackend())) {
prepare().mountSecret(this.rabbitmq.getBackend());
}
Map<String, String> connection = new HashMap<>();
connection.put("connection_uri", RABBITMQ_URI);
connection.put("username", RABBITMQ_USERNAME);
connection.put("password", RABBITMQ_PASSWORD);
VaultOperations vaultOperations = prepare().getVaultOperations();
vaultOperations.write(String.format("%s/config/connection", this.rabbitmq.getBackend()), connection);
vaultOperations.write(String.format("%s/roles/%s", this.rabbitmq.getBackend(), this.rabbitmq.getRole()),
Collections.singletonMap("vhosts", VHOSTS_ROLE));
this.configOperations = new VaultConfigTemplate(vaultOperations, this.vaultProperties);
}
@Test
public void shouldCreateCredentialsCorrectly() {
Map<String, Object> secretProperties = this.configOperations.read(forRabbitMq(this.rabbitmq)).getData();
assertThat(secretProperties).containsKeys("spring.rabbitmq.username", "spring.rabbitmq.password");
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2017 Factom Foundation
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.
package wsapi
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
"github.com/FactomProject/factomd/common/globals"
"regexp"
"github.com/FactomProject/factomd/common/interfaces"
"github.com/FactomProject/factomd/common/primitives"
)
type success struct {
Status string `json:"status"`
}
func HandleDebug(writer http.ResponseWriter, request *http.Request) {
_ = globals.Params
state, err := GetState(request)
if err != nil {
wsDebugLog.Errorf("failed to extract port from request: %s", err)
writer.WriteHeader(http.StatusBadRequest)
return
}
if err := checkAuthHeader(state, request); err != nil {
handleUnauthorized(request, writer)
return
}
body, err := ioutil.ReadAll(request.Body)
if err != nil {
HandleV2Error(writer, nil, NewInvalidRequestError())
return
}
j, err := primitives.ParseJSON2Request(string(body))
if err != nil {
HandleV2Error(writer, nil, NewInvalidRequestError())
return
}
jsonResp, jsonError := HandleDebugRequest(state, j)
if jsonError != nil {
HandleV2Error(writer, j, jsonError)
return
}
writer.Write([]byte(jsonResp.String()))
}
func HandleDebugRequest(state interfaces.IState, j *primitives.JSON2Request) (*primitives.JSON2Response, *primitives.JSONError) {
var resp interface{}
var jsonError *primitives.JSONError
params := j.Params
wsDebugLog.Printf("request %v", j.String())
switch j.Method {
case "audit-servers":
resp, jsonError = HandleAuditServers(state, params)
break
case "authorities":
resp, jsonError = HandleAuthorities(state, params)
break
case "configuration":
resp, jsonError = HandleConfig(state, params)
break
case "current-minute":
resp, jsonError = HandleCurrentMinute(state, params)
break
case "delay":
resp, jsonError = HandleDelay(state, params)
break
case "set-delay":
resp, jsonError = HandleSetDelay(state, params)
break
case "drop-rate":
resp, jsonError = HandleDropRate(state, params)
break
case "set-drop-rate":
resp, jsonError = HandleSetDropRate(state, params)
break
case "federated-servers":
resp, jsonError = HandleFedServers(state, params)
break
case "holding-queue":
resp, jsonError = HandleHoldingQueue(state, params)
break
case "messages":
resp, jsonError = HandleMessages(state, params)
break
case "network-info":
resp, jsonError = HandleNetworkInfo(state, params)
break
case "summary":
resp, jsonError = HandleSummary(state, params)
break
case "predictive-fer":
resp, jsonError = HandlePredictiveFER(state, params)
break
case "process-list":
resp, jsonError = HandleProcessList(state, params)
break
case "write-configuration":
resp, jsonError = HandleWriteConfig(state, params)
break
case "reload-configuration":
resp, jsonError = HandleReloadConfig(state, params)
break
case "sim-ctrl":
resp, jsonError = HandleSimControl(state, params)
break
case "wait-blocks":
resp, jsonError = HandleWaitBlocks(state, params)
break
case "wait-for-block":
resp, jsonError = HandleWaitForBlock(state, params)
break
case "wait-minutes":
resp, jsonError = HandleWaitMinutes(state, params)
break
case "wait-for-minute":
resp, jsonError = HandleWaitForMinute(state, params)
break
case "message-filter":
resp, jsonError = HandleMessageFilter(state, params)
break
default:
jsonError = NewMethodNotFoundError()
break
}
if jsonError != nil {
wsDebugLog.Printf("error %v", jsonError)
return nil, jsonError
}
jsonResp := primitives.NewJSON2Response()
jsonResp.ID = j.ID
jsonResp.Result = resp
wsDebugLog.Printf("response %v", jsonResp.String())
return jsonResp, nil
}
func HandleAuditServers(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
AuditServers []interfaces.IServer
}
r := new(ret)
r.AuditServers = state.GetAuditServers(state.GetLeaderHeight())
return r, nil
}
func HandleAuthorities(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Authorities []interfaces.IAuthority `json: "authorities"`
}
r := new(ret)
r.Authorities = state.GetAuthorities()
return r, nil
}
func HandleConfig(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
return state.GetCfg(), nil
}
func HandleCurrentMinute(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Minute int
}
r := new(ret)
r.Minute = state.GetCurrentMinute()
return r, nil
}
func HandleDelay(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Delay int64
}
r := new(ret)
r.Delay = state.GetDelay()
return r, nil
}
func HandleSetDelay(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Delay int64
}
r := new(ret)
delay := new(SetDelayRequest)
err := MapToObject(params, delay)
if err != nil {
return nil, NewInvalidParamsError()
}
state.SetDelay(delay.Delay)
r.Delay = delay.Delay
return r, nil
}
func HandleDropRate(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
DropRate int
}
r := new(ret)
r.DropRate = state.GetDropRate()
return r, nil
}
func HandleSetDropRate(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
DropRate int
}
r := new(ret)
droprate := new(SetDropRateRequest)
err := MapToObject(params, droprate)
if err != nil {
return nil, NewInvalidParamsError()
}
state.SetDropRate(droprate.DropRate)
r.DropRate = droprate.DropRate
return r, nil
}
func HandleFedServers(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
FederatedServers []interfaces.IServer
}
r := new(ret)
r.FederatedServers = state.GetFedServers(state.GetLeaderHeight())
return r, nil
}
func HandleHoldingQueue(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Messages []interfaces.IMsg
}
r := new(ret)
for _, v := range state.LoadHoldingMap() {
r.Messages = append(r.Messages, v)
}
return r, nil
}
func HandleMessages(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Messages []json.RawMessage
}
r := new(ret)
for _, v := range state.GetJournalMessages() {
r.Messages = append(r.Messages, v)
}
return r, nil
}
func HandleNetworkInfo(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
NodeName string
Role string
NetworkNumber int
NetworkName string
NetworkID uint32
}
r := new(ret)
r.NodeName = state.GetFactomNodeName()
r.Role = getRole(state)
r.NetworkNumber = state.GetNetworkNumber()
r.NetworkName = state.GetNetworkName()
r.NetworkID = state.GetNetworkID()
return r, nil
}
func HandleSummary(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
Summary string
}
r := new(ret)
r.Summary = state.ShortString()
return r, nil
}
func HandlePredictiveFER(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
PredictiveFER uint64
}
r := new(ret)
r.PredictiveFER = state.GetPredictiveFER()
return r, nil
}
func HandleProcessList(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
type ret struct {
ProcessList string
}
r := new(ret)
r.ProcessList = state.GetLeaderPL().String()
return r, nil
}
func HandleReloadConfig(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
// LoacConfig with "" strings should load the default location
state.LoadConfig(state.GetConfigPath(), state.GetNetworkName())
return state.GetCfg(), nil
}
func HandleWriteConfig(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
fmt.Sprintf("WRITE_CONFIG: %v", params)
type testCfg struct {
Config string
}
newCfg := new(testCfg)
MapToObject(params, newCfg)
cfgPath := state.GetConfigPath()
f, err := os.Create(cfgPath)
if err == nil {
f.WriteString(fmt.Sprintf("%s", newCfg.Config))
}
return new(success), nil
}
func runCmd(cmd string) {
//os.Stderr.WriteString("Executing: " + cmd + "\n")
globals.InputChan <- cmd
return
}
func HandleSimControl(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
cmdLines := new(GetCommands)
err := MapToObject(params, cmdLines)
if err != nil {
return nil, NewInvalidParamsError()
}
for _, cmdStr := range cmdLines.Commands {
runCmd(cmdStr)
}
r := new(success)
r.Status = "Success!"
return r, nil
}
type SetDelayRequest struct {
Delay int64 `json:"delay"`
}
type SetDropRateRequest struct {
DropRate int `json:"droprate"`
}
type GetCommands struct {
Commands []string `json:"commands"`
}
func HandleMessageFilter(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
wsDebugLog.Println("Factom Node Name: ", state.GetFactomNodeName())
x, ok := params.(map[string]interface{})
if !ok {
return nil, NewCustomInvalidParamsError("ERROR! Invalid params passed in")
}
wsDebugLog.Println(`x["output-regex"]`, x["output-regex"])
wsDebugLog.Println(`x["input-regex"]`, x["input-regex"])
OutputString := fmt.Sprintf("%s", x["output-regex"])
if OutputString != "" {
OutputRegEx := regexp.MustCompile(OutputString)
state.PassOutputRegEx(OutputRegEx, OutputString)
} else if OutputString == "off" {
state.PassOutputRegEx(nil, "")
}
InputString := fmt.Sprintf("%s", x["input-regex"])
if InputString != "" {
InputRegEx := regexp.MustCompile(InputString)
state.PassInputRegEx(InputRegEx, InputString)
} else if InputString == "off" {
state.PassInputRegEx(nil, "")
}
h := new(MessageFilter)
h.Params = "Success"
return h, nil
}
func getParamMap(params interface{}) (x map[string]interface{}, ok bool) {
x, ok = params.(map[string]interface{})
return x, ok
}
func HandleWaitMinutes(s interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
x, _ := getParamMap(params)
min := int(x["minutes"].(float64))
newTime := int(s.GetLLeaderHeight())*10 + s.GetCurrentMinute() + min
newBlock := newTime / 10
newMinute := newTime % 10
waitForQuiet(s, newBlock, newMinute)
r := new(success)
r.Status = "Success!"
return r, nil
}
func HandleWaitBlocks(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
x, _ := getParamMap(params)
blks := int(x["blocks"].(float64))
waitForQuiet(state, blks+int(state.GetLLeaderHeight()), 0)
r := new(success)
r.Status = "Success!"
return r, nil
}
func HandleWaitForBlock(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
x, _ := getParamMap(params)
waitForQuiet(state, int(x["block"].(float64)), 0)
r := new(success)
r.Status = "Success!"
return r, nil
}
func HandleWaitForMinute(state interfaces.IState, params interface{}) (interface{}, *primitives.JSONError) {
x, _ := getParamMap(params)
newMinute := int(x["minute"].(float64))
if newMinute > 10 {
panic("invalid minute")
}
newBlock := int(state.GetLLeaderHeight())
if state.GetCurrentMinute() > newMinute {
newBlock++
}
waitForQuiet(state, newBlock, newMinute)
r := new(success)
r.Status = "Success!"
return r, nil
}
func waitForQuiet(s interfaces.IState, newBlock int, newMinute int) {
// fmt.Printf("%s: %d-:-%d WaitFor(%d-:-%d)\n", s.FactomNodeName, s.LLeaderHeight, s.CurrentMinute, newBlock, newMinute)
sleepTime := time.Duration(globals.Params.BlkTime) * 1000 / 40 // Figure out how long to sleep in milliseconds
if newBlock*10+newMinute < int(s.GetLLeaderHeight())*10+s.GetCurrentMinute() {
panic("Wait for the past")
}
fmt.Printf("wait for quiet : %v", newBlock)
for int(s.GetLLeaderHeight()) < newBlock {
x := int(s.GetLLeaderHeight())
// wait for the next block
for int(s.GetLLeaderHeight()) == x {
time.Sleep(sleepTime * time.Millisecond) // wake up and about 4 times per minute
}
}
// wait for the right minute
for s.GetCurrentMinute() != newMinute {
time.Sleep(sleepTime * time.Millisecond) // wake up and about 4 times per minute
}
}
func getRole(s interfaces.IState) string {
feds := s.GetFedServers(s.GetLLeaderHeight())
for _, fed := range feds {
if s.GetIdentityChainID().IsSameAs(fed.GetChainID()) {
return "Leader"
}
}
audits := s.GetAuditServers(s.GetLLeaderHeight())
for _, aud := range audits {
if s.GetIdentityChainID().IsSameAs(aud.GetChainID()) {
return "Audit"
}
}
return "Follower"
}
| {
"pile_set_name": "Github"
} |
#begin document (nw/xinhua/02/chtb_0243); part 000
nw/xinhua/02/chtb_0243 0 0 [WORD] NNP (TOP(FRAG(NP* - - - - (ORG* -
nw/xinhua/02/chtb_0243 0 1 [WORD] NNP * - - - - * -
nw/xinhua/02/chtb_0243 0 2 [WORD] NNP *) - - - - *) -
nw/xinhua/02/chtb_0243 0 3 [WORD] , * - - - - * -
nw/xinhua/02/chtb_0243 0 4 [WORD] NNP (NP*) - - - - (GPE) -
nw/xinhua/02/chtb_0243 0 5 [WORD] , * - - - - * -
nw/xinhua/02/chtb_0243 0 6 [WORD] NNP (NP* - - - - (DATE* (0
nw/xinhua/02/chtb_0243 0 7 [WORD] NN *))) - - - - *) 0)
nw/xinhua/02/chtb_0243 0 0 [WORD] IN (TOP(S(PP* - - - - * * (ARGM-LOC* * -
nw/xinhua/02/chtb_0243 0 1 [WORD] PRP$ (NP(NP* - - - - * (ARG1*) * * (1)
nw/xinhua/02/chtb_0243 0 2 [WORD] NN *) interview 01 1 - * (V*) * * -
nw/xinhua/02/chtb_0243 0 3 [WORD] IN (PP* - - - - * (ARG0* * * -
nw/xinhua/02/chtb_0243 0 4 [WORD] DT (NP(NP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 5 [WORD] NN *) - - - - * * * * -
nw/xinhua/02/chtb_0243 0 6 [WORD] IN (PP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 7 [WORD] DT (NP* - - - - * * * * (4
nw/xinhua/02/chtb_0243 0 8 [WORD] JJ * - - - - (NORP) * * * -
nw/xinhua/02/chtb_0243 0 9 [WORD] `` * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 10 [WORD] NNP * - - - - (ORG* * * * -
nw/xinhua/02/chtb_0243 0 11 [WORD] '' * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 12 [WORD] NNP *)))))) - - - - *) *) *) * 4)
nw/xinhua/02/chtb_0243 0 13 [WORD] , * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 14 [WORD] JJ (NP(NML* - - - - (NORP) * (ARG0* * (1
nw/xinhua/02/chtb_0243 0 15 [WORD] NN *) president - 2 - * * * * -
nw/xinhua/02/chtb_0243 0 16 [WORD] NNP *) - - - - (PERSON) * *) * 1)
nw/xinhua/02/chtb_0243 0 17 [WORD] , * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 18 [WORD] VBD (VP* warn 01 1 - * * (V*) * -
nw/xinhua/02/chtb_0243 0 19 [WORD] DT (NP* - - - - * * (ARG2* (ARG0* -
nw/xinhua/02/chtb_0243 0 20 [WORD] NNP *) - - - - (LOC) * *) *) -
nw/xinhua/02/chtb_0243 0 21 [WORD] RB (S* - - - - * * (ARG1* (ARGM-NEG*) -
nw/xinhua/02/chtb_0243 0 22 [WORD] TO (VP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 23 [WORD] NN (VP* air - 4 - * * * (ARGM-MNR*) -
nw/xinhua/02/chtb_0243 0 24 [WORD] VB * strike 01 1 - * * * (V*) (3)
nw/xinhua/02/chtb_0243 0 25 [WORD] JJ (NP(NP* - - - - (NORP) * * (ARG1* -
nw/xinhua/02/chtb_0243 0 26 [WORD] NNS *) position - 1 - * * * * -
nw/xinhua/02/chtb_0243 0 27 [WORD] IN (PP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 28 [WORD] NNP (NP* - - - - (GPE* * * * -
nw/xinhua/02/chtb_0243 0 29 [WORD] HYPH * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 30 [WORD] NNP *))))))) - - - - *) * *) *) -
nw/xinhua/02/chtb_0243 0 31 [WORD] . *)) - - - - * * * * -
nw/xinhua/02/chtb_0243 0 0 [WORD] PRP (TOP(S(NP*) - - - - * (ARG0*) * * (1)
nw/xinhua/02/chtb_0243 0 1 [WORD] VBD (VP* hold 02 4 - * (V*) * * -
nw/xinhua/02/chtb_0243 0 2 [WORD] IN (SBAR* - - - - * (ARG1* * * -
nw/xinhua/02/chtb_0243 0 3 [WORD] DT (S(NP*) - - - - * * (ARG0*) * (3)
nw/xinhua/02/chtb_0243 0 4 [WORD] MD (VP* - - - - * * (ARGM-MOD*) * -
nw/xinhua/02/chtb_0243 0 5 [WORD] RB (ADVP*) - - - - * * (ARGM-ADV*) * -
nw/xinhua/02/chtb_0243 0 6 [WORD] VB (VP* cause 01 1 - * * (V*) * -
nw/xinhua/02/chtb_0243 0 7 [WORD] DT (S(NP* - - - - * * (ARG1* (ARG1* (2
nw/xinhua/02/chtb_0243 0 8 [WORD] NN *) situation - 1 - * * * *) 2)
nw/xinhua/02/chtb_0243 0 9 [WORD] TO (VP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 10 [WORD] VB (VP* deteriorate 01 1 - * * * (V*) -
nw/xinhua/02/chtb_0243 0 11 [WORD] RB (ADVP*))))))))) - - - - * *) *) (ARGM-ADV*) -
nw/xinhua/02/chtb_0243 0 12 [WORD] . *)) - - - - * * * * -
nw/xinhua/02/chtb_0243 0 0 [WORD] VBG (TOP(S(PP* - - - - * * (ARGM-ADV* * -
nw/xinhua/02/chtb_0243 0 1 [WORD] IN (PP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 2 [WORD] DT (NP(NP(NP* - - - - (ORG* * * * -
nw/xinhua/02/chtb_0243 0 3 [WORD] NNP * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 4 [WORD] NNP * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 5 [WORD] NNP * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 6 [WORD] POS *) - - - - *) * * * -
nw/xinhua/02/chtb_0243 0 7 [WORD] NN *) report - 1 - * * * * -
nw/xinhua/02/chtb_0243 0 8 [WORD] IN (PP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 9 [WORD] DT (NP* - - - - (DATE* * * * (0
nw/xinhua/02/chtb_0243 0 10 [WORD] NN *))))) - - - - *) * *) * 0)
nw/xinhua/02/chtb_0243 0 11 [WORD] , * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 12 [WORD] DT (NP(NP* - - - - (WORK_OF_ART* (ARG1* (ARG0* * (4
nw/xinhua/02/chtb_0243 0 13 [WORD] `` * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 14 [WORD] NNP * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 15 [WORD] '' * - - - - * * * * -
nw/xinhua/02/chtb_0243 0 16 [WORD] NNP *) - - - - *) *) * * 4)
nw/xinhua/02/chtb_0243 0 17 [WORD] WDT (SBAR(WHNP*) - - - - * (R-ARG1*) * * -
nw/xinhua/02/chtb_0243 0 18 [WORD] MD (S(VP* - - - - * (ARGM-MOD*) * * -
nw/xinhua/02/chtb_0243 0 19 [WORD] VB (VP* - - - - * * * * -
nw/xinhua/02/chtb_0243 0 20 [WORD] VBN (VP* publish 01 1 - * (V*) * * -
nw/xinhua/02/chtb_0243 0 21 [WORD] IN (PP* - - - - * (ARGM-TMP* * * -
nw/xinhua/02/chtb_0243 0 22 [WORD] DT (NP* - - - - (DATE* * * * -
nw/xinhua/02/chtb_0243 0 23 [WORD] NN *)))))))) - - - - *) *) *) * -
nw/xinhua/02/chtb_0243 0 24 [WORD] MD (VP* - - - - * * (ARGM-MOD*) * -
nw/xinhua/02/chtb_0243 0 25 [WORD] VB (VP* carry 01 2 - * * (V*) * -
nw/xinhua/02/chtb_0243 0 26 [WORD] DT (NP(NP* - - - - * * (ARG1* * -
nw/xinhua/02/chtb_0243 0 27 [WORD] JJ * - - - - * * * (ARGM-ADJ*) -
nw/xinhua/02/chtb_0243 0 28 [WORD] NNS *) speech 01 4 - * * * (V*) -
nw/xinhua/02/chtb_0243 0 29 [WORD] IN (PP* - - - - * * * (ARG0* -
nw/xinhua/02/chtb_0243 0 30 [WORD] NNP (NP*))))) - - - - (PERSON) * *) *) (1)
nw/xinhua/02/chtb_0243 0 31 [WORD] . *)) - - - - * * * * -
nw/xinhua/02/chtb_0243 0 0 [WORD] NNP (TOP(S(NP*) - - - - (PERSON) (ARG0*) * * * * (1)
nw/xinhua/02/chtb_0243 0 1 [WORD] VBD (VP* say 01 1 - * (V*) * * * * -
nw/xinhua/02/chtb_0243 0 2 [WORD] IN (SBAR* - - - - * (ARG1* * * * * -
nw/xinhua/02/chtb_0243 0 3 [WORD] DT (S(NP(NP* - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 4 [WORD] JJR * - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 5 [WORD] NN *) solution - 4 - * * * * * * -
nw/xinhua/02/chtb_0243 0 6 [WORD] IN (PP* - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 7 [WORD] DT (NP(NP* - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 8 [WORD] NN *) use 01 1 - * * (V*) * * * -
nw/xinhua/02/chtb_0243 0 9 [WORD] IN (PP* - - - - * * (ARG1* * * * -
nw/xinhua/02/chtb_0243 0 10 [WORD] NN (NP*))))) - - - - * * *) * * * -
nw/xinhua/02/chtb_0243 0 11 [WORD] VBZ (VP* be - 1 - * * * * * * -
nw/xinhua/02/chtb_0243 0 12 [WORD] TO (S(VP(VP* - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 13 [WORD] VB (VP* pacify 01 - - * * * (V*) * * -
nw/xinhua/02/chtb_0243 0 14 [WORD] DT (NP* - - - - * * * (ARG1* * * (2
nw/xinhua/02/chtb_0243 0 15 [WORD] NN *))) situation - 1 - * * * *) * * 2)
nw/xinhua/02/chtb_0243 0 16 [WORD] CC * - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 17 [WORD] TO (VP* - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 18 [WORD] VB (VP* achieve 01 1 - * * * * (V*) * -
nw/xinhua/02/chtb_0243 0 19 [WORD] DT (NP* - - - - * * * * (ARG1* * -
nw/xinhua/02/chtb_0243 0 20 [WORD] NN *) agreement - 1 - * * * * *) * -
nw/xinhua/02/chtb_0243 0 21 [WORD] IN (PP* - - - - * * * * (ARGM-MNR* * -
nw/xinhua/02/chtb_0243 0 22 [WORD] JJ (NP* - - - - * * * * * (ARGM-MNR*) -
nw/xinhua/02/chtb_0243 0 23 [WORD] NNS *)))))))))) approach 02 3 - * *) * * *) (V*) -
nw/xinhua/02/chtb_0243 0 24 [WORD] . *)) - - - - * * * * * * -
nw/xinhua/02/chtb_0243 0 0 [WORD] IN (TOP(S(PP* - - - - * * (ARGM-LOC* * * * * * -
nw/xinhua/02/chtb_0243 0 1 [WORD] PRP$ (NP* - - - - * (ARG0*) * * * * * * (1)
nw/xinhua/02/chtb_0243 0 2 [WORD] NN *)) speech 01 4 - * (V*) *) * * * * * -
nw/xinhua/02/chtb_0243 0 3 [WORD] , * - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 4 [WORD] NNP (NP*) - - - - (PERSON) * (ARG0*) * * * * * (1)
nw/xinhua/02/chtb_0243 0 5 [WORD] VBD (VP* advocate 01 1 - * * (V*) * * * * * -
nw/xinhua/02/chtb_0243 0 6 [WORD] IN (SBAR(SBAR* - - - - * * (ARG1* * * * * * -
nw/xinhua/02/chtb_0243 0 7 [WORD] JJ (S(NP* - - - - (NORP) * * (ARG0* * * * * -
nw/xinhua/02/chtb_0243 0 8 [WORD] NNS *) - - - - * * * *) * * * * -
nw/xinhua/02/chtb_0243 0 9 [WORD] MD (VP* - - - - * * * (ARGM-MOD*) * * * * -
nw/xinhua/02/chtb_0243 0 10 [WORD] VB (VP* participate 01 1 - * * * (V*) * * * * -
nw/xinhua/02/chtb_0243 0 11 [WORD] RBR (ADVP*) - - - - * * * (ARGM-ADV*) * * * * -
nw/xinhua/02/chtb_0243 0 12 [WORD] IN (PP* - - - - * * * (ARG1* * * * * -
nw/xinhua/02/chtb_0243 0 13 [WORD] NNP (NP* - - - - (ORG) * * * (ARG0*) * * * (5)
nw/xinhua/02/chtb_0243 0 14 [WORD] NN * - - - - * * * * (ARG1*) * * * -
nw/xinhua/02/chtb_0243 0 15 [WORD] NNS *)))))) mission 01 1 - * * * *) (V*) * * * -
nw/xinhua/02/chtb_0243 0 16 [WORD] , * - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 17 [WORD] CC * - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 18 [WORD] IN (SBAR* - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 19 [WORD] JJ (S(NP(NP* - - - - (NORP) * * * * (ARG0* (ARG1* (ARG0* -
nw/xinhua/02/chtb_0243 0 20 [WORD] NNS *) - - - - * * * * * *) *) * -
nw/xinhua/02/chtb_0243 0 21 [WORD] VBG (VP(VP* participate 01 1 - * * * * * (V*) * * -
nw/xinhua/02/chtb_0243 0 22 [WORD] IN (PP* - - - - * * * * * (ARG1* * * -
nw/xinhua/02/chtb_0243 0 23 [WORD] DT (NP* - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 24 [WORD] NNP (NML* - - - - (ORG* * * * * * * * (5
nw/xinhua/02/chtb_0243 0 25 [WORD] NNPS *) - - - - *) * * * * * * * 5)
nw/xinhua/02/chtb_0243 0 26 [WORD] NN * - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 27 [WORD] NNS *))) force - 2 - * * * * * *) * * -
nw/xinhua/02/chtb_0243 0 28 [WORD] CC * - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 29 [WORD] VBN (VP* station 01 - - * * * * * * (V*) * -
nw/xinhua/02/chtb_0243 0 30 [WORD] IN (PP* - - - - * * * * * * (ARG2* * -
nw/xinhua/02/chtb_0243 0 31 [WORD] DT (NP* - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 32 [WORD] NNP * - - - - (LOC) * * * * * * * -
nw/xinhua/02/chtb_0243 0 33 [WORD] NN *))))) - - - - * * * * * * *) *) -
nw/xinhua/02/chtb_0243 0 34 [WORD] VBP (VP* deserve 01 1 - * * * * * * * (V*) -
nw/xinhua/02/chtb_0243 0 35 [WORD] NN (NP*)))))) welcome - 1 - * * *) * * * * (ARG1*) -
nw/xinhua/02/chtb_0243 0 36 [WORD] . *)) - - - - * * * * * * * * -
nw/xinhua/02/chtb_0243 0 0 [WORD] -LRB- (TOP(NP* - - - - * -
nw/xinhua/02/chtb_0243 0 1 [WORD] NN * end - 4 - * -
nw/xinhua/02/chtb_0243 0 2 [WORD] -RRB- *)) - - - - * -
#end document
| {
"pile_set_name": "Github"
} |
{
"name": "@themer/alfred",
"version": "1.1.2",
"description": "An Alfred.app theme generator for themer.",
"main": "lib/index.js",
"engines": {
"node": ">=6.11"
},
"scripts": {
"prepublishOnly": "cp ../../../LICENSE.md ./"
},
"author": "mjswensen",
"license": "MIT",
"files": [
"/lib/index.js"
],
"devDependencies": {},
"dependencies": {},
"peerDependencies": {
"themer": "^1.0.2||^2||^3"
},
"repository": {
"type": "git",
"url": "git+https://github.com/mjswensen/themer.git"
},
"keywords": [
"themer",
"alfred",
"theme"
],
"bugs": {
"url": "https://github.com/mjswensen/themer/issues"
},
"homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/alfred#readme"
}
| {
"pile_set_name": "Github"
} |
Authentication Info:
auth = no
| {
"pile_set_name": "Github"
} |
.so man3/avr_stdio.3
| {
"pile_set_name": "Github"
} |
# context
[Source code of released version](https://github.com/meteor/meteor/tree/master/packages/context) | [Source code of development version](https://github.com/meteor/meteor/tree/devel/packages/context)
***
Meteor wrapper package for the
[`@wry/context`](https://github.com/benjamn/wryware/tree/master/packages/context)
npm package.
| {
"pile_set_name": "Github"
} |
package com.liuyanzhao.sens.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.liuyanzhao.sens.common.base.BaseEntity;
import lombok.Data;
/**
* <pre>
* 幻灯片
* </pre>
*
* @author : saysky
* @date : 2018/1/24
*/
@Data
@TableName("sens_widget")
public class Widget extends BaseEntity {
/**
* 小工具标题
*/
private String widgetTitle;
/**
* 小工具内容
*/
private String widgetContent;
/**
* 是否显示(1是,0否)
*/
private Integer isDisplay = 1;
/**
* 位置
*/
private Integer widgetType;
}
| {
"pile_set_name": "Github"
} |
/*
* This file is generated by jOOQ.
*/
package org.jooq.example.chart.db.tables.records;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.jooq.Field;
import org.jooq.Record1;
import org.jooq.Record10;
import org.jooq.Row10;
import org.jooq.example.chart.db.tables.Customer;
import org.jooq.impl.UpdatableRecordImpl;
/**
* This class is generated by jOOQ.
*/
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class CustomerRecord extends UpdatableRecordImpl<CustomerRecord> implements Record10<Integer, Integer, String, String, String, Integer, Boolean, LocalDate, LocalDateTime, Integer> {
private static final long serialVersionUID = 1300926953;
/**
* Setter for <code>public.customer.customer_id</code>.
*/
public void setCustomerId(Integer value) {
set(0, value);
}
/**
* Getter for <code>public.customer.customer_id</code>.
*/
public Integer getCustomerId() {
return (Integer) get(0);
}
/**
* Setter for <code>public.customer.store_id</code>.
*/
public void setStoreId(Integer value) {
set(1, value);
}
/**
* Getter for <code>public.customer.store_id</code>.
*/
public Integer getStoreId() {
return (Integer) get(1);
}
/**
* Setter for <code>public.customer.first_name</code>.
*/
public void setFirstName(String value) {
set(2, value);
}
/**
* Getter for <code>public.customer.first_name</code>.
*/
public String getFirstName() {
return (String) get(2);
}
/**
* Setter for <code>public.customer.last_name</code>.
*/
public void setLastName(String value) {
set(3, value);
}
/**
* Getter for <code>public.customer.last_name</code>.
*/
public String getLastName() {
return (String) get(3);
}
/**
* Setter for <code>public.customer.email</code>.
*/
public void setEmail(String value) {
set(4, value);
}
/**
* Getter for <code>public.customer.email</code>.
*/
public String getEmail() {
return (String) get(4);
}
/**
* Setter for <code>public.customer.address_id</code>.
*/
public void setAddressId(Integer value) {
set(5, value);
}
/**
* Getter for <code>public.customer.address_id</code>.
*/
public Integer getAddressId() {
return (Integer) get(5);
}
/**
* Setter for <code>public.customer.activebool</code>.
*/
public void setActivebool(Boolean value) {
set(6, value);
}
/**
* Getter for <code>public.customer.activebool</code>.
*/
public Boolean getActivebool() {
return (Boolean) get(6);
}
/**
* Setter for <code>public.customer.create_date</code>.
*/
public void setCreateDate(LocalDate value) {
set(7, value);
}
/**
* Getter for <code>public.customer.create_date</code>.
*/
public LocalDate getCreateDate() {
return (LocalDate) get(7);
}
/**
* Setter for <code>public.customer.last_update</code>.
*/
public void setLastUpdate(LocalDateTime value) {
set(8, value);
}
/**
* Getter for <code>public.customer.last_update</code>.
*/
public LocalDateTime getLastUpdate() {
return (LocalDateTime) get(8);
}
/**
* Setter for <code>public.customer.active</code>.
*/
public void setActive(Integer value) {
set(9, value);
}
/**
* Getter for <code>public.customer.active</code>.
*/
public Integer getActive() {
return (Integer) get(9);
}
// -------------------------------------------------------------------------
// Primary key information
// -------------------------------------------------------------------------
@Override
public Record1<Integer> key() {
return (Record1) super.key();
}
// -------------------------------------------------------------------------
// Record10 type implementation
// -------------------------------------------------------------------------
@Override
public Row10<Integer, Integer, String, String, String, Integer, Boolean, LocalDate, LocalDateTime, Integer> fieldsRow() {
return (Row10) super.fieldsRow();
}
@Override
public Row10<Integer, Integer, String, String, String, Integer, Boolean, LocalDate, LocalDateTime, Integer> valuesRow() {
return (Row10) super.valuesRow();
}
@Override
public Field<Integer> field1() {
return Customer.CUSTOMER.CUSTOMER_ID;
}
@Override
public Field<Integer> field2() {
return Customer.CUSTOMER.STORE_ID;
}
@Override
public Field<String> field3() {
return Customer.CUSTOMER.FIRST_NAME;
}
@Override
public Field<String> field4() {
return Customer.CUSTOMER.LAST_NAME;
}
@Override
public Field<String> field5() {
return Customer.CUSTOMER.EMAIL;
}
@Override
public Field<Integer> field6() {
return Customer.CUSTOMER.ADDRESS_ID;
}
@Override
public Field<Boolean> field7() {
return Customer.CUSTOMER.ACTIVEBOOL;
}
@Override
public Field<LocalDate> field8() {
return Customer.CUSTOMER.CREATE_DATE;
}
@Override
public Field<LocalDateTime> field9() {
return Customer.CUSTOMER.LAST_UPDATE;
}
@Override
public Field<Integer> field10() {
return Customer.CUSTOMER.ACTIVE;
}
@Override
public Integer component1() {
return getCustomerId();
}
@Override
public Integer component2() {
return getStoreId();
}
@Override
public String component3() {
return getFirstName();
}
@Override
public String component4() {
return getLastName();
}
@Override
public String component5() {
return getEmail();
}
@Override
public Integer component6() {
return getAddressId();
}
@Override
public Boolean component7() {
return getActivebool();
}
@Override
public LocalDate component8() {
return getCreateDate();
}
@Override
public LocalDateTime component9() {
return getLastUpdate();
}
@Override
public Integer component10() {
return getActive();
}
@Override
public Integer value1() {
return getCustomerId();
}
@Override
public Integer value2() {
return getStoreId();
}
@Override
public String value3() {
return getFirstName();
}
@Override
public String value4() {
return getLastName();
}
@Override
public String value5() {
return getEmail();
}
@Override
public Integer value6() {
return getAddressId();
}
@Override
public Boolean value7() {
return getActivebool();
}
@Override
public LocalDate value8() {
return getCreateDate();
}
@Override
public LocalDateTime value9() {
return getLastUpdate();
}
@Override
public Integer value10() {
return getActive();
}
@Override
public CustomerRecord value1(Integer value) {
setCustomerId(value);
return this;
}
@Override
public CustomerRecord value2(Integer value) {
setStoreId(value);
return this;
}
@Override
public CustomerRecord value3(String value) {
setFirstName(value);
return this;
}
@Override
public CustomerRecord value4(String value) {
setLastName(value);
return this;
}
@Override
public CustomerRecord value5(String value) {
setEmail(value);
return this;
}
@Override
public CustomerRecord value6(Integer value) {
setAddressId(value);
return this;
}
@Override
public CustomerRecord value7(Boolean value) {
setActivebool(value);
return this;
}
@Override
public CustomerRecord value8(LocalDate value) {
setCreateDate(value);
return this;
}
@Override
public CustomerRecord value9(LocalDateTime value) {
setLastUpdate(value);
return this;
}
@Override
public CustomerRecord value10(Integer value) {
setActive(value);
return this;
}
@Override
public CustomerRecord values(Integer value1, Integer value2, String value3, String value4, String value5, Integer value6, Boolean value7, LocalDate value8, LocalDateTime value9, Integer value10) {
value1(value1);
value2(value2);
value3(value3);
value4(value4);
value5(value5);
value6(value6);
value7(value7);
value8(value8);
value9(value9);
value10(value10);
return this;
}
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
/**
* Create a detached CustomerRecord
*/
public CustomerRecord() {
super(Customer.CUSTOMER);
}
/**
* Create a detached, initialised CustomerRecord
*/
public CustomerRecord(Integer customerId, Integer storeId, String firstName, String lastName, String email, Integer addressId, Boolean activebool, LocalDate createDate, LocalDateTime lastUpdate, Integer active) {
super(Customer.CUSTOMER);
set(0, customerId);
set(1, storeId);
set(2, firstName);
set(3, lastName);
set(4, email);
set(5, addressId);
set(6, activebool);
set(7, createDate);
set(8, lastUpdate);
set(9, active);
}
}
| {
"pile_set_name": "Github"
} |
#
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Main makefile for the host tools
#
curdir:=tools
# subdirectories to descend into
tools-y :=
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN)$(CONFIG_GCC_LLVM),)
tools-y += gmp mpfr mpc libelf
endif
tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs
tools-y += sstrip ipkg-utils genext2fs e2fsprogs mtd-utils mkimage
tools-y += firmware-utils patch-cmdline quilt yaffs2 flock padjffs2
tools-y += mm-macros xorg-macros xfce-macros missing-macros xz cmake scons
tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
tools-$(CONFIG_powerpc) += upx
tools-$(CONFIG_TARGET_x86) += qemu
tools-$(CONFIG_TARGET_brcm2708) += mtools dosfstools
ifneq ($(CONFIG_TARGET_ar71xx),)
tools-y += lzma-old squashfs
endif
tools-y += lzma squashfs4
tools-y += b43-tools
ifneq ($(CONFIG_PACKAGE_firmwarehotplug),)
tools-y += sdcc
endif
ifdef CONFIG_GCC_USE_GRAPHITE
ifeq ($(CONFIG_GCC_USE_SYSTEM_PPL_CLOOG),)
tools-y += ppl cloog
$(curdir)/cloog/compile := $(curdir)/ppl/install
endif
endif
# builddir dependencies
$(curdir)/bison/compile := $(curdir)/flex/install
$(curdir)/flex/compile := $(curdir)/m4/install
$(curdir)/pkg-config/compile := $(curdir)/sed/install
$(curdir)/libtool/compile := $(curdir)/sed/install
$(curdir)/squashfs/compile := $(curdir)/lzma-old/install
$(curdir)/squashfs4/compile := $(curdir)/xz/install
$(curdir)/quilt/compile := $(curdir)/sed/install $(curdir)/autoconf/install
$(curdir)/dtc/compile := $(curdir)/bison/install
$(curdir)/autoconf/compile := $(curdir)/m4/install $(curdir)/libtool/install
$(curdir)/automake/compile := $(curdir)/m4/install $(curdir)/autoconf/install $(curdir)/pkg-config/install $(curdir)/xz/install
$(curdir)/gmp/compile := $(curdir)/automake/install
$(curdir)/mpc/compile := $(curdir)/mpfr/install $(curdir)/gmp/install
$(curdir)/mpfr/compile := $(curdir)/gmp/install
$(curdir)/ppl/compile := $(curdir)/gmp/install
$(curdir)/cloog/compile := $(curdir)/ppl/install
$(curdir)/mtd-utils/compile := $(curdir)/e2fsprogs/install $(curdir)/xz/install
$(curdir)/mkimage/compile := $(curdir)/sed/install
$(curdir)/qemu/compile := $(curdir)/e2fsprogs/install
$(curdir)/upslug2/compile := $(curdir)/automake/install
$(curdir)/mm-macros/compile := $(curdir)/automake/install
$(curdir)/xorg-macros/compile := $(curdir)/automake/install
$(curdir)/xfce-macros/compile := $(curdir)/automake/install
$(curdir)/missing-macros/compile := $(curdir)/automake/install
$(curdir)/e2fsprogs/compile := $(curdir)/automake/install
$(curdir)/libelf/compile := $(curdir)/automake/install
$(curdir)/sdcc/compile := $(curdir)/bison/install
$(curdir)/b43-tools/compile := $(curdir)/bison/install
ifneq ($(CONFIG_CCACHE),)
$(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/install))
tools-y += ccache
endif
$(curdir)/builddirs := $(tools-y) $(tools-dep) $(tools-)
$(curdir)/builddirs-default := $(tools-y)
ifndef DUMP_TARGET_DB
define PrepareStaging
@for dir in $(1); do ( \
$(if $(QUIET),,set -x;) \
mkdir -p "$$dir"; \
cd "$$dir"; \
mkdir -p bin lib include stamp; \
); done
endef
# preparatory work
$(STAGING_DIR)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR))
mkdir -p $(BUILD_DIR)/stamp
touch $@
$(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
$(call PrepareStaging,$(STAGING_DIR_HOST))
mkdir -p $(BUILD_DIR_HOST)/stamp $(STAGING_DIR_HOST)/include/sys
$(INSTALL_DATA) $(TOPDIR)/tools/include/*.h $(STAGING_DIR_HOST)/include/
$(INSTALL_DATA) $(TOPDIR)/tools/include/sys/*.h $(STAGING_DIR_HOST)/include/sys/
ln -sf lib $(STAGING_DIR_HOST)/lib64
touch $@
define PrepareCommand
$(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR)/.prepared
@mkdir -p "$$(dir $$@)"; rm -f "$$@"
@export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \
echo "Command $(1) not found."; false; \
}; ln -s "$$$$FILE" "$$@"
endef
endif
$(STAGING_DIR_HOST)/bin/stat: $(STAGING_DIR)/.prepared
@rm -f $@
@if stat --version > /dev/null 2>&1; then \
ln -s `which stat` $@; \
elif gstat --version > /dev/null 2>&1; then \
ln -s `which gstat` $@; \
else \
echo "GNU stat not found"; \
false; \
fi
$(eval $(call PrepareCommand,find,gfind find))
$(eval $(call PrepareCommand,md5sum,gmd5sum md5sum $(SCRIPT_DIR)/md5sum))
$(eval $(call PrepareCommand,cp,gcp cp))
$(eval $(call PrepareCommand,seq,gseq seq))
$(eval $(call PrepareCommand,python,python2 python))
$(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,find md5sum cp stat seq python)
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
# prerequisites for the individual targets
$(curdir)/ := .config prereq
$(curdir)//install = $(1)/compile
$(eval $(call stampfile,$(curdir),tools,install,,CONFIG_CCACHE CONFIG_powerpc CONFIG_GCC_VERSION_4_5 CONFIG_GCC_USE_GRAPHITE CONFIG_TARGET_orion_generic))
$(eval $(call subdir,$(curdir)))
| {
"pile_set_name": "Github"
} |
{
"index_name": "coalitions",
"stop_urls": [],
"selectors": {
"lvl0": {
"selector": ".contents h1",
"default_value": "Documentation"
},
"lvl1": ".contents h2",
"lvl2": ".contents h3, .contents th",
"lvl3": ".contents h4",
"lvl4": ".contents h5",
"text": ".contents p, .contents li, .usage, .template-article .contents .pre"
},
"selectors_exclude": [
".dont-index"
],
"sitemap_urls": [
"https://adibender.github.io/coalitions/sitemap.xml"
],
"custom_settings": {
"separatorsToIndex": "_"
},
"conversation_id": [
"565947957"
],
"nb_hits": 475
} | {
"pile_set_name": "Github"
} |
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2013 Erwin Coumans http://bulletphysics.org
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
///b3DynamicBvh implementation by Nathanael Presson
#include "b3DynamicBvh.h"
//
typedef b3AlignedObjectArray<b3DbvtNode*> b3NodeArray;
typedef b3AlignedObjectArray<const b3DbvtNode*> b3ConstNodeArray;
//
struct b3DbvtNodeEnumerator : b3DynamicBvh::ICollide
{
b3ConstNodeArray nodes;
void Process(const b3DbvtNode* n) { nodes.push_back(n); }
};
//
static B3_DBVT_INLINE int b3IndexOf(const b3DbvtNode* node)
{
return (node->parent->childs[1] == node);
}
//
static B3_DBVT_INLINE b3DbvtVolume b3Merge(const b3DbvtVolume& a,
const b3DbvtVolume& b)
{
#if (B3_DBVT_MERGE_IMPL == B3_DBVT_IMPL_SSE)
B3_ATTRIBUTE_ALIGNED16(char locals[sizeof(b3DbvtAabbMm)]);
b3DbvtVolume& res = *(b3DbvtVolume*)locals;
#else
b3DbvtVolume res;
#endif
b3Merge(a, b, res);
return (res);
}
// volume+edge lengths
static B3_DBVT_INLINE b3Scalar b3Size(const b3DbvtVolume& a)
{
const b3Vector3 edges = a.Lengths();
return (edges.x * edges.y * edges.z +
edges.x + edges.y + edges.z);
}
//
static void b3GetMaxDepth(const b3DbvtNode* node, int depth, int& maxdepth)
{
if (node->isinternal())
{
b3GetMaxDepth(node->childs[0], depth + 1, maxdepth);
b3GetMaxDepth(node->childs[1], depth + 1, maxdepth);
}
else
maxdepth = b3Max(maxdepth, depth);
}
//
static B3_DBVT_INLINE void b3DeleteNode(b3DynamicBvh* pdbvt,
b3DbvtNode* node)
{
b3AlignedFree(pdbvt->m_free);
pdbvt->m_free = node;
}
//
static void b3RecurseDeleteNode(b3DynamicBvh* pdbvt,
b3DbvtNode* node)
{
if (!node->isleaf())
{
b3RecurseDeleteNode(pdbvt, node->childs[0]);
b3RecurseDeleteNode(pdbvt, node->childs[1]);
}
if (node == pdbvt->m_root) pdbvt->m_root = 0;
b3DeleteNode(pdbvt, node);
}
//
static B3_DBVT_INLINE b3DbvtNode* b3CreateNode(b3DynamicBvh* pdbvt,
b3DbvtNode* parent,
void* data)
{
b3DbvtNode* node;
if (pdbvt->m_free)
{
node = pdbvt->m_free;
pdbvt->m_free = 0;
}
else
{
node = new (b3AlignedAlloc(sizeof(b3DbvtNode), 16)) b3DbvtNode();
}
node->parent = parent;
node->data = data;
node->childs[1] = 0;
return (node);
}
//
static B3_DBVT_INLINE b3DbvtNode* b3CreateNode(b3DynamicBvh* pdbvt,
b3DbvtNode* parent,
const b3DbvtVolume& volume,
void* data)
{
b3DbvtNode* node = b3CreateNode(pdbvt, parent, data);
node->volume = volume;
return (node);
}
//
static B3_DBVT_INLINE b3DbvtNode* b3CreateNode(b3DynamicBvh* pdbvt,
b3DbvtNode* parent,
const b3DbvtVolume& volume0,
const b3DbvtVolume& volume1,
void* data)
{
b3DbvtNode* node = b3CreateNode(pdbvt, parent, data);
b3Merge(volume0, volume1, node->volume);
return (node);
}
//
static void b3InsertLeaf(b3DynamicBvh* pdbvt,
b3DbvtNode* root,
b3DbvtNode* leaf)
{
if (!pdbvt->m_root)
{
pdbvt->m_root = leaf;
leaf->parent = 0;
}
else
{
if (!root->isleaf())
{
do
{
root = root->childs[b3Select(leaf->volume,
root->childs[0]->volume,
root->childs[1]->volume)];
} while (!root->isleaf());
}
b3DbvtNode* prev = root->parent;
b3DbvtNode* node = b3CreateNode(pdbvt, prev, leaf->volume, root->volume, 0);
if (prev)
{
prev->childs[b3IndexOf(root)] = node;
node->childs[0] = root;
root->parent = node;
node->childs[1] = leaf;
leaf->parent = node;
do
{
if (!prev->volume.Contain(node->volume))
b3Merge(prev->childs[0]->volume, prev->childs[1]->volume, prev->volume);
else
break;
node = prev;
} while (0 != (prev = node->parent));
}
else
{
node->childs[0] = root;
root->parent = node;
node->childs[1] = leaf;
leaf->parent = node;
pdbvt->m_root = node;
}
}
}
//
static b3DbvtNode* b3RemoveLeaf(b3DynamicBvh* pdbvt,
b3DbvtNode* leaf)
{
if (leaf == pdbvt->m_root)
{
pdbvt->m_root = 0;
return (0);
}
else
{
b3DbvtNode* parent = leaf->parent;
b3DbvtNode* prev = parent->parent;
b3DbvtNode* sibling = parent->childs[1 - b3IndexOf(leaf)];
if (prev)
{
prev->childs[b3IndexOf(parent)] = sibling;
sibling->parent = prev;
b3DeleteNode(pdbvt, parent);
while (prev)
{
const b3DbvtVolume pb = prev->volume;
b3Merge(prev->childs[0]->volume, prev->childs[1]->volume, prev->volume);
if (b3NotEqual(pb, prev->volume))
{
prev = prev->parent;
}
else
break;
}
return (prev ? prev : pdbvt->m_root);
}
else
{
pdbvt->m_root = sibling;
sibling->parent = 0;
b3DeleteNode(pdbvt, parent);
return (pdbvt->m_root);
}
}
}
//
static void b3FetchLeaves(b3DynamicBvh* pdbvt,
b3DbvtNode* root,
b3NodeArray& leaves,
int depth = -1)
{
if (root->isinternal() && depth)
{
b3FetchLeaves(pdbvt, root->childs[0], leaves, depth - 1);
b3FetchLeaves(pdbvt, root->childs[1], leaves, depth - 1);
b3DeleteNode(pdbvt, root);
}
else
{
leaves.push_back(root);
}
}
static bool b3LeftOfAxis(const b3DbvtNode* node,
const b3Vector3& org,
const b3Vector3& axis)
{
return b3Dot(axis, node->volume.Center() - org) <= 0;
}
// Partitions leaves such that leaves[0, n) are on the
// left of axis, and leaves[n, count) are on the right
// of axis. returns N.
static int b3Split(b3DbvtNode** leaves,
int count,
const b3Vector3& org,
const b3Vector3& axis)
{
int begin = 0;
int end = count;
for (;;)
{
while (begin != end && b3LeftOfAxis(leaves[begin], org, axis))
{
++begin;
}
if (begin == end)
{
break;
}
while (begin != end && !b3LeftOfAxis(leaves[end - 1], org, axis))
{
--end;
}
if (begin == end)
{
break;
}
// swap out of place nodes
--end;
b3DbvtNode* temp = leaves[begin];
leaves[begin] = leaves[end];
leaves[end] = temp;
++begin;
}
return begin;
}
//
static b3DbvtVolume b3Bounds(b3DbvtNode** leaves,
int count)
{
#if B3_DBVT_MERGE_IMPL == B3_DBVT_IMPL_SSE
B3_ATTRIBUTE_ALIGNED16(char locals[sizeof(b3DbvtVolume)]);
b3DbvtVolume& volume = *(b3DbvtVolume*)locals;
volume = leaves[0]->volume;
#else
b3DbvtVolume volume = leaves[0]->volume;
#endif
for (int i = 1, ni = count; i < ni; ++i)
{
b3Merge(volume, leaves[i]->volume, volume);
}
return (volume);
}
//
static void b3BottomUp(b3DynamicBvh* pdbvt,
b3DbvtNode** leaves,
int count)
{
while (count > 1)
{
b3Scalar minsize = B3_INFINITY;
int minidx[2] = {-1, -1};
for (int i = 0; i < count; ++i)
{
for (int j = i + 1; j < count; ++j)
{
const b3Scalar sz = b3Size(b3Merge(leaves[i]->volume, leaves[j]->volume));
if (sz < minsize)
{
minsize = sz;
minidx[0] = i;
minidx[1] = j;
}
}
}
b3DbvtNode* n[] = {leaves[minidx[0]], leaves[minidx[1]]};
b3DbvtNode* p = b3CreateNode(pdbvt, 0, n[0]->volume, n[1]->volume, 0);
p->childs[0] = n[0];
p->childs[1] = n[1];
n[0]->parent = p;
n[1]->parent = p;
leaves[minidx[0]] = p;
leaves[minidx[1]] = leaves[count - 1];
--count;
}
}
//
static b3DbvtNode* b3TopDown(b3DynamicBvh* pdbvt,
b3DbvtNode** leaves,
int count,
int bu_treshold)
{
static const b3Vector3 axis[] = {b3MakeVector3(1, 0, 0),
b3MakeVector3(0, 1, 0),
b3MakeVector3(0, 0, 1)};
b3Assert(bu_treshold > 1);
if (count > 1)
{
if (count > bu_treshold)
{
const b3DbvtVolume vol = b3Bounds(leaves, count);
const b3Vector3 org = vol.Center();
int partition;
int bestaxis = -1;
int bestmidp = count;
int splitcount[3][2] = {{0, 0}, {0, 0}, {0, 0}};
int i;
for (i = 0; i < count; ++i)
{
const b3Vector3 x = leaves[i]->volume.Center() - org;
for (int j = 0; j < 3; ++j)
{
++splitcount[j][b3Dot(x, axis[j]) > 0 ? 1 : 0];
}
}
for (i = 0; i < 3; ++i)
{
if ((splitcount[i][0] > 0) && (splitcount[i][1] > 0))
{
const int midp = (int)b3Fabs(b3Scalar(splitcount[i][0] - splitcount[i][1]));
if (midp < bestmidp)
{
bestaxis = i;
bestmidp = midp;
}
}
}
if (bestaxis >= 0)
{
partition = b3Split(leaves, count, org, axis[bestaxis]);
b3Assert(partition != 0 && partition != count);
}
else
{
partition = count / 2 + 1;
}
b3DbvtNode* node = b3CreateNode(pdbvt, 0, vol, 0);
node->childs[0] = b3TopDown(pdbvt, &leaves[0], partition, bu_treshold);
node->childs[1] = b3TopDown(pdbvt, &leaves[partition], count - partition, bu_treshold);
node->childs[0]->parent = node;
node->childs[1]->parent = node;
return (node);
}
else
{
b3BottomUp(pdbvt, leaves, count);
return (leaves[0]);
}
}
return (leaves[0]);
}
//
static B3_DBVT_INLINE b3DbvtNode* b3Sort(b3DbvtNode* n, b3DbvtNode*& r)
{
b3DbvtNode* p = n->parent;
b3Assert(n->isinternal());
if (p > n)
{
const int i = b3IndexOf(n);
const int j = 1 - i;
b3DbvtNode* s = p->childs[j];
b3DbvtNode* q = p->parent;
b3Assert(n == p->childs[i]);
if (q)
q->childs[b3IndexOf(p)] = n;
else
r = n;
s->parent = n;
p->parent = n;
n->parent = q;
p->childs[0] = n->childs[0];
p->childs[1] = n->childs[1];
n->childs[0]->parent = p;
n->childs[1]->parent = p;
n->childs[i] = p;
n->childs[j] = s;
b3Swap(p->volume, n->volume);
return (p);
}
return (n);
}
#if 0
static B3_DBVT_INLINE b3DbvtNode* walkup(b3DbvtNode* n,int count)
{
while(n&&(count--)) n=n->parent;
return(n);
}
#endif
//
// Api
//
//
b3DynamicBvh::b3DynamicBvh()
{
m_root = 0;
m_free = 0;
m_lkhd = -1;
m_leaves = 0;
m_opath = 0;
}
//
b3DynamicBvh::~b3DynamicBvh()
{
clear();
}
//
void b3DynamicBvh::clear()
{
if (m_root)
b3RecurseDeleteNode(this, m_root);
b3AlignedFree(m_free);
m_free = 0;
m_lkhd = -1;
m_stkStack.clear();
m_opath = 0;
}
//
void b3DynamicBvh::optimizeBottomUp()
{
if (m_root)
{
b3NodeArray leaves;
leaves.reserve(m_leaves);
b3FetchLeaves(this, m_root, leaves);
b3BottomUp(this, &leaves[0], leaves.size());
m_root = leaves[0];
}
}
//
void b3DynamicBvh::optimizeTopDown(int bu_treshold)
{
if (m_root)
{
b3NodeArray leaves;
leaves.reserve(m_leaves);
b3FetchLeaves(this, m_root, leaves);
m_root = b3TopDown(this, &leaves[0], leaves.size(), bu_treshold);
}
}
//
void b3DynamicBvh::optimizeIncremental(int passes)
{
if (passes < 0) passes = m_leaves;
if (m_root && (passes > 0))
{
do
{
b3DbvtNode* node = m_root;
unsigned bit = 0;
while (node->isinternal())
{
node = b3Sort(node, m_root)->childs[(m_opath >> bit) & 1];
bit = (bit + 1) & (sizeof(unsigned) * 8 - 1);
}
update(node);
++m_opath;
} while (--passes);
}
}
//
b3DbvtNode* b3DynamicBvh::insert(const b3DbvtVolume& volume, void* data)
{
b3DbvtNode* leaf = b3CreateNode(this, 0, volume, data);
b3InsertLeaf(this, m_root, leaf);
++m_leaves;
return (leaf);
}
//
void b3DynamicBvh::update(b3DbvtNode* leaf, int lookahead)
{
b3DbvtNode* root = b3RemoveLeaf(this, leaf);
if (root)
{
if (lookahead >= 0)
{
for (int i = 0; (i < lookahead) && root->parent; ++i)
{
root = root->parent;
}
}
else
root = m_root;
}
b3InsertLeaf(this, root, leaf);
}
//
void b3DynamicBvh::update(b3DbvtNode* leaf, b3DbvtVolume& volume)
{
b3DbvtNode* root = b3RemoveLeaf(this, leaf);
if (root)
{
if (m_lkhd >= 0)
{
for (int i = 0; (i < m_lkhd) && root->parent; ++i)
{
root = root->parent;
}
}
else
root = m_root;
}
leaf->volume = volume;
b3InsertLeaf(this, root, leaf);
}
//
bool b3DynamicBvh::update(b3DbvtNode* leaf, b3DbvtVolume& volume, const b3Vector3& velocity, b3Scalar margin)
{
if (leaf->volume.Contain(volume)) return (false);
volume.Expand(b3MakeVector3(margin, margin, margin));
volume.SignedExpand(velocity);
update(leaf, volume);
return (true);
}
//
bool b3DynamicBvh::update(b3DbvtNode* leaf, b3DbvtVolume& volume, const b3Vector3& velocity)
{
if (leaf->volume.Contain(volume)) return (false);
volume.SignedExpand(velocity);
update(leaf, volume);
return (true);
}
//
bool b3DynamicBvh::update(b3DbvtNode* leaf, b3DbvtVolume& volume, b3Scalar margin)
{
if (leaf->volume.Contain(volume)) return (false);
volume.Expand(b3MakeVector3(margin, margin, margin));
update(leaf, volume);
return (true);
}
//
void b3DynamicBvh::remove(b3DbvtNode* leaf)
{
b3RemoveLeaf(this, leaf);
b3DeleteNode(this, leaf);
--m_leaves;
}
//
void b3DynamicBvh::write(IWriter* iwriter) const
{
b3DbvtNodeEnumerator nodes;
nodes.nodes.reserve(m_leaves * 2);
enumNodes(m_root, nodes);
iwriter->Prepare(m_root, nodes.nodes.size());
for (int i = 0; i < nodes.nodes.size(); ++i)
{
const b3DbvtNode* n = nodes.nodes[i];
int p = -1;
if (n->parent) p = nodes.nodes.findLinearSearch(n->parent);
if (n->isinternal())
{
const int c0 = nodes.nodes.findLinearSearch(n->childs[0]);
const int c1 = nodes.nodes.findLinearSearch(n->childs[1]);
iwriter->WriteNode(n, i, p, c0, c1);
}
else
{
iwriter->WriteLeaf(n, i, p);
}
}
}
//
void b3DynamicBvh::clone(b3DynamicBvh& dest, IClone* iclone) const
{
dest.clear();
if (m_root != 0)
{
b3AlignedObjectArray<sStkCLN> stack;
stack.reserve(m_leaves);
stack.push_back(sStkCLN(m_root, 0));
do
{
const int i = stack.size() - 1;
const sStkCLN e = stack[i];
b3DbvtNode* n = b3CreateNode(&dest, e.parent, e.node->volume, e.node->data);
stack.pop_back();
if (e.parent != 0)
e.parent->childs[i & 1] = n;
else
dest.m_root = n;
if (e.node->isinternal())
{
stack.push_back(sStkCLN(e.node->childs[0], n));
stack.push_back(sStkCLN(e.node->childs[1], n));
}
else
{
iclone->CloneLeaf(n);
}
} while (stack.size() > 0);
}
}
//
int b3DynamicBvh::maxdepth(const b3DbvtNode* node)
{
int depth = 0;
if (node) b3GetMaxDepth(node, 1, depth);
return (depth);
}
//
int b3DynamicBvh::countLeaves(const b3DbvtNode* node)
{
if (node->isinternal())
return (countLeaves(node->childs[0]) + countLeaves(node->childs[1]));
else
return (1);
}
//
void b3DynamicBvh::extractLeaves(const b3DbvtNode* node, b3AlignedObjectArray<const b3DbvtNode*>& leaves)
{
if (node->isinternal())
{
extractLeaves(node->childs[0], leaves);
extractLeaves(node->childs[1], leaves);
}
else
{
leaves.push_back(node);
}
}
//
#if B3_DBVT_ENABLE_BENCHMARK
#include <stdio.h>
#include <stdlib.h>
/*
q6600,2.4ghz
/Ox /Ob2 /Oi /Ot /I "." /I "..\.." /I "..\..\src" /D "NDEBUG" /D "_LIB" /D "_WINDOWS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_CRT_NONSTDC_NO_DEPRECATE" /D "WIN32"
/GF /FD /MT /GS- /Gy /arch:SSE2 /Zc:wchar_t- /Fp"..\..\out\release8\build\libbulletcollision\libbulletcollision.pch"
/Fo"..\..\out\release8\build\libbulletcollision\\"
/Fd"..\..\out\release8\build\libbulletcollision\bulletcollision.pdb"
/W3 /nologo /c /Wp64 /Zi /errorReport:prompt
Benchmarking dbvt...
World scale: 100.000000
Extents base: 1.000000
Extents range: 4.000000
Leaves: 8192
sizeof(b3DbvtVolume): 32 bytes
sizeof(b3DbvtNode): 44 bytes
[1] b3DbvtVolume intersections: 3499 ms (-1%)
[2] b3DbvtVolume merges: 1934 ms (0%)
[3] b3DynamicBvh::collideTT: 5485 ms (-21%)
[4] b3DynamicBvh::collideTT self: 2814 ms (-20%)
[5] b3DynamicBvh::collideTT xform: 7379 ms (-1%)
[6] b3DynamicBvh::collideTT xform,self: 7270 ms (-2%)
[7] b3DynamicBvh::rayTest: 6314 ms (0%),(332143 r/s)
[8] insert/remove: 2093 ms (0%),(1001983 ir/s)
[9] updates (teleport): 1879 ms (-3%),(1116100 u/s)
[10] updates (jitter): 1244 ms (-4%),(1685813 u/s)
[11] optimize (incremental): 2514 ms (0%),(1668000 o/s)
[12] b3DbvtVolume notequal: 3659 ms (0%)
[13] culling(OCL+fullsort): 2218 ms (0%),(461 t/s)
[14] culling(OCL+qsort): 3688 ms (5%),(2221 t/s)
[15] culling(KDOP+qsort): 1139 ms (-1%),(7192 t/s)
[16] insert/remove batch(256): 5092 ms (0%),(823704 bir/s)
[17] b3DbvtVolume select: 3419 ms (0%)
*/
struct b3DbvtBenchmark
{
struct NilPolicy : b3DynamicBvh::ICollide
{
NilPolicy() : m_pcount(0), m_depth(-B3_INFINITY), m_checksort(true) {}
void Process(const b3DbvtNode*, const b3DbvtNode*) { ++m_pcount; }
void Process(const b3DbvtNode*) { ++m_pcount; }
void Process(const b3DbvtNode*, b3Scalar depth)
{
++m_pcount;
if (m_checksort)
{
if (depth >= m_depth)
m_depth = depth;
else
printf("wrong depth: %f (should be >= %f)\r\n", depth, m_depth);
}
}
int m_pcount;
b3Scalar m_depth;
bool m_checksort;
};
struct P14 : b3DynamicBvh::ICollide
{
struct Node
{
const b3DbvtNode* leaf;
b3Scalar depth;
};
void Process(const b3DbvtNode* leaf, b3Scalar depth)
{
Node n;
n.leaf = leaf;
n.depth = depth;
}
static int sortfnc(const Node& a, const Node& b)
{
if (a.depth < b.depth) return (+1);
if (a.depth > b.depth) return (-1);
return (0);
}
b3AlignedObjectArray<Node> m_nodes;
};
struct P15 : b3DynamicBvh::ICollide
{
struct Node
{
const b3DbvtNode* leaf;
b3Scalar depth;
};
void Process(const b3DbvtNode* leaf)
{
Node n;
n.leaf = leaf;
n.depth = dot(leaf->volume.Center(), m_axis);
}
static int sortfnc(const Node& a, const Node& b)
{
if (a.depth < b.depth) return (+1);
if (a.depth > b.depth) return (-1);
return (0);
}
b3AlignedObjectArray<Node> m_nodes;
b3Vector3 m_axis;
};
static b3Scalar RandUnit()
{
return (rand() / (b3Scalar)RAND_MAX);
}
static b3Vector3 RandVector3()
{
return (b3Vector3(RandUnit(), RandUnit(), RandUnit()));
}
static b3Vector3 RandVector3(b3Scalar cs)
{
return (RandVector3() * cs - b3Vector3(cs, cs, cs) / 2);
}
static b3DbvtVolume RandVolume(b3Scalar cs, b3Scalar eb, b3Scalar es)
{
return (b3DbvtVolume::FromCE(RandVector3(cs), b3Vector3(eb, eb, eb) + RandVector3() * es));
}
static b3Transform RandTransform(b3Scalar cs)
{
b3Transform t;
t.setOrigin(RandVector3(cs));
t.setRotation(b3Quaternion(RandUnit() * B3_PI * 2, RandUnit() * B3_PI * 2, RandUnit() * B3_PI * 2).normalized());
return (t);
}
static void RandTree(b3Scalar cs, b3Scalar eb, b3Scalar es, int leaves, b3DynamicBvh& dbvt)
{
dbvt.clear();
for (int i = 0; i < leaves; ++i)
{
dbvt.insert(RandVolume(cs, eb, es), 0);
}
}
};
void b3DynamicBvh::benchmark()
{
static const b3Scalar cfgVolumeCenterScale = 100;
static const b3Scalar cfgVolumeExentsBase = 1;
static const b3Scalar cfgVolumeExentsScale = 4;
static const int cfgLeaves = 8192;
static const bool cfgEnable = true;
//[1] b3DbvtVolume intersections
bool cfgBenchmark1_Enable = cfgEnable;
static const int cfgBenchmark1_Iterations = 8;
static const int cfgBenchmark1_Reference = 3499;
//[2] b3DbvtVolume merges
bool cfgBenchmark2_Enable = cfgEnable;
static const int cfgBenchmark2_Iterations = 4;
static const int cfgBenchmark2_Reference = 1945;
//[3] b3DynamicBvh::collideTT
bool cfgBenchmark3_Enable = cfgEnable;
static const int cfgBenchmark3_Iterations = 512;
static const int cfgBenchmark3_Reference = 5485;
//[4] b3DynamicBvh::collideTT self
bool cfgBenchmark4_Enable = cfgEnable;
static const int cfgBenchmark4_Iterations = 512;
static const int cfgBenchmark4_Reference = 2814;
//[5] b3DynamicBvh::collideTT xform
bool cfgBenchmark5_Enable = cfgEnable;
static const int cfgBenchmark5_Iterations = 512;
static const b3Scalar cfgBenchmark5_OffsetScale = 2;
static const int cfgBenchmark5_Reference = 7379;
//[6] b3DynamicBvh::collideTT xform,self
bool cfgBenchmark6_Enable = cfgEnable;
static const int cfgBenchmark6_Iterations = 512;
static const b3Scalar cfgBenchmark6_OffsetScale = 2;
static const int cfgBenchmark6_Reference = 7270;
//[7] b3DynamicBvh::rayTest
bool cfgBenchmark7_Enable = cfgEnable;
static const int cfgBenchmark7_Passes = 32;
static const int cfgBenchmark7_Iterations = 65536;
static const int cfgBenchmark7_Reference = 6307;
//[8] insert/remove
bool cfgBenchmark8_Enable = cfgEnable;
static const int cfgBenchmark8_Passes = 32;
static const int cfgBenchmark8_Iterations = 65536;
static const int cfgBenchmark8_Reference = 2105;
//[9] updates (teleport)
bool cfgBenchmark9_Enable = cfgEnable;
static const int cfgBenchmark9_Passes = 32;
static const int cfgBenchmark9_Iterations = 65536;
static const int cfgBenchmark9_Reference = 1879;
//[10] updates (jitter)
bool cfgBenchmark10_Enable = cfgEnable;
static const b3Scalar cfgBenchmark10_Scale = cfgVolumeCenterScale / 10000;
static const int cfgBenchmark10_Passes = 32;
static const int cfgBenchmark10_Iterations = 65536;
static const int cfgBenchmark10_Reference = 1244;
//[11] optimize (incremental)
bool cfgBenchmark11_Enable = cfgEnable;
static const int cfgBenchmark11_Passes = 64;
static const int cfgBenchmark11_Iterations = 65536;
static const int cfgBenchmark11_Reference = 2510;
//[12] b3DbvtVolume notequal
bool cfgBenchmark12_Enable = cfgEnable;
static const int cfgBenchmark12_Iterations = 32;
static const int cfgBenchmark12_Reference = 3677;
//[13] culling(OCL+fullsort)
bool cfgBenchmark13_Enable = cfgEnable;
static const int cfgBenchmark13_Iterations = 1024;
static const int cfgBenchmark13_Reference = 2231;
//[14] culling(OCL+qsort)
bool cfgBenchmark14_Enable = cfgEnable;
static const int cfgBenchmark14_Iterations = 8192;
static const int cfgBenchmark14_Reference = 3500;
//[15] culling(KDOP+qsort)
bool cfgBenchmark15_Enable = cfgEnable;
static const int cfgBenchmark15_Iterations = 8192;
static const int cfgBenchmark15_Reference = 1151;
//[16] insert/remove batch
bool cfgBenchmark16_Enable = cfgEnable;
static const int cfgBenchmark16_BatchCount = 256;
static const int cfgBenchmark16_Passes = 16384;
static const int cfgBenchmark16_Reference = 5138;
//[17] select
bool cfgBenchmark17_Enable = cfgEnable;
static const int cfgBenchmark17_Iterations = 4;
static const int cfgBenchmark17_Reference = 3390;
b3Clock wallclock;
printf("Benchmarking dbvt...\r\n");
printf("\tWorld scale: %f\r\n", cfgVolumeCenterScale);
printf("\tExtents base: %f\r\n", cfgVolumeExentsBase);
printf("\tExtents range: %f\r\n", cfgVolumeExentsScale);
printf("\tLeaves: %u\r\n", cfgLeaves);
printf("\tsizeof(b3DbvtVolume): %u bytes\r\n", sizeof(b3DbvtVolume));
printf("\tsizeof(b3DbvtNode): %u bytes\r\n", sizeof(b3DbvtNode));
if (cfgBenchmark1_Enable)
{ // Benchmark 1
srand(380843);
b3AlignedObjectArray<b3DbvtVolume> volumes;
b3AlignedObjectArray<bool> results;
volumes.resize(cfgLeaves);
results.resize(cfgLeaves);
for (int i = 0; i < cfgLeaves; ++i)
{
volumes[i] = b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale);
}
printf("[1] b3DbvtVolume intersections: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark1_Iterations; ++i)
{
for (int j = 0; j < cfgLeaves; ++j)
{
for (int k = 0; k < cfgLeaves; ++k)
{
results[k] = Intersect(volumes[j], volumes[k]);
}
}
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark1_Reference) * 100 / time);
}
if (cfgBenchmark2_Enable)
{ // Benchmark 2
srand(380843);
b3AlignedObjectArray<b3DbvtVolume> volumes;
b3AlignedObjectArray<b3DbvtVolume> results;
volumes.resize(cfgLeaves);
results.resize(cfgLeaves);
for (int i = 0; i < cfgLeaves; ++i)
{
volumes[i] = b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale);
}
printf("[2] b3DbvtVolume merges: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark2_Iterations; ++i)
{
for (int j = 0; j < cfgLeaves; ++j)
{
for (int k = 0; k < cfgLeaves; ++k)
{
Merge(volumes[j], volumes[k], results[k]);
}
}
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark2_Reference) * 100 / time);
}
if (cfgBenchmark3_Enable)
{ // Benchmark 3
srand(380843);
b3DynamicBvh dbvt[2];
b3DbvtBenchmark::NilPolicy policy;
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt[0]);
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt[1]);
dbvt[0].optimizeTopDown();
dbvt[1].optimizeTopDown();
printf("[3] b3DynamicBvh::collideTT: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark3_Iterations; ++i)
{
b3DynamicBvh::collideTT(dbvt[0].m_root, dbvt[1].m_root, policy);
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark3_Reference) * 100 / time);
}
if (cfgBenchmark4_Enable)
{ // Benchmark 4
srand(380843);
b3DynamicBvh dbvt;
b3DbvtBenchmark::NilPolicy policy;
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
printf("[4] b3DynamicBvh::collideTT self: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark4_Iterations; ++i)
{
b3DynamicBvh::collideTT(dbvt.m_root, dbvt.m_root, policy);
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark4_Reference) * 100 / time);
}
if (cfgBenchmark5_Enable)
{ // Benchmark 5
srand(380843);
b3DynamicBvh dbvt[2];
b3AlignedObjectArray<b3Transform> transforms;
b3DbvtBenchmark::NilPolicy policy;
transforms.resize(cfgBenchmark5_Iterations);
for (int i = 0; i < transforms.size(); ++i)
{
transforms[i] = b3DbvtBenchmark::RandTransform(cfgVolumeCenterScale * cfgBenchmark5_OffsetScale);
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt[0]);
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt[1]);
dbvt[0].optimizeTopDown();
dbvt[1].optimizeTopDown();
printf("[5] b3DynamicBvh::collideTT xform: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark5_Iterations; ++i)
{
b3DynamicBvh::collideTT(dbvt[0].m_root, dbvt[1].m_root, transforms[i], policy);
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark5_Reference) * 100 / time);
}
if (cfgBenchmark6_Enable)
{ // Benchmark 6
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<b3Transform> transforms;
b3DbvtBenchmark::NilPolicy policy;
transforms.resize(cfgBenchmark6_Iterations);
for (int i = 0; i < transforms.size(); ++i)
{
transforms[i] = b3DbvtBenchmark::RandTransform(cfgVolumeCenterScale * cfgBenchmark6_OffsetScale);
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
printf("[6] b3DynamicBvh::collideTT xform,self: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark6_Iterations; ++i)
{
b3DynamicBvh::collideTT(dbvt.m_root, dbvt.m_root, transforms[i], policy);
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark6_Reference) * 100 / time);
}
if (cfgBenchmark7_Enable)
{ // Benchmark 7
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<b3Vector3> rayorg;
b3AlignedObjectArray<b3Vector3> raydir;
b3DbvtBenchmark::NilPolicy policy;
rayorg.resize(cfgBenchmark7_Iterations);
raydir.resize(cfgBenchmark7_Iterations);
for (int i = 0; i < rayorg.size(); ++i)
{
rayorg[i] = b3DbvtBenchmark::RandVector3(cfgVolumeCenterScale * 2);
raydir[i] = b3DbvtBenchmark::RandVector3(cfgVolumeCenterScale * 2);
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
printf("[7] b3DynamicBvh::rayTest: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark7_Passes; ++i)
{
for (int j = 0; j < cfgBenchmark7_Iterations; ++j)
{
b3DynamicBvh::rayTest(dbvt.m_root, rayorg[j], rayorg[j] + raydir[j], policy);
}
}
const int time = (int)wallclock.getTimeMilliseconds();
unsigned rays = cfgBenchmark7_Passes * cfgBenchmark7_Iterations;
printf("%u ms (%i%%),(%u r/s)\r\n", time, (time - cfgBenchmark7_Reference) * 100 / time, (rays * 1000) / time);
}
if (cfgBenchmark8_Enable)
{ // Benchmark 8
srand(380843);
b3DynamicBvh dbvt;
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
printf("[8] insert/remove: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark8_Passes; ++i)
{
for (int j = 0; j < cfgBenchmark8_Iterations; ++j)
{
dbvt.remove(dbvt.insert(b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale), 0));
}
}
const int time = (int)wallclock.getTimeMilliseconds();
const int ir = cfgBenchmark8_Passes * cfgBenchmark8_Iterations;
printf("%u ms (%i%%),(%u ir/s)\r\n", time, (time - cfgBenchmark8_Reference) * 100 / time, ir * 1000 / time);
}
if (cfgBenchmark9_Enable)
{ // Benchmark 9
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<const b3DbvtNode*> leaves;
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
dbvt.extractLeaves(dbvt.m_root, leaves);
printf("[9] updates (teleport): ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark9_Passes; ++i)
{
for (int j = 0; j < cfgBenchmark9_Iterations; ++j)
{
dbvt.update(const_cast<b3DbvtNode*>(leaves[rand() % cfgLeaves]),
b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale));
}
}
const int time = (int)wallclock.getTimeMilliseconds();
const int up = cfgBenchmark9_Passes * cfgBenchmark9_Iterations;
printf("%u ms (%i%%),(%u u/s)\r\n", time, (time - cfgBenchmark9_Reference) * 100 / time, up * 1000 / time);
}
if (cfgBenchmark10_Enable)
{ // Benchmark 10
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<const b3DbvtNode*> leaves;
b3AlignedObjectArray<b3Vector3> vectors;
vectors.resize(cfgBenchmark10_Iterations);
for (int i = 0; i < vectors.size(); ++i)
{
vectors[i] = (b3DbvtBenchmark::RandVector3() * 2 - b3Vector3(1, 1, 1)) * cfgBenchmark10_Scale;
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
dbvt.extractLeaves(dbvt.m_root, leaves);
printf("[10] updates (jitter): ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark10_Passes; ++i)
{
for (int j = 0; j < cfgBenchmark10_Iterations; ++j)
{
const b3Vector3& d = vectors[j];
b3DbvtNode* l = const_cast<b3DbvtNode*>(leaves[rand() % cfgLeaves]);
b3DbvtVolume v = b3DbvtVolume::FromMM(l->volume.Mins() + d, l->volume.Maxs() + d);
dbvt.update(l, v);
}
}
const int time = (int)wallclock.getTimeMilliseconds();
const int up = cfgBenchmark10_Passes * cfgBenchmark10_Iterations;
printf("%u ms (%i%%),(%u u/s)\r\n", time, (time - cfgBenchmark10_Reference) * 100 / time, up * 1000 / time);
}
if (cfgBenchmark11_Enable)
{ // Benchmark 11
srand(380843);
b3DynamicBvh dbvt;
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
printf("[11] optimize (incremental): ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark11_Passes; ++i)
{
dbvt.optimizeIncremental(cfgBenchmark11_Iterations);
}
const int time = (int)wallclock.getTimeMilliseconds();
const int op = cfgBenchmark11_Passes * cfgBenchmark11_Iterations;
printf("%u ms (%i%%),(%u o/s)\r\n", time, (time - cfgBenchmark11_Reference) * 100 / time, op / time * 1000);
}
if (cfgBenchmark12_Enable)
{ // Benchmark 12
srand(380843);
b3AlignedObjectArray<b3DbvtVolume> volumes;
b3AlignedObjectArray<bool> results;
volumes.resize(cfgLeaves);
results.resize(cfgLeaves);
for (int i = 0; i < cfgLeaves; ++i)
{
volumes[i] = b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale);
}
printf("[12] b3DbvtVolume notequal: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark12_Iterations; ++i)
{
for (int j = 0; j < cfgLeaves; ++j)
{
for (int k = 0; k < cfgLeaves; ++k)
{
results[k] = NotEqual(volumes[j], volumes[k]);
}
}
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark12_Reference) * 100 / time);
}
if (cfgBenchmark13_Enable)
{ // Benchmark 13
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<b3Vector3> vectors;
b3DbvtBenchmark::NilPolicy policy;
vectors.resize(cfgBenchmark13_Iterations);
for (int i = 0; i < vectors.size(); ++i)
{
vectors[i] = (b3DbvtBenchmark::RandVector3() * 2 - b3Vector3(1, 1, 1)).normalized();
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
printf("[13] culling(OCL+fullsort): ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark13_Iterations; ++i)
{
static const b3Scalar offset = 0;
policy.m_depth = -B3_INFINITY;
dbvt.collideOCL(dbvt.m_root, &vectors[i], &offset, vectors[i], 1, policy);
}
const int time = (int)wallclock.getTimeMilliseconds();
const int t = cfgBenchmark13_Iterations;
printf("%u ms (%i%%),(%u t/s)\r\n", time, (time - cfgBenchmark13_Reference) * 100 / time, (t * 1000) / time);
}
if (cfgBenchmark14_Enable)
{ // Benchmark 14
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<b3Vector3> vectors;
b3DbvtBenchmark::P14 policy;
vectors.resize(cfgBenchmark14_Iterations);
for (int i = 0; i < vectors.size(); ++i)
{
vectors[i] = (b3DbvtBenchmark::RandVector3() * 2 - b3Vector3(1, 1, 1)).normalized();
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
policy.m_nodes.reserve(cfgLeaves);
printf("[14] culling(OCL+qsort): ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark14_Iterations; ++i)
{
static const b3Scalar offset = 0;
policy.m_nodes.resize(0);
dbvt.collideOCL(dbvt.m_root, &vectors[i], &offset, vectors[i], 1, policy, false);
policy.m_nodes.quickSort(b3DbvtBenchmark::P14::sortfnc);
}
const int time = (int)wallclock.getTimeMilliseconds();
const int t = cfgBenchmark14_Iterations;
printf("%u ms (%i%%),(%u t/s)\r\n", time, (time - cfgBenchmark14_Reference) * 100 / time, (t * 1000) / time);
}
if (cfgBenchmark15_Enable)
{ // Benchmark 15
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<b3Vector3> vectors;
b3DbvtBenchmark::P15 policy;
vectors.resize(cfgBenchmark15_Iterations);
for (int i = 0; i < vectors.size(); ++i)
{
vectors[i] = (b3DbvtBenchmark::RandVector3() * 2 - b3Vector3(1, 1, 1)).normalized();
}
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
policy.m_nodes.reserve(cfgLeaves);
printf("[15] culling(KDOP+qsort): ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark15_Iterations; ++i)
{
static const b3Scalar offset = 0;
policy.m_nodes.resize(0);
policy.m_axis = vectors[i];
dbvt.collideKDOP(dbvt.m_root, &vectors[i], &offset, 1, policy);
policy.m_nodes.quickSort(b3DbvtBenchmark::P15::sortfnc);
}
const int time = (int)wallclock.getTimeMilliseconds();
const int t = cfgBenchmark15_Iterations;
printf("%u ms (%i%%),(%u t/s)\r\n", time, (time - cfgBenchmark15_Reference) * 100 / time, (t * 1000) / time);
}
if (cfgBenchmark16_Enable)
{ // Benchmark 16
srand(380843);
b3DynamicBvh dbvt;
b3AlignedObjectArray<b3DbvtNode*> batch;
b3DbvtBenchmark::RandTree(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale, cfgLeaves, dbvt);
dbvt.optimizeTopDown();
batch.reserve(cfgBenchmark16_BatchCount);
printf("[16] insert/remove batch(%u): ", cfgBenchmark16_BatchCount);
wallclock.reset();
for (int i = 0; i < cfgBenchmark16_Passes; ++i)
{
for (int j = 0; j < cfgBenchmark16_BatchCount; ++j)
{
batch.push_back(dbvt.insert(b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale), 0));
}
for (int j = 0; j < cfgBenchmark16_BatchCount; ++j)
{
dbvt.remove(batch[j]);
}
batch.resize(0);
}
const int time = (int)wallclock.getTimeMilliseconds();
const int ir = cfgBenchmark16_Passes * cfgBenchmark16_BatchCount;
printf("%u ms (%i%%),(%u bir/s)\r\n", time, (time - cfgBenchmark16_Reference) * 100 / time, int(ir * 1000.0 / time));
}
if (cfgBenchmark17_Enable)
{ // Benchmark 17
srand(380843);
b3AlignedObjectArray<b3DbvtVolume> volumes;
b3AlignedObjectArray<int> results;
b3AlignedObjectArray<int> indices;
volumes.resize(cfgLeaves);
results.resize(cfgLeaves);
indices.resize(cfgLeaves);
for (int i = 0; i < cfgLeaves; ++i)
{
indices[i] = i;
volumes[i] = b3DbvtBenchmark::RandVolume(cfgVolumeCenterScale, cfgVolumeExentsBase, cfgVolumeExentsScale);
}
for (int i = 0; i < cfgLeaves; ++i)
{
b3Swap(indices[i], indices[rand() % cfgLeaves]);
}
printf("[17] b3DbvtVolume select: ");
wallclock.reset();
for (int i = 0; i < cfgBenchmark17_Iterations; ++i)
{
for (int j = 0; j < cfgLeaves; ++j)
{
for (int k = 0; k < cfgLeaves; ++k)
{
const int idx = indices[k];
results[idx] = Select(volumes[idx], volumes[j], volumes[k]);
}
}
}
const int time = (int)wallclock.getTimeMilliseconds();
printf("%u ms (%i%%)\r\n", time, (time - cfgBenchmark17_Reference) * 100 / time);
}
printf("\r\n\r\n");
}
#endif
| {
"pile_set_name": "Github"
} |
<template>
<div class="error404">
<div class="error404-body-con">
<div class="error404-body-con-title">4<span>0</span>4</div>
<p class="error404-body-con-message">YOU LOOK LOST</p>
<div class="error404-btn-con">
<a href="/" class="error404-home-button">返回首页</a>
<div class="error404-block-button" @click="backPage">返回上一页</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "Error404",
methods: {
backPage() {
this.$router.go(-1);
}
}
};
</script>
<style type="text/scss" lang="scss">
@keyframes error404animation {
0% {
transform: rotateZ(0deg);
}
20% {
transform: rotateZ(-60deg);
}
40% {
transform: rotateZ(-10deg);
}
60% {
transform: rotateZ(50deg);
}
80% {
transform: rotateZ(-20deg);
}
100% {
transform: rotateZ(0deg);
}
}
.error404 {
&-body-con {
width: 700px;
height: 500px;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
&-title {
text-align: center;
font-size: 240px;
font-weight: 700;
color: #2d8cf0;
height: 260px;
line-height: 260px;
margin-top: 40px;
span {
display: inline-block;
color: #19be6b;
font-size: 230px;
animation: error404animation 3s ease 0s infinite alternate;
}
}
&-message {
display: block;
text-align: center;
font-size: 30px;
font-weight: 500;
letter-spacing: 12px;
color: #dddde2;
}
}
&-btn-con {
text-align: center;
padding: 20px 0;
margin-bottom: 40px;
}
&-home-button {
width: 200px;
border-color: transparent;
padding: 6px 15px 7px;
font-size: 14px;
border-radius: 4px;
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background: transparent none;
white-space: nowrap;
line-height: 1.5;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: color 0.2s linear, background-color 0.2s linear;
color: #495060;
}
&-home-button:hover {
text-decoration: none;
color: #57a3f3;
}
&-block-button {
width: 200px;
margin-left: 40px;
color: #fff;
border-color: #2d8cf0;
padding: 6px 15px 7px;
font-size: 14px;
border-radius: 4px;
display: inline-block;
margin-bottom: 0;
font-weight: 400;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background: #2d8cf0 none;
border-bottom-color: transparent;
white-space: nowrap;
line-height: 1.5;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
transition: color 0.2s linear, background-color 0.2s linear;
}
&-block-button:hover {
color: #fff;
background-color: #57a3f3;
border-color: #57a3f3;
}
}
</style>
| {
"pile_set_name": "Github"
} |
Bootstrap uses [GitHub's Releases feature](https://github.com/blog/1547-release-your-software) for its changelogs.
See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap.
Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release.
| {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.search;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Set;
/**
* This class implements the {@link Set} interface, backed by an
* {@link ArrayList}.
* <p>The {@link ArrayList} supports :
* <ul>
* <li>the reordering of elements after adding each new element (see {@link
* #ordering(boolean)}). The elements are reordered using their {@linkplain
* Comparable natural ordering}. Reordering of elements is disabled by
* default.</li>
* <li>the avoiding to add {@code null} elements (see {@link
* #nullIsAllowed(boolean)}). A {@code null} element can be added by
* default.</li>
* <li>the disabling of adding more elements than it is specified at creation
* time. (see {@link ArraySet#ArraySet(int)})</li>
* </ul>
*
* <p><b>Example:</b>
* <pre>{@code
* List<Object> objects = new ArraySet<Object>(LIMIT).
* ordering(true).
* nullIsAllowed(false);
* }</pre>
*
* @author Victor G. Vasilyev <[email protected]>
*/
public class ArraySet<E extends Comparable<E>>
extends ArrayList<E> implements Set<E> {
private int limit;
private boolean isSorted;
private boolean isNullAllowed;
/**
* Creates new {@code ArraySet}.
* @param limit max number of elements that can be added to this
* {@code ArraySet}. <b>Note:</b> <i>If reordering of elements is
* switched on then you should avoid using a big limit due to
* performance problems.</i> Seems 500 elements with a quick
* {@link Comparable#compareTo(java.lang.Object)} method
* implementation is OK.
*/
public ArraySet(int limit) {
this.limit = limit;
}
/**
* {@inheritDoc}
* @throws IllegalStateException if {@link #size()} {@code >= limit}.
* @throws IllegalArgumentException if {@code null} element is not allowed
* and a specified element {@code e} is {@code null}.
*/
@Override
public boolean add(E e) throws IllegalStateException,
IllegalArgumentException {
if(!isNullAllowed && e == null) {
throw new IllegalArgumentException();
}
if(size() >= limit) {
throw new IllegalStateException();
}
if (contains(e)) {
throw new IllegalArgumentException();
}
if(super.add(e)) {
if(isSorted) {
Collections.sort(this);
}
return true;
}
return false;
}
/**
* Sets mode of ordering.
* @param doOrdering if {@code true} - ordering of elements will be allowed,
* and it will be performed during the next call of the
* {@link #add(java.lang.Object) add} method, otherwise, if {@code
* false} - ordering will be disabled.
* @return this {@code ArraySet}.
*/
public ArraySet<E> ordering(boolean doOrdering) {
this.isSorted = doOrdering;
return this;
}
/**
* Sets mode of adding the {@code null} element.
* @param isNullAllowed if {@code true} - adding the {@code null} element
* will be allowed, otherwise, if {@code false} - adding will be
* disabled.
* @return this {@code ArraySet}.
*/
public ArraySet<E> nullIsAllowed(boolean isNullAllowed) {
this.isNullAllowed = isNullAllowed;
return this;
}
}
| {
"pile_set_name": "Github"
} |
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
// ==========================================================================
// Print styles.
// Inlined to avoid the additional HTTP request: h5bp.com/r
// ==========================================================================
@media print {
*,
*:before,
*:after {
background: transparent !important;
color: #000 !important; // Black prints faster: h5bp.com/s
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
// Don't show links that are fragment identifiers,
// or use the `javascript:` pseudo protocol
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group; // h5bp.com/t
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
// Bootstrap specific changes start
//
// Chrome (OSX) fix for https://github.com/twbs/bootstrap/issues/11245
// Once fixed, we can just straight up remove this.
select {
background: #fff !important;
}
// Bootstrap components
.navbar {
display: none;
}
.btn,
.dropup > .btn {
> .caret {
border-top-color: #000 !important;
}
}
.label {
border: 1px solid #000;
}
.table {
border-collapse: collapse !important;
td,
th {
background-color: #fff !important;
}
}
.table-bordered {
th,
td {
border: 1px solid #ddd !important;
}
}
// Bootstrap specific changes end
}
| {
"pile_set_name": "Github"
} |
// src/script/scala/progscala3/typesystem/valuetypes/InfixTypes.scala
val xll1: Int Either Double Either String = Left(Left(1))
val xll2: (Int Either Double) Either String = Left(Left(1))
val xlr1: Int Either Double Either String = Left(Right(3.14))
val xlr2: (Int Either Double) Either String = Left(Right(3.14))
val xr1: Int Either Double Either String = Right("foo")
val xr2: (Int Either Double) Either String = Right("foo")
val xl: Int Either (Double Either String) = Left(1)
val xrl: Int Either (Double Either String) = Right(Left(3.14))
val xrr: Int Either (Double Either String) = Right(Right("bar"))
| {
"pile_set_name": "Github"
} |
import * as React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M20 6h-3V4c0-1.11-.89-2-2-2H9c-1.11 0-2 .89-2 2v2H4c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zM9 4h6v2H9V4zm11 15H4v-2h16v2zm0-5H4V8h3v2h2V8h6v2h2V8h3v6z" />
, 'CardTravelOutlined');
| {
"pile_set_name": "Github"
} |
#@deprecated this is the end!
#@override this is the end!
#@method this is the end!
#@abstract this is t he end!
#@in
#@returns Foo::Bar this is t he end!
#@returns Foo this is t he end!
#@returns
#@inject MYSQL this is the end!
#@inject PERL5
#@noinspection this is the end!
#@noinspection
#@
| {
"pile_set_name": "Github"
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.ServiceModel
{
using System.ServiceModel.Channels;
public enum WSMessageEncoding
{
Text = 0,
Mtom,
}
internal static class WSMessageEncodingHelper
{
internal static bool IsDefined(WSMessageEncoding value)
{
return
value == WSMessageEncoding.Text
|| value == WSMessageEncoding.Mtom;
}
internal static void SyncUpEncodingBindingElementProperties(TextMessageEncodingBindingElement textEncoding, MtomMessageEncodingBindingElement mtomEncoding)
{
// textEncoding provides the backing store for ReaderQuotas and WriteEncoding,
// we must ensure same values propogate to mtomEncoding
textEncoding.ReaderQuotas.CopyTo(mtomEncoding.ReaderQuotas);
mtomEncoding.WriteEncoding = textEncoding.WriteEncoding;
}
}
}
| {
"pile_set_name": "Github"
} |
"""
test_dav.py
Copyright 2012 Andres Riancho
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af 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 w3af; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
from nose.plugins.attrib import attr
from w3af.plugins.tests.helper import PluginTest, PluginConfig
class TestDav(PluginTest):
target_vuln_all = 'http://moth/w3af/audit/dav/write-all/'
target_no_privs = 'http://moth/w3af/audit/dav/no-privileges/'
target_safe_all = 'http://moth/w3af/audit/eval/'
_run_configs = {
'cfg': {
'target': None,
'plugins': {
'audit': (PluginConfig('dav',),),
}
},
}
@attr('ci_fails')
def test_found_all_dav(self):
cfg = self._run_configs['cfg']
self._scan(self.target_vuln_all, cfg['plugins'])
vulns = self.kb.get('dav', 'dav')
EXPECTED_NAMES = set(['Insecure DAV configuration'] * 2)
self.assertEquals(EXPECTED_NAMES,
set([v.get_name() for v in vulns])
)
self.assertEquals(set(['PUT', 'PROPFIND']),
set([v.get_method() for v in vulns]))
self.assertTrue(all([self.target_vuln_all == str(
v.get_url().get_domain_path()) for v in vulns]))
@attr('ci_fails')
def test_no_privileges(self):
"""
DAV is configured but the directory doesn't have the file-system permissions
to allow the Apache process to write to it.
"""
cfg = self._run_configs['cfg']
self._scan(self.target_no_privs, cfg['plugins'])
vulns = self.kb.get('dav', 'dav')
self.assertEquals(len(vulns), 2, vulns)
iname = 'DAV incorrect configuration'
info_no_privs = [i for i in vulns if i.get_name() == iname][0]
vname = 'Insecure DAV configuration'
vuln_propfind = [v for v in vulns if v.get_name() == vname][0]
info_url = str(info_no_privs.get_url().get_domain_path())
vuln_url = str(vuln_propfind.get_url().get_domain_path())
self.assertEquals(self.target_no_privs, info_url)
self.assertEquals(self.target_no_privs, vuln_url)
@attr('ci_fails')
def test_not_found_dav(self):
cfg = self._run_configs['cfg']
self._scan(self.target_safe_all, cfg['plugins'])
vulns = self.kb.get('dav', 'dav')
self.assertEquals(0, len(vulns)) | {
"pile_set_name": "Github"
} |
/*
* Copyright © 2010 Intel Corporation
*
* 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 (including the next
* paragraph) 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.
*
* Authors:
* jim liu <[email protected]>
* Jackie Li<[email protected]>
*/
#include <linux/module.h>
#include "mdfld_dsi_output.h"
#include "mdfld_dsi_dpi.h"
#include "mdfld_output.h"
#include "mdfld_dsi_pkg_sender.h"
#include "tc35876x-dsi-lvds.h"
#include <linux/pm_runtime.h>
#include <asm/intel_scu_ipc.h>
/* get the LABC from command line. */
static int LABC_control = 1;
#ifdef MODULE
module_param(LABC_control, int, 0644);
#else
static int __init parse_LABC_control(char *arg)
{
/* LABC control can be passed in as a cmdline parameter */
/* to enable this feature add LABC=1 to cmdline */
/* to disable this feature add LABC=0 to cmdline */
if (!arg)
return -EINVAL;
if (!strcasecmp(arg, "0"))
LABC_control = 0;
else if (!strcasecmp(arg, "1"))
LABC_control = 1;
return 0;
}
early_param("LABC", parse_LABC_control);
#endif
/**
* Check and see if the generic control or data buffer is empty and ready.
*/
void mdfld_dsi_gen_fifo_ready(struct drm_device *dev, u32 gen_fifo_stat_reg,
u32 fifo_stat)
{
u32 GEN_BF_time_out_count;
/* Check MIPI Adatper command registers */
for (GEN_BF_time_out_count = 0;
GEN_BF_time_out_count < GEN_FB_TIME_OUT;
GEN_BF_time_out_count++) {
if ((REG_READ(gen_fifo_stat_reg) & fifo_stat) == fifo_stat)
break;
udelay(100);
}
if (GEN_BF_time_out_count == GEN_FB_TIME_OUT)
DRM_ERROR("mdfld_dsi_gen_fifo_ready, Timeout. gen_fifo_stat_reg = 0x%x.\n",
gen_fifo_stat_reg);
}
/**
* Manage the DSI MIPI keyboard and display brightness.
* FIXME: this is exported to OSPM code. should work out an specific
* display interface to OSPM.
*/
void mdfld_dsi_brightness_init(struct mdfld_dsi_config *dsi_config, int pipe)
{
struct mdfld_dsi_pkg_sender *sender =
mdfld_dsi_get_pkg_sender(dsi_config);
struct drm_device *dev = sender->dev;
struct drm_psb_private *dev_priv = dev->dev_private;
u32 gen_ctrl_val;
if (!sender) {
DRM_ERROR("No sender found\n");
return;
}
/* Set default display backlight value to 85% (0xd8)*/
mdfld_dsi_send_mcs_short(sender, write_display_brightness, 0xd8, 1,
true);
/* Set minimum brightness setting of CABC function to 20% (0x33)*/
mdfld_dsi_send_mcs_short(sender, write_cabc_min_bright, 0x33, 1, true);
/* Enable backlight or/and LABC */
gen_ctrl_val = BRIGHT_CNTL_BLOCK_ON | DISPLAY_DIMMING_ON |
BACKLIGHT_ON;
if (LABC_control == 1)
gen_ctrl_val |= DISPLAY_DIMMING_ON | DISPLAY_BRIGHTNESS_AUTO
| GAMMA_AUTO;
if (LABC_control == 1)
gen_ctrl_val |= AMBIENT_LIGHT_SENSE_ON;
dev_priv->mipi_ctrl_display = gen_ctrl_val;
mdfld_dsi_send_mcs_short(sender, write_ctrl_display, (u8)gen_ctrl_val,
1, true);
mdfld_dsi_send_mcs_short(sender, write_ctrl_cabc, UI_IMAGE, 1, true);
}
void mdfld_dsi_brightness_control(struct drm_device *dev, int pipe, int level)
{
struct mdfld_dsi_pkg_sender *sender;
struct drm_psb_private *dev_priv;
struct mdfld_dsi_config *dsi_config;
u32 gen_ctrl_val = 0;
int p_type = TMD_VID;
if (!dev || (pipe != 0 && pipe != 2)) {
DRM_ERROR("Invalid parameter\n");
return;
}
p_type = mdfld_get_panel_type(dev, 0);
dev_priv = dev->dev_private;
if (pipe)
dsi_config = dev_priv->dsi_configs[1];
else
dsi_config = dev_priv->dsi_configs[0];
sender = mdfld_dsi_get_pkg_sender(dsi_config);
if (!sender) {
DRM_ERROR("No sender found\n");
return;
}
gen_ctrl_val = (level * 0xff / MDFLD_DSI_BRIGHTNESS_MAX_LEVEL) & 0xff;
dev_dbg(sender->dev->dev, "pipe = %d, gen_ctrl_val = %d.\n",
pipe, gen_ctrl_val);
if (p_type == TMD_VID) {
/* Set display backlight value */
mdfld_dsi_send_mcs_short(sender, tmd_write_display_brightness,
(u8)gen_ctrl_val, 1, true);
} else {
/* Set display backlight value */
mdfld_dsi_send_mcs_short(sender, write_display_brightness,
(u8)gen_ctrl_val, 1, true);
/* Enable backlight control */
if (level == 0)
gen_ctrl_val = 0;
else
gen_ctrl_val = dev_priv->mipi_ctrl_display;
mdfld_dsi_send_mcs_short(sender, write_ctrl_display,
(u8)gen_ctrl_val, 1, true);
}
}
static int mdfld_dsi_get_panel_status(struct mdfld_dsi_config *dsi_config,
u8 dcs, u32 *data, bool hs)
{
struct mdfld_dsi_pkg_sender *sender
= mdfld_dsi_get_pkg_sender(dsi_config);
if (!sender || !data) {
DRM_ERROR("Invalid parameter\n");
return -EINVAL;
}
return mdfld_dsi_read_mcs(sender, dcs, data, 1, hs);
}
int mdfld_dsi_get_power_mode(struct mdfld_dsi_config *dsi_config, u32 *mode,
bool hs)
{
if (!dsi_config || !mode) {
DRM_ERROR("Invalid parameter\n");
return -EINVAL;
}
return mdfld_dsi_get_panel_status(dsi_config, 0x0a, mode, hs);
}
/*
* NOTE: this function was used by OSPM.
* TODO: will be removed later, should work out display interfaces for OSPM
*/
void mdfld_dsi_controller_init(struct mdfld_dsi_config *dsi_config, int pipe)
{
if (!dsi_config || ((pipe != 0) && (pipe != 2))) {
DRM_ERROR("Invalid parameters\n");
return;
}
mdfld_dsi_dpi_controller_init(dsi_config, pipe);
}
static void mdfld_dsi_connector_save(struct drm_connector *connector)
{
}
static void mdfld_dsi_connector_restore(struct drm_connector *connector)
{
}
/* FIXME: start using the force parameter */
static enum drm_connector_status
mdfld_dsi_connector_detect(struct drm_connector *connector, bool force)
{
struct mdfld_dsi_connector *dsi_connector
= mdfld_dsi_connector(connector);
dsi_connector->status = connector_status_connected;
return dsi_connector->status;
}
static int mdfld_dsi_connector_set_property(struct drm_connector *connector,
struct drm_property *property,
uint64_t value)
{
struct drm_encoder *encoder = connector->encoder;
if (!strcmp(property->name, "scaling mode") && encoder) {
struct psb_intel_crtc *psb_crtc =
to_psb_intel_crtc(encoder->crtc);
bool centerechange;
uint64_t val;
if (!psb_crtc)
goto set_prop_error;
switch (value) {
case DRM_MODE_SCALE_FULLSCREEN:
break;
case DRM_MODE_SCALE_NO_SCALE:
break;
case DRM_MODE_SCALE_ASPECT:
break;
default:
goto set_prop_error;
}
if (drm_connector_property_get_value(connector, property, &val))
goto set_prop_error;
if (val == value)
goto set_prop_done;
if (drm_connector_property_set_value(connector,
property, value))
goto set_prop_error;
centerechange = (val == DRM_MODE_SCALE_NO_SCALE) ||
(value == DRM_MODE_SCALE_NO_SCALE);
if (psb_crtc->saved_mode.hdisplay != 0 &&
psb_crtc->saved_mode.vdisplay != 0) {
if (centerechange) {
if (!drm_crtc_helper_set_mode(encoder->crtc,
&psb_crtc->saved_mode,
encoder->crtc->x,
encoder->crtc->y,
encoder->crtc->fb))
goto set_prop_error;
} else {
struct drm_encoder_helper_funcs *funcs =
encoder->helper_private;
funcs->mode_set(encoder,
&psb_crtc->saved_mode,
&psb_crtc->saved_adjusted_mode);
}
}
} else if (!strcmp(property->name, "backlight") && encoder) {
if (drm_connector_property_set_value(connector, property,
value))
goto set_prop_error;
else {
#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
struct backlight_device *psb_bd;
psb_bd = mdfld_get_backlight_device();
if (psb_bd) {
psb_bd->props.brightness = value;
mdfld_set_brightness(psb_bd);
}
#endif
}
}
set_prop_done:
return 0;
set_prop_error:
return -1;
}
static void mdfld_dsi_connector_destroy(struct drm_connector *connector)
{
struct mdfld_dsi_connector *dsi_connector =
mdfld_dsi_connector(connector);
struct mdfld_dsi_pkg_sender *sender;
if (!dsi_connector)
return;
drm_sysfs_connector_remove(connector);
drm_connector_cleanup(connector);
sender = dsi_connector->pkg_sender;
mdfld_dsi_pkg_sender_destroy(sender);
kfree(dsi_connector);
}
static int mdfld_dsi_connector_get_modes(struct drm_connector *connector)
{
struct mdfld_dsi_connector *dsi_connector =
mdfld_dsi_connector(connector);
struct mdfld_dsi_config *dsi_config =
mdfld_dsi_get_config(dsi_connector);
struct drm_display_mode *fixed_mode = dsi_config->fixed_mode;
struct drm_display_mode *dup_mode = NULL;
struct drm_device *dev = connector->dev;
connector->display_info.min_vfreq = 0;
connector->display_info.max_vfreq = 200;
connector->display_info.min_hfreq = 0;
connector->display_info.max_hfreq = 200;
if (fixed_mode) {
dev_dbg(dev->dev, "fixed_mode %dx%d\n",
fixed_mode->hdisplay, fixed_mode->vdisplay);
dup_mode = drm_mode_duplicate(dev, fixed_mode);
drm_mode_probed_add(connector, dup_mode);
return 1;
}
DRM_ERROR("Didn't get any modes!\n");
return 0;
}
static int mdfld_dsi_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
struct mdfld_dsi_connector *dsi_connector =
mdfld_dsi_connector(connector);
struct mdfld_dsi_config *dsi_config =
mdfld_dsi_get_config(dsi_connector);
struct drm_display_mode *fixed_mode = dsi_config->fixed_mode;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
return MODE_NO_DBLESCAN;
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
return MODE_NO_INTERLACE;
/**
* FIXME: current DC has no fitting unit, reject any mode setting
* request
* Will figure out a way to do up-scaling(pannel fitting) later.
**/
if (fixed_mode) {
if (mode->hdisplay != fixed_mode->hdisplay)
return MODE_PANEL;
if (mode->vdisplay != fixed_mode->vdisplay)
return MODE_PANEL;
}
return MODE_OK;
}
static void mdfld_dsi_connector_dpms(struct drm_connector *connector, int mode)
{
if (mode == connector->dpms)
return;
/*first, execute dpms*/
drm_helper_connector_dpms(connector, mode);
}
static struct drm_encoder *mdfld_dsi_connector_best_encoder(
struct drm_connector *connector)
{
struct mdfld_dsi_connector *dsi_connector =
mdfld_dsi_connector(connector);
struct mdfld_dsi_config *dsi_config =
mdfld_dsi_get_config(dsi_connector);
return &dsi_config->encoder->base.base;
}
/*DSI connector funcs*/
static const struct drm_connector_funcs mdfld_dsi_connector_funcs = {
.dpms = /*drm_helper_connector_dpms*/mdfld_dsi_connector_dpms,
.save = mdfld_dsi_connector_save,
.restore = mdfld_dsi_connector_restore,
.detect = mdfld_dsi_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.set_property = mdfld_dsi_connector_set_property,
.destroy = mdfld_dsi_connector_destroy,
};
/*DSI connector helper funcs*/
static const struct drm_connector_helper_funcs
mdfld_dsi_connector_helper_funcs = {
.get_modes = mdfld_dsi_connector_get_modes,
.mode_valid = mdfld_dsi_connector_mode_valid,
.best_encoder = mdfld_dsi_connector_best_encoder,
};
static int mdfld_dsi_get_default_config(struct drm_device *dev,
struct mdfld_dsi_config *config, int pipe)
{
if (!dev || !config) {
DRM_ERROR("Invalid parameters");
return -EINVAL;
}
config->bpp = 24;
if (mdfld_get_panel_type(dev, pipe) == TC35876X)
config->lane_count = 4;
else
config->lane_count = 2;
config->channel_num = 0;
if (mdfld_get_panel_type(dev, pipe) == TMD_VID)
config->video_mode = MDFLD_DSI_VIDEO_NON_BURST_MODE_SYNC_PULSE;
else if (mdfld_get_panel_type(dev, pipe) == TC35876X)
config->video_mode =
MDFLD_DSI_VIDEO_NON_BURST_MODE_SYNC_EVENTS;
else
config->video_mode = MDFLD_DSI_VIDEO_BURST_MODE;
return 0;
}
int mdfld_dsi_panel_reset(int pipe)
{
unsigned gpio;
int ret = 0;
switch (pipe) {
case 0:
gpio = 128;
break;
case 2:
gpio = 34;
break;
default:
DRM_ERROR("Invalid output\n");
return -EINVAL;
}
ret = gpio_request(gpio, "gfx");
if (ret) {
DRM_ERROR("gpio_rqueset failed\n");
return ret;
}
ret = gpio_direction_output(gpio, 1);
if (ret) {
DRM_ERROR("gpio_direction_output failed\n");
goto gpio_error;
}
gpio_get_value(128);
gpio_error:
if (gpio_is_valid(gpio))
gpio_free(gpio);
return ret;
}
/*
* MIPI output init
* @dev drm device
* @pipe pipe number. 0 or 2
* @config
*
* Do the initialization of a MIPI output, including create DRM mode objects
* initialization of DSI output on @pipe
*/
void mdfld_dsi_output_init(struct drm_device *dev,
int pipe,
const struct panel_funcs *p_vid_funcs)
{
struct mdfld_dsi_config *dsi_config;
struct mdfld_dsi_connector *dsi_connector;
struct drm_connector *connector;
struct mdfld_dsi_encoder *encoder;
struct drm_psb_private *dev_priv = dev->dev_private;
struct panel_info dsi_panel_info;
u32 width_mm, height_mm;
dev_dbg(dev->dev, "init DSI output on pipe %d\n", pipe);
if (!dev || ((pipe != 0) && (pipe != 2))) {
DRM_ERROR("Invalid parameter\n");
return;
}
/*create a new connetor*/
dsi_connector = kzalloc(sizeof(struct mdfld_dsi_connector), GFP_KERNEL);
if (!dsi_connector) {
DRM_ERROR("No memory");
return;
}
dsi_connector->pipe = pipe;
dsi_config = kzalloc(sizeof(struct mdfld_dsi_config),
GFP_KERNEL);
if (!dsi_config) {
DRM_ERROR("cannot allocate memory for DSI config\n");
goto dsi_init_err0;
}
mdfld_dsi_get_default_config(dev, dsi_config, pipe);
dsi_connector->private = dsi_config;
dsi_config->changed = 1;
dsi_config->dev = dev;
dsi_config->fixed_mode = p_vid_funcs->get_config_mode(dev);
if (p_vid_funcs->get_panel_info(dev, pipe, &dsi_panel_info))
goto dsi_init_err0;
width_mm = dsi_panel_info.width_mm;
height_mm = dsi_panel_info.height_mm;
dsi_config->mode = dsi_config->fixed_mode;
dsi_config->connector = dsi_connector;
if (!dsi_config->fixed_mode) {
DRM_ERROR("No pannel fixed mode was found\n");
goto dsi_init_err0;
}
if (pipe && dev_priv->dsi_configs[0]) {
dsi_config->dvr_ic_inited = 0;
dev_priv->dsi_configs[1] = dsi_config;
} else if (pipe == 0) {
dsi_config->dvr_ic_inited = 1;
dev_priv->dsi_configs[0] = dsi_config;
} else {
DRM_ERROR("Trying to init MIPI1 before MIPI0\n");
goto dsi_init_err0;
}
connector = &dsi_connector->base.base;
drm_connector_init(dev, connector, &mdfld_dsi_connector_funcs,
DRM_MODE_CONNECTOR_LVDS);
drm_connector_helper_add(connector, &mdfld_dsi_connector_helper_funcs);
connector->display_info.subpixel_order = SubPixelHorizontalRGB;
connector->display_info.width_mm = width_mm;
connector->display_info.height_mm = height_mm;
connector->interlace_allowed = false;
connector->doublescan_allowed = false;
/*attach properties*/
drm_connector_attach_property(connector,
dev->mode_config.scaling_mode_property,
DRM_MODE_SCALE_FULLSCREEN);
drm_connector_attach_property(connector,
dev_priv->backlight_property,
MDFLD_DSI_BRIGHTNESS_MAX_LEVEL);
/*init DSI package sender on this output*/
if (mdfld_dsi_pkg_sender_init(dsi_connector, pipe)) {
DRM_ERROR("Package Sender initialization failed on pipe %d\n",
pipe);
goto dsi_init_err0;
}
encoder = mdfld_dsi_dpi_init(dev, dsi_connector, p_vid_funcs);
if (!encoder) {
DRM_ERROR("Create DPI encoder failed\n");
goto dsi_init_err1;
}
encoder->private = dsi_config;
dsi_config->encoder = encoder;
encoder->base.type = (pipe == 0) ? INTEL_OUTPUT_MIPI :
INTEL_OUTPUT_MIPI2;
drm_sysfs_connector_add(connector);
return;
/*TODO: add code to destroy outputs on error*/
dsi_init_err1:
/*destroy sender*/
mdfld_dsi_pkg_sender_destroy(dsi_connector->pkg_sender);
drm_connector_cleanup(connector);
kfree(dsi_config->fixed_mode);
kfree(dsi_config);
dsi_init_err0:
kfree(dsi_connector);
}
| {
"pile_set_name": "Github"
} |
% FFI and platform-specific code **[FIXME]**
> **[FIXME]** Not sure where this should live.
When writing cross-platform code, group platform-specific code into a
module called `platform`. Avoid `#[cfg]` directives outside this
`platform` module.
| {
"pile_set_name": "Github"
} |
/*
Udp NTP Client
Get the time from a Network Time Protocol (NTP) time server
Demonstrates use of UDP sendPacket and ReceivePacket
For more on NTP time servers and the messages needed to communicate with them,
see http://en.wikipedia.org/wiki/Network_Time_Protocol
Warning: NTP Servers are subject to temporary failure or IP address change.
Plese check
http://tf.nist.gov/tf-cgi/servers.cgi
if the time server used in the example didn't work.
created 4 Sep 2010
by Michael Margolis
modified 9 Apr 2012
by Tom Igoe
This code is in the public domain.
*/
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
unsigned int localPort = 8888; // local port to listen for UDP packets
IPAddress timeServer(132, 163, 4, 101); // time-a.timefreq.bldrdoc.gov NTP server
// IPAddress timeServer(132, 163, 4, 102); // time-b.timefreq.bldrdoc.gov NTP server
// IPAddress timeServer(132, 163, 4, 103); // time-c.timefreq.bldrdoc.gov NTP server
const int NTP_PACKET_SIZE= 48; // NTP time stamp is in the first 48 bytes of the message
byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
// A UDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start Ethernet and UDP
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
for(;;)
;
}
Udp.begin(localPort);
}
void loop()
{
sendNTPpacket(timeServer); // send an NTP packet to a time server
// wait to see if a reply is available
delay(1000);
if ( Udp.parsePacket() ) {
// We've received a packet, read the data from it
Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet into the buffer
//the timestamp starts at byte 40 of the received packet and is four bytes,
// or two words, long. First, esxtract the two words:
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
// combine the four bytes (two words) into a long integer
// this is NTP time (seconds since Jan 1 1900):
unsigned long secsSince1900 = highWord << 16 | lowWord;
Serial.print("Seconds since Jan 1 1900 = " );
Serial.println(secsSince1900);
// now convert NTP time into everyday time:
Serial.print("Unix time = ");
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const unsigned long seventyYears = 2208988800UL;
// subtract seventy years:
unsigned long epoch = secsSince1900 - seventyYears;
// print Unix time:
Serial.println(epoch);
// print the hour, minute and second:
Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
Serial.print(':');
if ( ((epoch % 3600) / 60) < 10 ) {
// In the first 10 minutes of each hour, we'll want a leading '0'
Serial.print('0');
}
Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
Serial.print(':');
if ( (epoch % 60) < 10 ) {
// In the first 10 seconds of each minute, we'll want a leading '0'
Serial.print('0');
}
Serial.println(epoch %60); // print the second
}
// wait ten seconds before asking for the time again
delay(10000);
}
// send an NTP request to the time server at the given address
unsigned long sendNTPpacket(IPAddress& address)
{
// set all bytes in the buffer to 0
memset(packetBuffer, 0, NTP_PACKET_SIZE);
// Initialize values needed to form NTP request
// (see URL above for details on the packets)
packetBuffer[0] = 0b11100011; // LI, Version, Mode
packetBuffer[1] = 0; // Stratum, or type of clock
packetBuffer[2] = 6; // Polling Interval
packetBuffer[3] = 0xEC; // Peer Clock Precision
// 8 bytes of zero for Root Delay & Root Dispersion
packetBuffer[12] = 49;
packetBuffer[13] = 0x4E;
packetBuffer[14] = 49;
packetBuffer[15] = 52;
// all NTP fields have been given values, now
// you can send a packet requesting a timestamp:
Udp.beginPacket(address, 123); //NTP requests are to port 123
Udp.write(packetBuffer,NTP_PACKET_SIZE);
Udp.endPacket();
}
| {
"pile_set_name": "Github"
} |
#############################################################
# Required variables for each makefile
# Discard this section from all parent makefiles
# Expected variables (with automatic defaults):
# CSRCS (all "C" files in the dir)
# SUBDIRS (all subdirs with a Makefile)
# GEN_LIBS - list of libs to be generated ()
# GEN_IMAGES - list of images to be generated ()
# COMPONENTS_xxx - a list of libs/objs in the form
# subdir/lib to be extracted and rolled up into
# a generated lib/image xxx.a ()
#
ifndef PDIR
GEN_LIBS = libuser.a
endif
#############################################################
# Configuration i.e. compile options etc.
# Target specific stuff (defines etc.) goes in here!
# Generally values applying to a tree are captured in the
# makefile at its root level - these are then overridden
# for a subtree within the makefile rooted therein
#
#DEFINES +=
#############################################################
# Recursion Magic - Don't touch this!!
#
# Each subtree potentially has an include directory
# corresponding to the common APIs applicable to modules
# rooted at that subtree. Accordingly, the INCLUDE PATH
# of a module can only contain the include directories up
# its parent path, and not its siblings
#
# Required for each makefile to inherit from the parent
#
INCLUDES := $(INCLUDES) -I $(PDIR)include
INCLUDES += -I ./
PDIR := ../$(PDIR)
sinclude $(PDIR)Makefile
| {
"pile_set_name": "Github"
} |
# DAMM
# Copyright (c) 2013 504ENSICS Labs
#
# This file is part of DAMM.
#
# DAMM 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.
#
# DAMM 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 DAMM. If not, see <http://www.gnu.org/licenses/>.
#
#
# A plugin for parsing MFT entries from Windows memory dumps.
#
import libdamm.memory_object as memobj
def getPluginObject(vol):
return MFTSet(vol)
def getFields():
return MFTEntry().get_field_keys()
class MFTSet(memobj.MemObjectSet):
'''
Parses MFT entries from Windows memory dumps.
'''
def __init__(self, vol=None):
memobj.MemObjectSet.__init__(self, vol)
def valid_body(self, body):
import sys
try:
offset = body.split("|")[1].split("Offset: ")[1].strip(")")
except:
return False
return True
def get_alloc(self, addr_space):
'''
Mimics volatility's mftparser plugin.
'''
import volatility.plugins.mftparser as mftparser
parser = mftparser.MFTParser(self.vol.config)
# Some notes: every base MFT entry should have one $SI and at lease one $FN
# Usually $SI occurs before $FN
# We'll make an effort to get the filename from $FN for $SI
# If there is only one $SI with no $FN we dump whatever information it has
for offset, mft_entry, attributes in parser.calculate():
si = None
full = ""
datanum = 0
for a, i in attributes:
# we'll have a default file size of -1 for records missing $FN attributes
# note that file size found in $FN may not actually be accurate and will most likely
# be 0. See Carrier, pg 363
size = -1
if a.startswith("STANDARD_INFORMATION"):
if full != "":
# if we are here, we've hit one $FN attribute for this entry already and have the full name
# so we can dump this $SI
body = "0|{0}\n".format(i.body(full, mft_entry.RecordNumber, size, offset))
if self.valid_body(body):
yield MFTEntry(body)
elif si != None:
# if we are here then we have more than one $SI attribute for this entry
# since we don't want to lose its info, we'll just dump it for now
# we won't have full path, but we'll have a filename most likely
body = "0|{0}\n".format(i.body("", mft_entry.RecordNumber, size, offset))
if self.valid_body(body):
yield MFTEntry(body)
elif si == None:
# this is the usual case and we'll save the $SI to process after we get the full path from the $FN
si = i
elif a.startswith("FILE_NAME"):
if hasattr(i, "ParentDirectory"):
full = mft_entry.get_full_path(i)
size = int(i.RealFileSize)
body = "0|{0}\n".format(i.body(full, mft_entry.RecordNumber, size, offset))
if self.valid_body(body):
yield MFTEntry(body)
if si != None:
body = "0|{0}\n".format(si.body(full, mft_entry.RecordNumber, size, offset))
if self.valid_body(body):
yield MFTEntry(body)
si = None
elif a.startswith("DATA"):
pass
if si != None:
# here we have a lone $SI in an MFT entry with no valid $FN. This is most likely a non-base entry
body = "0|{0}\n".format(si.body("", mft_entry.RecordNumber, -1, offset))
if self.valid_body(body):
yield MFTEntry(body)
def get_child(self):
return MFTEntry()
def get_unique_id(self, bentry):
return bentry.fields['name']
def sort_elems(self, elems):
elems.sort(key=lambda x: x.fields['name'].lower())
return elems
class MFTEntry(memobj.MemObject):
def __init__(self, body_string=None):
if body_string:
offset = body_string.split("|")[1].split("Offset: ")[1].strip(")")
else:
offset = None
memobj.MemObject.__init__(self, offset)
import time
self.fields['md5'] = body_string.split("|")[0] if body_string else ''
self.fields['name'] = body_string.split("|")[1].split("(Offset: ")[0].strip() if body_string else ''
self.fields['inode'] = body_string.split("|")[2] if body_string else ''
self.fields['mode_as_string'] = body_string.split("|")[3] if body_string else ''
self.fields['UID'] = body_string.split("|")[4] if body_string else ''
self.fields['GID'] = body_string.split("|")[5] if body_string else ''
self.fields['size'] = body_string.split("|")[6] if body_string else ''
try:
self.fields['atime'] = time.ctime(int(body_string.split("|")[7])) if body_string else ''
except:
self.fields['atime'] = 'BAD'
try:
self.fields['mtime'] = time.ctime(int(body_string.split("|")[8])) if body_string else ''
except:
self.fields['mtime'] = 'BAD'
try:
self.fields['ctime'] = time.ctime(int(body_string.split("|")[9])) if body_string else ''
except:
self.fields['ctime'] = 'BAD'
try:
self.fields['crtime'] = time.ctime(int(body_string.split("|")[10].strip())) if body_string else ''
except:
self.fields['crtime'] = 'BAD'
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/resources_util.h"
#include "grit/theme_resources.h"
#include "grit/theme_resources_standard.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
struct TestCase {
const char* name;
int id;
};
} // namespace
TEST(ResourcesUtil, SpotCheckIds) {
const TestCase kTestCases[] = {
{"IDR_BACK", IDR_BACK},
{"IDR_STOP", IDR_STOP},
{"IDR_OMNIBOX_STAR", IDR_OMNIBOX_STAR},
{"IDR_SAD_TAB", IDR_SAD_TAB},
};
for (size_t i = 0; i < arraysize(kTestCases); ++i) {
EXPECT_EQ(kTestCases[i].id,
ResourcesUtil::GetThemeResourceId(kTestCases[i].name));
}
// Should return -1 of unknown names.
EXPECT_EQ(-1, ResourcesUtil::GetThemeResourceId("foobar"));
EXPECT_EQ(-1, ResourcesUtil::GetThemeResourceId("backstar"));
}
| {
"pile_set_name": "Github"
} |
using System;
using System.Xml;
using System.Xml.Serialization;
namespace grendgine_collada
{
[Serializable]
[XmlType(AnonymousType = true)]
public partial class Grendgine_Collada_Instance_Visual_Scene
{
[XmlAttribute("sid")]
public string sID;
[XmlAttribute("name")]
public string Name;
[XmlAttribute("url")]
public string URL;
[XmlElement(ElementName = "extra")]
public Grendgine_Collada_Extra[] Extra;
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script>
function doTest() {
document.getElementById('t').removeAttribute('readonly');
document.documentElement.className='';
}
document.addEventListener("MozReftestInvalidate", doTest);
</script>
</head>
<!-- Test: if textarea is no longer readonly, but doesn't have it's value changed,
it's not affected by :-moz-ui-invalid pseudo-class. -->
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<textarea class='notinvalid' id='t' readonly required></textarea>
</body>
</html>
| {
"pile_set_name": "Github"
} |
* @liamg @MaxRis
| {
"pile_set_name": "Github"
} |
/* ============================================================================================= */
/* FMOD Ex - Memory info header file. Copyright (c), Firelight Technologies Pty, Ltd. 2008-2011. */
/* */
/* Use this header if you are interested in getting detailed information on FMOD's memory */
/* usage. See the documentation for more details. */
/* */
/* ============================================================================================= */
#ifndef _FMOD_MEMORYINFO_H
#define _FMOD_MEMORYINFO_H
/*
[STRUCTURE]
[
[DESCRIPTION]
Structure to be filled with detailed memory usage information of an FMOD object
[REMARKS]
Every public FMOD class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question.
On return from getMemoryInfo, each member of this structure will hold the amount of memory used for its type in bytes.<br>
<br>
Members marked with [in] mean the user sets the value before passing it to the function.<br>
Members marked with [out] mean FMOD sets the value to be used after the function exits.<br>
[PLATFORMS]
Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android
[SEE_ALSO]
System::getMemoryInfo
EventSystem::getMemoryInfo
FMOD_MEMBITS
FMOD_EVENT_MEMBITS
]
*/
typedef struct FMOD_MEMORY_USAGE_DETAILS
{
unsigned int other; /* [out] Memory not accounted for by other types */
unsigned int string; /* [out] String data */
unsigned int system; /* [out] System object and various internals */
unsigned int plugins; /* [out] Plugin objects and internals */
unsigned int output; /* [out] Output module object and internals */
unsigned int channel; /* [out] Channel related memory */
unsigned int channelgroup; /* [out] ChannelGroup objects and internals */
unsigned int codec; /* [out] Codecs allocated for streaming */
unsigned int file; /* [out] File buffers and structures */
unsigned int sound; /* [out] Sound objects and internals */
unsigned int secondaryram; /* [out] Sound data stored in secondary RAM */
unsigned int soundgroup; /* [out] SoundGroup objects and internals */
unsigned int streambuffer; /* [out] Stream buffer memory */
unsigned int dspconnection; /* [out] DSPConnection objects and internals */
unsigned int dsp; /* [out] DSP implementation objects */
unsigned int dspcodec; /* [out] Realtime file format decoding DSP objects */
unsigned int profile; /* [out] Profiler memory footprint. */
unsigned int recordbuffer; /* [out] Buffer used to store recorded data from microphone */
unsigned int reverb; /* [out] Reverb implementation objects */
unsigned int reverbchannelprops; /* [out] Reverb channel properties structs */
unsigned int geometry; /* [out] Geometry objects and internals */
unsigned int syncpoint; /* [out] Sync point memory. */
unsigned int eventsystem; /* [out] EventSystem and various internals */
unsigned int musicsystem; /* [out] MusicSystem and various internals */
unsigned int fev; /* [out] Definition of objects contained in all loaded projects e.g. events, groups, categories */
unsigned int memoryfsb; /* [out] Data loaded with preloadFSB */
unsigned int eventproject; /* [out] EventProject objects and internals */
unsigned int eventgroupi; /* [out] EventGroup objects and internals */
unsigned int soundbankclass; /* [out] Objects used to manage wave banks */
unsigned int soundbanklist; /* [out] Data used to manage lists of wave bank usage */
unsigned int streaminstance; /* [out] Stream objects and internals */
unsigned int sounddefclass; /* [out] Sound definition objects */
unsigned int sounddefdefclass; /* [out] Sound definition static data objects */
unsigned int sounddefpool; /* [out] Sound definition pool data */
unsigned int reverbdef; /* [out] Reverb definition objects */
unsigned int eventreverb; /* [out] Reverb objects */
unsigned int userproperty; /* [out] User property objects */
unsigned int eventinstance; /* [out] Event instance base objects */
unsigned int eventinstance_complex; /* [out] Complex event instance objects */
unsigned int eventinstance_simple; /* [out] Simple event instance objects */
unsigned int eventinstance_layer; /* [out] Event layer instance objects */
unsigned int eventinstance_sound; /* [out] Event sound instance objects */
unsigned int eventenvelope; /* [out] Event envelope objects */
unsigned int eventenvelopedef; /* [out] Event envelope definition objects */
unsigned int eventparameter; /* [out] Event parameter objects */
unsigned int eventcategory; /* [out] Event category objects */
unsigned int eventenvelopepoint; /* [out] Event envelope point objects */
unsigned int eventinstancepool; /* [out] Event instance pool memory */
} FMOD_MEMORY_USAGE_DETAILS;
/*
[DEFINE]
[
[NAME]
FMOD_MEMBITS
[DESCRIPTION]
Bitfield used to request specific memory usage information from the getMemoryInfo function of every public FMOD Ex class.
Use with the "memorybits" parameter of getMemoryInfo to get information on FMOD Ex memory usage.
[REMARKS]
Every public FMOD class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question.
The FMOD_MEMBITS defines can be OR'd together to specify precisely what memory usage you'd like to get information on. See System::getMemoryInfo for an example.
[PLATFORMS]
Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android
[SEE_ALSO]
FMOD_EVENT_MEMBITS
System::getMemoryInfo
]
*/
#define FMOD_MEMBITS_OTHER 0x00000001 /* Memory not accounted for by other types */
#define FMOD_MEMBITS_STRING 0x00000002 /* String data */
#define FMOD_MEMBITS_SYSTEM 0x00000004 /* System object and various internals */
#define FMOD_MEMBITS_PLUGINS 0x00000008 /* Plugin objects and internals */
#define FMOD_MEMBITS_OUTPUT 0x00000010 /* Output module object and internals */
#define FMOD_MEMBITS_CHANNEL 0x00000020 /* Channel related memory */
#define FMOD_MEMBITS_CHANNELGROUP 0x00000040 /* ChannelGroup objects and internals */
#define FMOD_MEMBITS_CODEC 0x00000080 /* Codecs allocated for streaming */
#define FMOD_MEMBITS_FILE 0x00000100 /* Codecs allocated for streaming */
#define FMOD_MEMBITS_SOUND 0x00000200 /* Sound objects and internals */
#define FMOD_MEMBITS_SOUND_SECONDARYRAM 0x00000400 /* Sound data stored in secondary RAM */
#define FMOD_MEMBITS_SOUNDGROUP 0x00000800 /* SoundGroup objects and internals */
#define FMOD_MEMBITS_STREAMBUFFER 0x00001000 /* Stream buffer memory */
#define FMOD_MEMBITS_DSPCONNECTION 0x00002000 /* DSPConnection objects and internals */
#define FMOD_MEMBITS_DSP 0x00004000 /* DSP implementation objects */
#define FMOD_MEMBITS_DSPCODEC 0x00008000 /* Realtime file format decoding DSP objects */
#define FMOD_MEMBITS_PROFILE 0x00010000 /* Profiler memory footprint. */
#define FMOD_MEMBITS_RECORDBUFFER 0x00020000 /* Buffer used to store recorded data from microphone */
#define FMOD_MEMBITS_REVERB 0x00040000 /* Reverb implementation objects */
#define FMOD_MEMBITS_REVERBCHANNELPROPS 0x00080000 /* Reverb channel properties structs */
#define FMOD_MEMBITS_GEOMETRY 0x00100000 /* Geometry objects and internals */
#define FMOD_MEMBITS_SYNCPOINT 0x00200000 /* Sync point memory. */
#define FMOD_MEMBITS_ALL 0xffffffff /* All memory used by FMOD Ex */
/* [DEFINE_END] */
/*
[DEFINE]
[
[NAME]
FMOD_EVENT_MEMBITS
[DESCRIPTION]
Bitfield used to request specific memory usage information from the getMemoryInfo function of every public FMOD Event System class.
Use with the "event_memorybits" parameter of getMemoryInfo to get information on FMOD Event System memory usage.
[REMARKS]
Every public FMOD Event System class has a getMemoryInfo function which can be used to get detailed information on what memory resources are associated with the object in question.
The FMOD_EVENT_MEMBITS defines can be OR'd together to specify precisely what memory usage you'd like to get information on. See EventSystem::getMemoryInfo for an example.
[PLATFORMS]
Win32, Win64, Linux, Linux64, Macintosh, Xbox360, PlayStation Portable, PlayStation 3, Wii, iPhone, 3GS, NGP, Android
[SEE_ALSO]
FMOD_MEMBITS
System::getMemoryInfo
]
*/
#define FMOD_EVENT_MEMBITS_EVENTSYSTEM 0x00000001 /* EventSystem and various internals */
#define FMOD_EVENT_MEMBITS_MUSICSYSTEM 0x00000002 /* MusicSystem and various internals */
#define FMOD_EVENT_MEMBITS_FEV 0x00000004 /* Definition of objects contained in all loaded projects e.g. events, groups, categories */
#define FMOD_EVENT_MEMBITS_MEMORYFSB 0x00000008 /* Data loaded with preloadFSB */
#define FMOD_EVENT_MEMBITS_EVENTPROJECT 0x00000010 /* EventProject objects and internals */
#define FMOD_EVENT_MEMBITS_EVENTGROUPI 0x00000020 /* EventGroup objects and internals */
#define FMOD_EVENT_MEMBITS_SOUNDBANKCLASS 0x00000040 /* Objects used to manage wave banks */
#define FMOD_EVENT_MEMBITS_SOUNDBANKLIST 0x00000080 /* Data used to manage lists of wave bank usage */
#define FMOD_EVENT_MEMBITS_STREAMINSTANCE 0x00000100 /* Stream objects and internals */
#define FMOD_EVENT_MEMBITS_SOUNDDEFCLASS 0x00000200 /* Sound definition objects */
#define FMOD_EVENT_MEMBITS_SOUNDDEFDEFCLASS 0x00000400 /* Sound definition static data objects */
#define FMOD_EVENT_MEMBITS_SOUNDDEFPOOL 0x00000800 /* Sound definition pool data */
#define FMOD_EVENT_MEMBITS_REVERBDEF 0x00001000 /* Reverb definition objects */
#define FMOD_EVENT_MEMBITS_EVENTREVERB 0x00002000 /* Reverb objects */
#define FMOD_EVENT_MEMBITS_USERPROPERTY 0x00004000 /* User property objects */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCE 0x00008000 /* Event instance base objects */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_COMPLEX 0x00010000 /* Complex event instance objects */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_SIMPLE 0x00020000 /* Simple event instance objects */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_LAYER 0x00040000 /* Event layer instance objects */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_SOUND 0x00080000 /* Event sound instance objects */
#define FMOD_EVENT_MEMBITS_EVENTENVELOPE 0x00100000 /* Event envelope objects */
#define FMOD_EVENT_MEMBITS_EVENTENVELOPEDEF 0x00200000 /* Event envelope definition objects */
#define FMOD_EVENT_MEMBITS_EVENTPARAMETER 0x00400000 /* Event parameter objects */
#define FMOD_EVENT_MEMBITS_EVENTCATEGORY 0x00800000 /* Event category objects */
#define FMOD_EVENT_MEMBITS_EVENTENVELOPEPOINT 0x01000000 /* Event envelope point object+s */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCEPOOL 0x02000000 /* Event instance pool data */
#define FMOD_EVENT_MEMBITS_ALL 0xffffffff /* All memory used by FMOD Event System */
/* All event instance memory */
#define FMOD_EVENT_MEMBITS_EVENTINSTANCE_GROUP (FMOD_EVENT_MEMBITS_EVENTINSTANCE | \
FMOD_EVENT_MEMBITS_EVENTINSTANCE_COMPLEX | \
FMOD_EVENT_MEMBITS_EVENTINSTANCE_SIMPLE | \
FMOD_EVENT_MEMBITS_EVENTINSTANCE_LAYER | \
FMOD_EVENT_MEMBITS_EVENTINSTANCE_SOUND)
/* All sound definition memory */
#define FMOD_EVENT_MEMBITS_SOUNDDEF_GROUP (FMOD_EVENT_MEMBITS_SOUNDDEFCLASS | \
FMOD_EVENT_MEMBITS_SOUNDDEFDEFCLASS | \
FMOD_EVENT_MEMBITS_SOUNDDEFPOOL)
/* [DEFINE_END] */
#endif
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1
| {
"pile_set_name": "Github"
} |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { startExtensionHostProcess } from 'vs/workbench/services/extensions/node/extensionHostProcessSetup';
startExtensionHostProcess().catch((err) => console.log(err));
| {
"pile_set_name": "Github"
} |
# Lista de Cursos Gratuitos em Holandês
Lista criada em 25-01-2020.
Entre no grupo do Telegram para receber avisos sobre as atualizações das listas.
No grupo serão compartilhados cupons de desconto disponibilizados por alguns instrutores da Udemy.
Entre no grupo agora mesmo: [Grupo no Telegram](http://bit.ly/2UvKbVX)
## Saúde e Fitness
- [ 1 - Voedingsexpert](https://www.udemy.com/course/voedingsexpert/?deal_code=UDEAFFBCS120&ranMID=39197&ranEAID=FYTGsFWqJEA&ranSiteID=FYTGsFWqJEA-ru3zxxTKc5sff70WsFQgzw&LSNPUBID=FYTGsFWqJEA)
Entre no grupo do Telegram para receber avisos sobre as atualizações das listas.
No grupo serão compartilhados cupons de desconto disponibilizados por alguns instrutores da Udemy.
Entre no grupo agora mesmo: [Grupo no Telegram](http://bit.ly/2UvKbVX)
**Bons estudos!**
| {
"pile_set_name": "Github"
} |
Beyond Code: thinking "right" to become a better Engineer
==================================================================================
* Speaker : [Rodrigo Gonçalves](https://pixels.camp/pragmapilot)
* Length : 45m
* Language : English
Description
-----------
Being a solid SW Engineer is much more than just writing good code, knowing the latest languages or be aware of the hottest trends. Your career goals and the companies you work for also shape your future as they define much of the path you'll thread. There's always something to be learned with everyone that crosses your path with or in your current role. Sometimes these lessons aren't easy on us or the ones we'd like to learn but there's certainly virtue in accepting with grace and gratitude.
Speaker Bio
-----------
**Rodrigo Gonçalves**

12y of experience Software Engineer turned into Engineering Manager. Past lifes in iOS, Android, Web, APIs and desktop systems. INFJ, people lover, perpetual learner and true believer in the human ability of growing and improving.
Links
-----
* Company: https://www.talkdesk.com/
* GitHub: https://github.com/pragmapilot
Extra Information
-----------------
In this talk I intend to cover other aspects that make a solid Engineer beside the ability to write to code. These include how you communicate, how you empathise, how you understand business decisions, how you ask the right questions and your attitude. I believe in a holistic view of the Software Engineer that is able to face the challenges of career and workability by using his/her entire potential of being a Human Being. Throughout the talk I'll discuss some hard challenges I was faced with during my working experience, tell about how sometimes I thought I had "screwed up big time" only to be able to "connect the dots" some years later. I'll also be sharing some approaches I took to improve myself as an Engineer and how all my tenures in "sometimes-not-so-glamorous" companies help me strengthening my wholeness as an Engineer. Disclaimer: no Human Beings or Companies will be harmed during my presentation.
Click [here][1] to see the full calendar and pick your favorite talks
[1]: https://pixels.camp/schedule/
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace LostFocusSample
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (e.PrelaunchActivated == false)
{
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
| {
"pile_set_name": "Github"
} |
<!--
Copyright (C) 2020 Havoc-OS
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#ffffff"
android:pathData="M17,1.01L7,1C5.9,1 5,1.9 5,3v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2V3C19,1.9 18.1,1.01 17,1.01zM17,21H7l0,-1h10V21zM17,18H7V6h10V18zM17,4H7V3h10V4z"/>
<path
android:strokeColor="#ffffff"
android:strokeWidth="2"
android:strokeMiterLimit="10"
android:pathData="M 9 10 L 15 10" />
<path
android:strokeColor="#ffffff"
android:strokeWidth="2"
android:strokeMiterLimit="10"
android:pathData="M 13.9 14 L 10 14" />
</vector>
| {
"pile_set_name": "Github"
} |
var commonTools = require('../base/commonTools');
module.exports = {
'leaflet_tiandituLayer_mercator': function (browser) {
browser.windowMaximize();
var type = 'leaflet';
var exampleName = 'tiandituLayer_mercator';
commonTools.openExampleAndLoadMap(browser, type, exampleName);
//测试过程中截取地图瓦片, 和已有的标准瓦片进行对比
commonTools.cmpTestTileWithStdTile(browser, type, exampleName, 0, 0, 128, 128);
////验证版权跳转正确性
////iClient logo
//browser.useXpath().click('//*[@id="map"]/div[2]/div[4]/div[1]/a');
//browser.pause(1000);
//browser.windowHandles(function (result) {
// browser.switchWindow(result.value[1]);
// browser.assert.urlEquals('https://iclient.supermap.io/');
// browser.closeWindow();
// browser.switchWindow(result.value[0]);
// browser.pause(1000);
//});
////天地图
//browser.useXpath().click('//*[@id="map"]/div[2]/div[4]/div[2]/a[2]');
//browser.pause(1000);
//browser.windowHandles(function (result) {
// browser.switchWindow(result.value[1]);
// browser.assert.urlEquals('http://www.tianditu.com/');
// browser.closeWindow();
// browser.switchWindow(result.value[0]);
// browser.pause(1000);
//});
////SuperMap iClient
//browser.useXpath().click('//*[@id="map"]/div[2]/div[4]/div[2]/span/a');
//browser.pause(1000);
//browser.windowHandles(function (result) {
// browser.switchWindow(result.value[1]);
// browser.assert.urlEquals('https://iclient.supermap.io/');
// browser.closeWindow();
// browser.switchWindow(result.value[0]);
//});
browser.pause(1000);
browser.end();
}
};
| {
"pile_set_name": "Github"
} |
# -*- coding: iso-8859-1 -*-
# pysqlite2/dbapi2.py: the DB-API 2.0 interface
#
# Copyright (C) 2004-2005 Gerhard Häring <[email protected]>
#
# This file is part of pysqlite.
#
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not
# claim that you wrote the original software. If you use this software
# in a product, an acknowledgment in the product documentation would be
# appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source distribution.
import datetime
import time
from _sqlite3 import *
paramstyle = "qmark"
threadsafety = 1
apilevel = "2.0"
Date = datetime.date
Time = datetime.time
Timestamp = datetime.datetime
def DateFromTicks(ticks):
return Date(*time.localtime(ticks)[:3])
def TimeFromTicks(ticks):
return Time(*time.localtime(ticks)[3:6])
def TimestampFromTicks(ticks):
return Timestamp(*time.localtime(ticks)[:6])
version_info = tuple([int(x) for x in version.split(".")])
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
Binary = buffer
def register_adapters_and_converters():
def adapt_date(val):
return val.isoformat()
def adapt_datetime(val):
return val.isoformat(" ")
def convert_date(val):
return datetime.date(*map(int, val.split("-")))
def convert_timestamp(val):
datepart, timepart = val.split(" ")
year, month, day = map(int, datepart.split("-"))
timepart_full = timepart.split(".")
hours, minutes, seconds = map(int, timepart_full[0].split(":"))
if len(timepart_full) == 2:
microseconds = int('{:0<6.6}'.format(timepart_full[1].decode()))
else:
microseconds = 0
val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds)
return val
register_adapter(datetime.date, adapt_date)
register_adapter(datetime.datetime, adapt_datetime)
register_converter("date", convert_date)
register_converter("timestamp", convert_timestamp)
register_adapters_and_converters()
# Clean up namespace
del(register_adapters_and_converters)
| {
"pile_set_name": "Github"
} |
<?php
namespace Illuminate\View\Compilers\Concerns;
trait CompilesHelpers
{
/**
* Compile the CSRF statements into valid PHP.
*
* @return string
*/
protected function compileCsrf()
{
return '<?php echo csrf_field(); ?>';
}
/**
* Compile the "dd" statements into valid PHP.
*
* @param string $arguments
* @return string
*/
protected function compileDd($arguments)
{
return "<?php dd{$arguments}; ?>";
}
/**
* Compile the "dump" statements into valid PHP.
*
* @param string $arguments
* @return string
*/
protected function compileDump($arguments)
{
return "<?php dump{$arguments}; ?>";
}
/**
* Compile the method statements into valid PHP.
*
* @param string $method
* @return string
*/
protected function compileMethod($method)
{
return "<?php echo method_field{$method}; ?>";
}
}
| {
"pile_set_name": "Github"
} |
"use strict";
const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const impl = utils.implSymbol;
const HTMLElement = require("./HTMLElement.js");
function HTMLSpanElement() {
throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLSpanElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLSpanElement, HTMLElement.interface);
Object.defineProperty(HTMLSpanElement, "prototype", {
value: HTMLSpanElement.prototype,
writable: false,
enumerable: false,
configurable: false
});
Object.defineProperty(HTMLSpanElement.prototype, Symbol.toStringTag, {
value: "HTMLSpanElement",
writable: false,
enumerable: false,
configurable: true
});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own `.is()`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
// implementing this mixin interface.
_mixedIntoPredicates: [],
is(obj) {
if (obj) {
if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
return true;
}
for (const isMixedInto of module.exports._mixedIntoPredicates) {
if (isMixedInto(obj)) {
return true;
}
}
}
return false;
},
isImpl(obj) {
if (obj) {
if (obj instanceof Impl.implementation) {
return true;
}
const wrapper = utils.wrapperForImpl(obj);
for (const isMixedInto of module.exports._mixedIntoPredicates) {
if (isMixedInto(wrapper)) {
return true;
}
}
}
return false;
},
convert(obj, { context = "The provided value" } = {}) {
if (module.exports.is(obj)) {
return utils.implForWrapper(obj);
}
throw new TypeError(`${context} is not of type 'HTMLSpanElement'.`);
},
create(constructorArgs, privateData) {
let obj = Object.create(HTMLSpanElement.prototype);
obj = this.setup(obj, constructorArgs, privateData);
return obj;
},
createImpl(constructorArgs, privateData) {
let obj = Object.create(HTMLSpanElement.prototype);
obj = this.setup(obj, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
HTMLElement._internalSetup(obj);
},
setup(obj, constructorArgs, privateData) {
if (!privateData) privateData = {};
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(constructorArgs, privateData),
writable: false,
enumerable: false,
configurable: true
});
obj[impl][utils.wrapperSymbol] = obj;
if (Impl.init) {
Impl.init(obj[impl], privateData);
}
return obj;
},
interface: HTMLSpanElement,
expose: {
Window: { HTMLSpanElement }
}
}; // iface
module.exports = iface;
const Impl = require("../nodes/HTMLSpanElement-impl.js");
| {
"pile_set_name": "Github"
} |
# 2005 November 30
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# This file contains test cases focused on the two memory-management APIs,
# sqlite3_soft_heap_limit() and sqlite3_release_memory().
#
# Prior to version 3.6.2, calling sqlite3_release_memory() or exceeding
# the configured soft heap limit could cause sqlite to upgrade database
# locks and flush dirty pages to the file system. As of 3.6.2, this is
# no longer the case. In version 3.6.2, sqlite3_release_memory() only
# reclaims clean pages. This test file has been updated accordingly.
#
# $Id: malloc5.test,v 1.22 2009/04/11 19:09:54 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
source $testdir/malloc_common.tcl
db close
# Only run these tests if memory debugging is turned on.
#
if {!$MEMDEBUG} {
puts "Skipping malloc5 tests: not compiled with -DSQLITE_MEMDEBUG..."
finish_test
return
}
# Skip these tests if OMIT_MEMORY_MANAGEMENT was defined at compile time.
ifcapable !memorymanage {
finish_test
return
}
# The sizes of memory allocations from system malloc() might vary,
# depending on the memory allocator algorithms used. The following
# routine is designed to support answers that fall within a range
# of values while also supplying easy-to-understand "expected" values
# when errors occur.
#
proc value_in_range {target x args} {
set v [lindex $args 0]
if {$v!=""} {
if {$v<$target*$x} {return $v}
if {$v>$target/$x} {return $v}
}
return "number between [expr {int($target*$x)}] and [expr {int($target/$x)}]"
}
set mrange 0.98 ;# plus or minus 2%
test_set_config_pagecache 0 100
sqlite3_soft_heap_limit 0
sqlite3 db test.db
# db eval {PRAGMA cache_size=1}
do_test malloc5-1.1 {
# Simplest possible test. Call sqlite3_release_memory when there is exactly
# one unused page in a single pager cache. The page cannot be freed, as
# it is dirty. So sqlite3_release_memory() returns 0.
#
execsql {
PRAGMA auto_vacuum=OFF;
BEGIN;
CREATE TABLE abc(a, b, c);
}
sqlite3_release_memory
} {0}
do_test malloc5-1.2 {
# Test that the transaction started in the above test is still active.
# The lock on the database file should not have been upgraded (this was
# not the case before version 3.6.2).
#
sqlite3 db2 test.db
execsql {PRAGMA cache_size=2; SELECT * FROM sqlite_master } db2
} {}
do_test malloc5-1.3 {
# Call [sqlite3_release_memory] when there is exactly one unused page
# in the cache belonging to db2.
#
set ::pgalloc [sqlite3_release_memory]
value_in_range 1288 0.75
} [value_in_range 1288 0.75]
do_test malloc5-1.4 {
# Commit the transaction and open a new one. Read 1 page into the cache.
# Because the page is not dirty, it is eligible for collection even
# before the transaction is concluded.
#
execsql {
COMMIT;
BEGIN;
SELECT * FROM abc;
}
value_in_range $::pgalloc $::mrange [sqlite3_release_memory]
} [value_in_range $::pgalloc $::mrange]
do_test malloc5-1.5 {
# Conclude the transaction opened in the previous [do_test] block. This
# causes another page (page 1) to become eligible for recycling.
#
execsql { COMMIT }
value_in_range $::pgalloc $::mrange [sqlite3_release_memory]
} [value_in_range $::pgalloc $::mrange]
do_test malloc5-1.6 {
# Manipulate the cache so that it contains two unused pages. One requires
# a journal-sync to free, the other does not.
db2 close
execsql {
BEGIN;
CREATE TABLE def(d, e, f);
SELECT * FROM abc;
}
value_in_range $::pgalloc $::mrange [sqlite3_release_memory 500]
} [value_in_range $::pgalloc $::mrange]
do_test malloc5-1.7 {
# Database should not be locked this time.
sqlite3 db2 test.db
catchsql { SELECT * FROM abc } db2
} {0 {}}
do_test malloc5-1.8 {
# Try to release another block of memory. This will fail as the only
# pages currently in the cache are dirty (page 3) or pinned (page 1).
db2 close
sqlite3_release_memory 500
} 0
do_test malloc5-1.8 {
# Database is still not locked.
#
sqlite3 db2 test.db
catchsql { SELECT * FROM abc } db2
} {0 {}}
do_test malloc5-1.9 {
execsql {
COMMIT;
}
} {}
do_test malloc5-2.1 {
# Put some data in tables abc and def. Both tables are still wholly
# contained within their root pages.
execsql {
INSERT INTO abc VALUES(1, 2, 3);
INSERT INTO abc VALUES(4, 5, 6);
INSERT INTO def VALUES(7, 8, 9);
INSERT INTO def VALUES(10,11,12);
}
} {}
do_test malloc5-2.2 {
# Load the root-page for table def into the cache. Then query table abc.
# Halfway through the query call sqlite3_release_memory(). The goal of this
# test is to make sure we don't free pages that are in use (specifically,
# the root of table abc).
sqlite3_release_memory
set nRelease 0
execsql {
BEGIN;
SELECT * FROM def;
}
set data [list]
db eval {SELECT * FROM abc} {
incr nRelease [sqlite3_release_memory]
lappend data $a $b $c
}
execsql {
COMMIT;
}
value_in_range $::pgalloc $::mrange $nRelease
} [value_in_range $::pgalloc $::mrange]
do_test malloc5-2.2.1 {
set data
} {1 2 3 4 5 6}
do_test malloc5-3.1 {
# Simple test to show that if two pagers are opened from within this
# thread, memory is freed from both when sqlite3_release_memory() is
# called.
execsql {
BEGIN;
SELECT * FROM abc;
}
execsql {
SELECT * FROM sqlite_master;
BEGIN;
SELECT * FROM def;
} db2
value_in_range [expr $::pgalloc*2] 0.99 [sqlite3_release_memory]
} [value_in_range [expr $::pgalloc * 2] 0.99]
do_test malloc5-3.2 {
concat \
[execsql {SELECT * FROM abc; COMMIT}] \
[execsql {SELECT * FROM def; COMMIT} db2]
} {1 2 3 4 5 6 7 8 9 10 11 12}
db2 close
puts "Highwater mark: [sqlite3_memory_highwater]"
# The following two test cases each execute a transaction in which
# 10000 rows are inserted into table abc. The first test case is used
# to ensure that more than 1MB of dynamic memory is used to perform
# the transaction.
#
# The second test case sets the "soft-heap-limit" to 100,000 bytes (0.1 MB)
# and tests to see that this limit is not exceeded at any point during
# transaction execution.
#
# Before executing malloc5-4.* we save the value of the current soft heap
# limit in variable ::soft_limit. The original value is restored after
# running the tests.
#
set ::soft_limit [sqlite3_soft_heap_limit -1]
execsql {PRAGMA cache_size=2000}
do_test malloc5-4.1 {
execsql {BEGIN;}
execsql {DELETE FROM abc;}
for {set i 0} {$i < 10000} {incr i} {
execsql "INSERT INTO abc VALUES($i, $i, '[string repeat X 100]');"
}
execsql {COMMIT;}
db cache flush
sqlite3_release_memory
sqlite3_memory_highwater 1
execsql {SELECT * FROM abc}
set nMaxBytes [sqlite3_memory_highwater 1]
puts -nonewline " (Highwater mark: $nMaxBytes) "
expr $nMaxBytes > 1000000
} {1}
do_test malloc5-4.2 {
db eval {PRAGMA cache_size=1}
db cache flush
sqlite3_release_memory
sqlite3_soft_heap_limit 200000
sqlite3_memory_highwater 1
execsql {SELECT * FROM abc}
set nMaxBytes [sqlite3_memory_highwater 1]
puts -nonewline " (Highwater mark: $nMaxBytes) "
expr $nMaxBytes <= 210000
} {1}
do_test malloc5-4.3 {
# Check that the content of table abc is at least roughly as expected.
execsql {
SELECT count(*), sum(a), sum(b) FROM abc;
}
} [list 10000 [expr int(10000.0 * 4999.5)] [expr int(10000.0 * 4999.5)]]
# Restore the soft heap limit.
sqlite3_soft_heap_limit $::soft_limit
# Test that there are no problems calling sqlite3_release_memory when
# there are open in-memory databases.
#
# At one point these tests would cause a seg-fault.
#
do_test malloc5-5.1 {
db close
sqlite3 db :memory:
execsql {
BEGIN;
CREATE TABLE abc(a, b, c);
INSERT INTO abc VALUES('abcdefghi', 1234567890, NULL);
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
INSERT INTO abc SELECT * FROM abc;
}
sqlite3_release_memory
} 0
do_test malloc5-5.2 {
sqlite3_soft_heap_limit 5000
execsql {
COMMIT;
PRAGMA temp_store = memory;
SELECT * FROM abc ORDER BY a;
}
expr 1
} {1}
sqlite3_soft_heap_limit $::soft_limit
#-------------------------------------------------------------------------
# The following test cases (malloc5-6.*) test the new global LRU list
# used to determine the pages to recycle when sqlite3_release_memory is
# called and there is more than one pager open.
#
proc nPage {db} {
set bt [btree_from_db $db]
array set stats [btree_pager_stats $bt]
set stats(page)
}
db close
forcedelete test.db test.db-journal test2.db test2.db-journal
# This block of test-cases (malloc5-6.1.*) prepares two database files
# for the subsequent tests.
do_test malloc5-6.1.1 {
sqlite3 db test.db
execsql {
PRAGMA page_size=1024;
PRAGMA default_cache_size=2;
}
execsql {
PRAGMA temp_store = memory;
BEGIN;
CREATE TABLE abc(a PRIMARY KEY, b, c);
INSERT INTO abc VALUES(randstr(50,50), randstr(75,75), randstr(100,100));
INSERT INTO abc
SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc;
INSERT INTO abc
SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc;
INSERT INTO abc
SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc;
INSERT INTO abc
SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc;
INSERT INTO abc
SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc;
INSERT INTO abc
SELECT randstr(50,50), randstr(75,75), randstr(100,100) FROM abc;
COMMIT;
}
forcecopy test.db test2.db
sqlite3 db2 test2.db
db2 eval {PRAGMA cache_size=2}
list \
[expr ([file size test.db]/1024)>20] [expr ([file size test2.db]/1024)>20]
} {1 1}
do_test malloc5-6.1.2 {
list [execsql {PRAGMA cache_size}] [execsql {PRAGMA cache_size} db2]
} {2 2}
do_test malloc5-6.2.1 {
execsql {SELECT * FROM abc} db2
execsql {SELECT * FROM abc} db
expr [nPage db] + [nPage db2]
} {4}
do_test malloc5-6.2.2 {
# If we now try to reclaim some memory, it should come from the db2 cache.
sqlite3_release_memory 3000
expr [nPage db] + [nPage db2]
} {1}
do_test malloc5-6.2.3 {
# Access the db2 cache again, so that all the db2 pages have been used
# more recently than all the db pages. Then try to reclaim 3000 bytes.
# This time, 3 pages should be pulled from the db cache.
execsql { SELECT * FROM abc } db2
sqlite3_release_memory 3000
expr [nPage db] + [nPage db2]
} {0}
do_test malloc5-6.3.1 {
# Now open a transaction and update 2 pages in the db2 cache. Then
# do a SELECT on the db cache so that all the db pages are more recently
# used than the db2 pages. When we try to free memory, SQLite should
# free the non-dirty db2 pages, then the db pages, then finally use
# sync() to free up the dirty db2 pages. The only page that cannot be
# freed is page1 of db2. Because there is an open transaction, the
# btree layer holds a reference to page 1 in the db2 cache.
#
# UPDATE: No longer. As release_memory() does not cause a sync()
execsql {
BEGIN;
UPDATE abc SET c = randstr(100,100)
WHERE rowid = 1 OR rowid = (SELECT max(rowid) FROM abc);
} db2
execsql { SELECT * FROM abc } db
expr [nPage db] + [nPage db2]
} {4}
do_test malloc5-6.3.2 {
# Try to release 7700 bytes. This should release all the
# non-dirty pages held by db2.
sqlite3_release_memory [expr 7*1132]
list [nPage db] [nPage db2]
} {0 3}
do_test malloc5-6.3.3 {
# Try to release another 1000 bytes. This should come fromt the db
# cache, since all three pages held by db2 are either in-use or diry.
sqlite3_release_memory 1000
list [nPage db] [nPage db2]
} {0 3}
do_test malloc5-6.3.4 {
# Now release 9900 more (about 9 pages worth). This should expunge
# the rest of the db cache. But the db2 cache remains intact, because
# SQLite tries to avoid calling sync().
if {$::tcl_platform(wordSize)==8} {
sqlite3_release_memory 10500
} else {
sqlite3_release_memory 9900
}
list [nPage db] [nPage db2]
} {0 3}
do_test malloc5-6.3.5 {
# But if we are really insistent, SQLite will consent to call sync()
# if there is no other option. UPDATE: As of 3.6.2, SQLite will not
# call sync() in this scenario. So no further memory can be reclaimed.
sqlite3_release_memory 1000
list [nPage db] [nPage db2]
} {0 3}
do_test malloc5-6.3.6 {
# The referenced page (page 1 of the db2 cache) will not be freed no
# matter how much memory we ask for:
sqlite3_release_memory 31459
list [nPage db] [nPage db2]
} {0 3}
db2 close
sqlite3_soft_heap_limit $::soft_limit
test_restore_config_pagecache
finish_test
catch {db close}
| {
"pile_set_name": "Github"
} |
gtk-color-scheme = "base_color: #000000"
gtk-color-scheme = "text_color: #ffffff"
gtk-color-scheme = "bg_color: #0d0d0d"
gtk-color-scheme = "fg_color: #ffffff"
gtk-color-scheme = "tooltip_bg_color: #4B5162"
gtk-color-scheme = "tooltip_fg_color: #ffffff"
gtk-color-scheme = "selected_bg_color: #367bf0"
gtk-color-scheme = "selected_fg_color: #ffffff"
gtk-color-scheme = "insensitive_bg_color: #000000"
gtk-color-scheme = "insensitive_fg_color: #787878"
gtk-color-scheme = "notebook_bg: #000000"
gtk-color-scheme = "dark_sidebar_bg: #000000"
gtk-color-scheme = "link_color: #367bf0"
gtk-color-scheme = "menu_bg: #000000"
gtk-icon-sizes = "gtk-button=15,15" # This makes button icons smaller.
gtk-enable-mnemonics = 0
gtk-primary-button-warps-slider = 1
include "main.rc"
include "menubar-toolbar/menubar-toolbar-darkest.rc"
| {
"pile_set_name": "Github"
} |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""A stand-alone example for tf.learn's random forest model on mnist."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.estimators import random_forest
from tensorflow.examples.tutorials.mnist import input_data
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_string('model_dir', '', 'Base directory for output models.')
flags.DEFINE_string('data_dir', '/tmp/data/', 'Directory for storing data')
flags.DEFINE_integer('train_steps', 1000, 'Number of training steps.')
flags.DEFINE_string('batch_size', 1000,
'Number of examples in a training batch.')
flags.DEFINE_integer('num_trees', 100, 'Number of trees in the forest.')
flags.DEFINE_integer('max_nodes', 1000, 'Max total nodes in a single tree.')
def build_estimator(model_dir):
"""Build an estimator."""
params = tf.contrib.tensor_forest.python.tensor_forest.ForestHParams(
num_classes=10, num_features=784,
num_trees=FLAGS.num_trees, max_nodes=FLAGS.max_nodes)
return random_forest.TensorForestEstimator(params, model_dir=model_dir)
def train_and_eval():
"""Train and evaluate the model."""
model_dir = tempfile.mkdtemp() if not FLAGS.model_dir else FLAGS.model_dir
print('model directory = %s' % model_dir)
estimator = build_estimator(model_dir)
# TensorForest's LossMonitor allows training to terminate early if the
# forest is no longer growing.
early_stopping_rounds = 100
check_every_n_steps = 100
monitor = random_forest.LossMonitor(early_stopping_rounds,
check_every_n_steps)
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=False)
estimator.fit(x=mnist.train.images, y=mnist.train.labels,
batch_size=FLAGS.batch_size, monitors=[monitor])
results = estimator.evaluate(x=mnist.test.images, y=mnist.test.labels,
batch_size=FLAGS.batch_size)
for key in sorted(results):
print('%s: %s' % (key, results[key]))
def main(_):
train_and_eval()
if __name__ == '__main__':
tf.app.run()
| {
"pile_set_name": "Github"
} |
// <eddie_source_header>
// This file is part of Eddie/AirVPN software.
// Copyright (C)2014-2019 AirVPN ([email protected]) / https://airvpn.org
//
// Eddie 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.
//
// Eddie 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 Eddie. If not, see <http://www.gnu.org/licenses/>.
// </eddie_source_header>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using Eddie.Core;
namespace Eddie.Forms.Skin
{
public class SkinReference
{
private static XmlElement m_xmlSkin;
private static Dictionary<string, Font> GdiCacheFonts = new Dictionary<string, Font>();
private static Dictionary<string, Brush> GdiCacheBrushes = new Dictionary<string, Brush>();
private static Dictionary<string, Pen> GdiCachePens = new Dictionary<string, Pen>();
private static Dictionary<string, Color> GdiCacheColors = new Dictionary<string, Color>();
public string Name
{
get
{
if (m_xmlSkin == null)
return "None";
else
return m_xmlSkin.Name;
}
}
public static void Load(string name)
{
LoadXml(name, Eddie.Forms.Properties.Resources.skins);
}
public static void LoadXml(string name, string xml)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
m_xmlSkin = xmlDoc.DocumentElement.SelectSingleNode(name) as XmlElement;
}
public string GetStyle()
{
string style = m_xmlSkin.GetAttribute("style");
return style;
}
public string GetItem(string name)
{
if (m_xmlSkin == null) // Designer
{
Load("Light");
//LoadXml("Light", DesignerSkin);
}
XmlElement xmlElement = m_xmlSkin.SelectSingleNode(name) as XmlElement;
return xmlElement.InnerText;
}
public Font GetFont(string name)
{
string value = GetItem(name);
return GetFontEx(value);
}
public Brush GetBrush(string name)
{
string value = GetItem(name);
return GetBrushEx(value);
}
public Pen GetPen(string name)
{
string value = GetItem(name);
return GetPenEx(value);
}
public Color GetColor(string name)
{
string value = GetItem(name);
return GetColorEx(value);
}
public void ClearFontCache()
{
GdiCacheFonts.Clear();
}
public Font GetFontEx(string name)
{
if (GdiCacheFonts.ContainsKey(name))
return GdiCacheFonts[name];
else
{
string fontName = name;
string fontSize = "";
if (name.IndexOf(',') != -1)
{
fontName = name.Substring(0, name.IndexOf(',')).Trim();
fontSize = name.Substring(name.IndexOf(',') + 1).Trim();
}
double userBaseSize = 0;
if ((Engine.Instance != null) && (Engine.Instance.Storage != null))
userBaseSize = Engine.Instance.Storage.GetFloat("gui.font.normal.size");
if (userBaseSize == 0)
{
string systemFont = GuiUtils.GetSystemFont();
int posSize = systemFont.IndexOf(",");
string strSize = systemFont.Substring(posSize + 1);
if (posSize != -1)
double.TryParse(strSize, out userBaseSize);
if (userBaseSize == 0)
userBaseSize = 10;
}
if ((fontName == "System") || (fontName == "SystemMonospace"))
{
string systemFont = "";
if (fontName == "System")
{
if ((Engine.Instance != null) && (Engine.Instance.Storage != null) && (Engine.Instance.Storage.Get("gui.font.normal.name") != ""))
systemFont = Engine.Instance.Storage.Get("gui.font.normal.name");
else
systemFont = GuiUtils.GetSystemFont();
}
else if (fontName == "SystemMonospace")
systemFont = GuiUtils.GetSystemFontMonospace();
int posSize = systemFont.IndexOf(",");
if (posSize != -1)
systemFont = systemFont.Substring(0, posSize);
fontName = systemFont;
}
if (fontSize == "normal")
fontSize = userBaseSize.ToString(CultureInfo.InvariantCulture) + "pt";
else if (fontSize == "big")
fontSize = (userBaseSize * 1.25).ToString(CultureInfo.InvariantCulture) + "pt";
else if (fontSize == "small")
fontSize = (userBaseSize / 1.25).ToString(CultureInfo.InvariantCulture) + "pt";
string name2 = fontName + "," + fontSize;
FontConverter fontConverter = new FontConverter();
Font f = fontConverter.ConvertFromInvariantString(name2) as Font;
GdiCacheFonts[name] = f;
return f;
}
}
public Brush GetBrushEx(string value)
{
if (GdiCacheBrushes.ContainsKey(value))
return GdiCacheBrushes[value];
else
{
Brush b = null;
b = new SolidBrush(GetColorEx(value));
GdiCacheBrushes[value] = b;
return b;
}
}
public Pen GetPenEx(string value)
{
if (GdiCachePens.ContainsKey(value))
return GdiCachePens[value];
else
{
Pen p = new Pen(GetColorEx(value));
GdiCachePens[value] = p;
return p;
}
}
public Color GetColorEx(string value)
{
if (GdiCacheColors.ContainsKey(value))
return GdiCacheColors[value];
else
{
Color c = System.Drawing.ColorTranslator.FromHtml(value);
GdiCacheColors[value] = c;
return c;
}
}
public virtual void Apply(Control c)
{
c.Font = FontNormal;
if (c is Skin.CheckBox)
{
Skin.CheckBox c2 = c as Skin.CheckBox;
c2.BackColor = Color.Transparent;
c2.ForeColor = ForeColor;
if (GetStyle() == "flat")
c2.FlatStyle = FlatStyle.Flat;
else
c2.FlatStyle = FlatStyle.Standard;
}
if (c is Skin.ComboBox)
{
Skin.ComboBox c2 = c as Skin.ComboBox;
c2.BackColor = BackColor;
c2.ForeColor = ForeColor;
if (GetStyle() == "flat")
c2.FlatStyle = FlatStyle.Flat;
else
c2.FlatStyle = FlatStyle.Standard;
}
if (c is Skin.TextBox)
{
Skin.TextBox c2 = c as Skin.TextBox;
if (c2.ReadOnly)
c2.BackColor = ReadOnlyBackColor;
else
c2.BackColor = BackColor;
c2.ForeColor = ForeColor;
if (GetStyle() == "flat")
c2.BorderStyle = BorderStyle.FixedSingle;
else
c2.BorderStyle = BorderStyle.Fixed3D;
}
if (c is Skin.Label)
{
}
if (c is Skin.RadioButton)
{
Skin.RadioButton c2 = c as Skin.RadioButton;
c2.BackColor = Color.Transparent;
c2.ForeColor = ForeColor;
if (GetStyle() == "flat")
c2.FlatStyle = FlatStyle.Flat;
else
c2.FlatStyle = FlatStyle.Standard;
}
if (c is Skin.LinkLabel)
{
Skin.LinkLabel c2 = c as Skin.LinkLabel;
c2.BackColor = Color.Transparent;
c2.ForeColor = HyperLinkForeColor;
//c2.ActiveLinkColor = HyperLinkColor;
//c2.LinkColor = HyperLinkColor;
//c2.VisitedLinkColor = HyperLinkColor;
}
if (c is Skin.TabPage)
{
Skin.TabPage c2 = c as Skin.TabPage;
c2.BackColor = Color.Transparent;
}
if (c is Skin.ListView)
{
Skin.ListView c2 = c as Skin.ListView;
c2.BackColor = BackColor;
c2.ForeColor = ForeColor;
if (GetStyle() == "flat")
c2.BorderStyle = BorderStyle.FixedSingle;
else
c2.BorderStyle = BorderStyle.Fixed3D;
}
if (c is Skin.Button)
{
Skin.Button c2 = c as Skin.Button;
c2.ForeColor = ForeColor;
//c2.UpdateBackground();
}
if (c is System.Windows.Forms.ContextMenuStrip)
{
System.Windows.Forms.ContextMenuStrip c2 = c as System.Windows.Forms.ContextMenuStrip;
foreach (System.Windows.Forms.ToolStripItem i in c2.Items)
{
if (Platform.IsUnix())
{
// Fix Mono colors issue (for example Arch with dark theme)
if (i.ForeColor == SystemColors.ControlText)
i.ForeColor = Color.Black;
if (i.BackColor == SystemColors.Control)
i.BackColor = Color.White;
}
}
}
foreach (Control sc in c.Controls)
{
Apply(sc);
}
c.Invalidate();
}
public virtual Color ForeColor
{
get
{
return GetColor("color.foreground");
}
}
public virtual Color BackColor
{
get
{
return GetColor("color.background");
}
}
public virtual Color ReadOnlyBackColor
{
get
{
return GetColor("color.readonly.background");
}
}
public virtual Color HyperLinkForeColor
{
get
{
return GetColor("color.hyperlink.normal.foreground");
}
}
public virtual Color HyperLinkHoverForeColor
{
get
{
return GetColor("color.hyperlink.hover.foreground");
}
}
public virtual Color HyperLinkBackColor
{
get
{
return GetColor("color.hyperlink.normal.background");
}
}
public virtual Color HyperLinkHoverBackColor
{
get
{
return GetColor("color.hyperlink.hover.background");
}
}
public virtual Brush ForeBrush
{
get
{
return GetBrush("color.foreground");
}
}
public virtual Brush BackDisabledBrush
{
get
{
return GetBrush("color.disabled.background");
}
}
public virtual Brush ForeDisabledBrush
{
get
{
return GetBrush("color.disabled.foreground");
}
}
public virtual Brush ListViewDisabledBackBrush
{
get
{
return GetBrush("color.grid.disabled.background");
}
}
public virtual Brush ListViewNormalBackBrush
{
get
{
return GetBrush("color.grid.item1.background");
}
}
public virtual Brush ListViewNormal2BackBrush
{
get
{
return GetBrush("color.grid.item2.background");
}
}
public virtual Brush ListViewSelectedBackBrush
{
get
{
return GetBrush("color.grid.selected.background");
}
}
public virtual Brush ListViewFocusedBackBrush
{
get
{
return GetBrush("color.grid.focus.background");
}
}
public virtual Pen ListViewGridPen
{
get
{
return GetPen("color.grid.border");
}
}
public virtual Image FormBackgroundImage
{
get
{
return GuiUtils.GetResourceImage("form_l_bg");
}
}
public virtual Image ButtonNormalImage
{
get
{
return GuiUtils.GetResourceImage("btn_l_n");
}
}
public virtual Image ButtonHoverImage
{
get
{
return GuiUtils.GetResourceImage("btn_l_h");
}
}
public virtual Image ButtonDisabledImage
{
get
{
return GuiUtils.GetResourceImage("btn_l_d");
}
}
public virtual Image MainBackImage
{
get
{
return GuiUtils.GetResourceImage("main_l_bg");
}
}
public virtual Font FontNormal
{
get
{
return GetFont("font.normal");
}
}
public virtual Font FontBig
{
get
{
return GetFont("font.big");
}
}
public virtual Font FontMono
{
get
{
return GetFont("font.monospace.normal");
}
}
public virtual Font FontMonoBig
{
get
{
return GetFont("font.monospace.big");
}
}
public virtual Size MenuImageSize
{
get
{
int s = GetFont("font.normal").Height;
if (s < 16)
s = 16;
return new Size(s, s);
}
}
public virtual void GraphicsCommon(Graphics g)
{
if (g.PixelOffsetMode != System.Drawing.Drawing2D.PixelOffsetMode.Half)
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Half;
if (g.InterpolationMode != System.Drawing.Drawing2D.InterpolationMode.Default)
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
}
}
}
| {
"pile_set_name": "Github"
} |
#ifndef _GEM_BDRING_H_
#define _GEM_BDRING_H_
typedef struct _GEM_BD {
BT_u32 address;
#define RX_BD_ADDRESS 0xFFFFFFFC
#define RX_BD_WRAP 0x00000002
#define RX_BD_OWNERSHIP 0x00000001
#define TX_BD_ADDRESS RX_BD_ADDRESS
BT_u32 flags;
#define TX_BD_USED 0x80000000
#define TX_BD_WRAP 0x40000000
#define TX_BD_LAST 0x00008000
#define TX_BD_LENGTH 0x00003FFF
#define RX_BD_BROADCAST 0x80000000
#define RX_BD_MULTICAST 0x40000000
#define RX_BD_UNICAST 0x20000000
#define RX_BD_EXTERNAL 0x10000000
#define RX_BD_MATCH_REG 0x06000000
#define RX_BD_SNAP 0x01000000
#define RX_BD_CANON 0x00010000
#define RX_BD_EOF 0x00008000
#define RX_BD_SOF 0x00004000
#define RX_BD_LENGTH 0x00001FFF
} GEM_BD;
typedef struct _GEM_BDRING {
BT_u32 phys_base;
BT_u32 virt_base;
BT_u32 virt_end;
BT_u32 length;
BT_u32 state;
#define BDRING_STATE_RUNNING 0x00000001
BT_u32 bd_size; ///< Size of a single BD.
GEM_BD *free_head; ///< Pointer to first BD in the free list.
GEM_BD *pre_head; ///< Pointer to the pre-work group.
GEM_BD *work_head; ///< Pointer to the work group.
GEM_BD *post_head; ///< Pointer to the post work group.
GEM_BD *bda_restart; ///< BDA to load when restarting a channel.
BT_u32 free_count;
BT_u32 pre_count;
BT_u32 work_count;
BT_u32 post_count;
BT_u32 total_bds; ///< Total number of buffer descriptoers for a channel.
} GEM_BDRING;
typedef struct _GEM_REGS {
BT_u32 net_ctrl;
#define NET_CTRL_LOOPEN 0x00000002
#define NET_CTRL_RXEN 0x00000004
#define NET_CTRL_TXEN 0x00000008
#define NET_CTRL_MDEN 0x00000010
#define NET_CTRL_STATCLR 0x00000020
#define NET_CTRL_STATINC 0x00000040
#define NET_CTRL_STATWEN 0x00000080
#define NET_CTRL_BACKPRESS 0x00000100
#define NET_CTRL_STARTTX 0x00000200
#define NET_CTRL_HALTTX 0x00000400
#define NET_CTRL_PAUSETX 0x00000800
#define NET_CTRL_ZEROPAUSETX 0x00001000
#define NET_CTRL_STRRXTS 0x00008000
#define NET_CTRL_ENPFCPRIPAUSERX 0x00010000
#define NET_CTRL_TXPFCPRIPAUSEFRM 0x00020000
#define NET_CTRL_FLUSHNEXTRXDPRMPKT 0x00040000
BT_u32 net_cfg;
#define NET_CFG_SPEED 0x00000001
#define NET_CFG_FDEN 0x00000002
#define NET_CFG_NVLANDISC 0x00000004
#define NET_CFG_COPYALLEN 0x00000010
#define NET_CFG_BCASTDI 0x00000020
#define NET_CFG_MCASTHASHEN 0x00000040
#define NET_CFG_UCASTHASHEN 0x00000080
#define NET_CFG_1536RXEN 0x00000100
#define NET_CFG_EXTADDRMATCHEN 0x00000200
#define NET_CFG_GIGEEN 0x00000400
#define NET_CFG_PCS_SEL 0x00000800
#define NET_CFG_RETRY_TEST 0x00001000
#define NET_CFG_PAUSEEN 0x00002000
#define NET_CFG_RXSOFFS 0x0000C000
#define NET_CFG_LENERRDSCRD 0x00010000
#define NET_CFG_FCSREM 0x00020000
#define NET_CFG_MDCCLKDIV 0x001C0000
#define NET_CFG_DBUS_WIDTH 0x00600000
#define NET_CFG_PAUSECOPYDI 0x00800000
#define NET_CFG_RXCHKSUMEN 0x01000000
#define NET_CFG_HDRXEN 0x02000000
#define NET_CFG_FCSIGNORE 0x04000000
#define NET_CFG_SGMII_EN 0x08000000
#define NET_CFG_IPDSTRETCH 0x10000000
#define NET_CFG_BADPREAMBEN 0x20000000
#define NET_IGNORE_IPG_RX_ER 0x40000000
#define NET_IGNORE_UNIDIR_EN 0x80000000
BT_u32 net_status;
#define NET_STATUS_MGMT_IDLE 0x00000004
BT_u32 user_io;
BT_u32 dma_cfg;
#define DMA_CFG_BLENGTH 0x0000001F
#define DMA_CFG_AHB_ENDIAN_MGM_SWP 0x00000040
#define DMA_CFG_AHB_ENDIAN_PKT_SWP 0x00000080
#define DMA_CFG_RXSIZE 0x00000300
#define DMA_CFG_TXSIZE 0x00000400
#define DMA_CFG_TCPCKSUM 0x00000800
#define DMA_CFG_RXBUF 0x00FF0000
#define DMA_CFG_DISC_NO_AHB 0x01000000
BT_u32 tx_status;
BT_u32 rx_qbar;
BT_u32 tx_qbar;
BT_u32 rx_status;
#define RX_STAT_BUFFNA 0x00000001
#define RX_STAT_FRAME_RECD 0x00000002
BT_u32 intr_status;
#define GEM_INT_MGMNT_DONE 0x00000001
#define GEM_INT_RX_COMPLETE 0x00000002
#define GEM_INT_RX_USED 0x00000004
#define GEM_INT_TX_USED 0x00000008
#define GEM_INT_TX_UNDERRUN 0x00000010
#define GEM_INT_EX_LATE_COLLISION 0x00000020
#define GEM_INT_AHB_ERR 0x00000040
#define GEM_INT_TX_COMPLETE 0x00000080
#define GEM_INT_LINK_CHANGE 0x00000200
#define GEM_INT_RX_OVERRUN 0x00000400
#define GEM_INT_HRESP_NOT_OK 0x00000800
#define GEM_INT_PAUSE_NON_ZERO_RX 0x00001000
#define GEM_INT_PAUSE_ZERO 0x00002000
#define GEM_INT_PAUSE_TX 0x00004000
#define GEM_INT_EXT_INTR 0x00008000
#define GEM_INT_AUTONEG_COMPLETE 0x00010000
#define GEM_INT_ALL_MASK 0x03FC7FFE /* Everything except MDIO */
BT_u32 intr_enable;
BT_u32 intr_disable;
BT_u32 intr_mask;
BT_u32 phy_maint;
#define PHY_MAINT_DATA 0x0000FFFF
#define PHY_MAINT_REG_ADDR 0x007C0000
#define PHY_MAINT_PHY_ADDR 0x0F800000
#define PHY_MAINT_OP 0x30000000
#define PHY_MAINT_W_MASK 0x10000000
#define PHY_MAINT_R_MASK 0x20000000
BT_u32 rx_pauseq;
BT_u32 tx_pauseq;
BT_STRUCT_RESERVED_u32(0, 0x3C, 0x80);
BT_u32 hash_bot;
BT_u32 hash_top;
BT_u32 spec_addr1_bot;
BT_u32 spec_addr1_top;
BT_u32 spec_addr2_bot;
BT_u32 spec_addr2_top;
BT_u32 spec_addr3_bot;
BT_u32 spec_addr3_top;
BT_u32 spec_addr4_bot;
BT_u32 spec_addr4_top;
BT_u32 type_id_match1;
BT_u32 type_id_match2;
BT_u32 type_id_match3;
BT_u32 type_id_match4;
BT_u32 wake_on_lan;
BT_u32 ipg_stretch;
BT_u32 stacked_vlan;
BT_u32 tx_pfc_pause;
BT_u32 spec_addr1_mask_bot;
BT_u32 spec_addr1_make_top;
BT_STRUCT_RESERVED_u32(1, 0xCC, 0xFC);
BT_u32 module_id;
BT_u32 octets_tx_bot;
BT_u32 octets_tx_top;
BT_u32 frames_tx;
BT_u32 broadcast_frames_tx;
BT_u32 multi_frames_tx;
BT_u32 pause_frames_tx;
BT_u32 frames_64b_tx;
BT_u32 frames_65to127b_tx;
BT_u32 frames_128to255b_tx;
BT_u32 frames_256to511b_tx;
BT_u32 frames_512to1023_tx;
BT_u32 frames_1024to1518_tx;
BT_u32 tx_under_runs;
BT_u32 single_collisn_frames;
BT_u32 multi_collisn_frames;
BT_u32 excessive_collisns;
BT_u32 late_collisns;
BT_u32 deferred_tx_frames;
BT_u32 carrier_sense_errs;
BT_u32 octets_rx_bot;
BT_u32 octets_rx_top;
BT_u32 frames_rx;
BT_u32 bdcast_frames_rx;
BT_u32 multi_frames_rx;
BT_u32 pause_rx;
BT_u32 frames_64b_rx;
BT_u32 frames_65to127b_rx;
BT_u32 frames_128to255b_rx;
BT_u32 frames_256to511b_rx;
BT_u32 frames_512to1023_rx;
BT_u32 frames_1024to1518_rx;
BT_u32 undersz_rx;
BT_u32 oversz_rx;
BT_u32 jab_rx;
BT_u32 fcs_errors;
BT_u32 length_field_errors;
BT_u32 rx_symbol_errors;
BT_u32 align_errors;
BT_u32 rx_resource_errors;
BT_u32 rx_overrun_errors;
BT_u32 ip_hdr_csum_errors;
BT_u32 tcp_csum_errors;
BT_u32 udp_csum_errors;
BT_STRUCT_RESERVED_u32(2, 0x1B0, 0x1C8);
BT_u32 timer_strobe_s;
BT_u32 timer_stobe_ns;
BT_u32 timer_s;
BT_u32 timer_ns;
BT_u32 timer_adjust;
BT_u32 timer_incr;
BT_u32 ptp_tx_s;
BT_u32 ptp_tx_ns;
BT_u32 ptp_rx_s;
BT_u32 ptp_rx_ns;
BT_u32 ptp_peer_tx_s;
BT_u32 ptp_peer_tx_ns;
BT_u32 ptp_peer_rx_s;
BT_u32 ptp_peer_rx_ns;
BT_STRUCT_RESERVED_u32(3, 0x1FC, 0x284);
BT_u32 design_cfg2;
BT_u32 design_cfg3;
BT_u32 design_cfg4;
BT_u32 design_cfg5;
} GEM_REGS;
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://thelia.net/schema/dic/module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/module http://thelia.net/schema/dic/module/module-2_1.xsd">
<fullnamespace>HookContact\HookContact</fullnamespace>
<descriptive locale="en_US">
<title>Block Contact</title>
</descriptive>
<descriptive locale="fr_FR">
<title>Bloc Contact</title>
</descriptive>
<languages>
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.4.2</version>
<author>
<name>Julien Chanséaume</name>
<email>[email protected]</email>
</author>
<type>classic</type>
<thelia>2.4.2</thelia>
<stability>alpha</stability>
</module>
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "[email protected]"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.engine.rest.impl;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.Response.Status;
import org.camunda.bpm.engine.BadUserRequestException;
import org.camunda.bpm.engine.ExternalTaskService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.batch.Batch;
import org.camunda.bpm.engine.exception.NotFoundException;
import org.camunda.bpm.engine.externaltask.ExternalTask;
import org.camunda.bpm.engine.externaltask.ExternalTaskQuery;
import org.camunda.bpm.engine.externaltask.ExternalTaskQueryBuilder;
import org.camunda.bpm.engine.externaltask.LockedExternalTask;
import org.camunda.bpm.engine.externaltask.UpdateExternalTaskRetriesBuilder;
import org.camunda.bpm.engine.history.HistoricProcessInstanceQuery;
import org.camunda.bpm.engine.rest.ExternalTaskRestService;
import org.camunda.bpm.engine.rest.dto.CountResultDto;
import org.camunda.bpm.engine.rest.dto.batch.BatchDto;
import org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskDto;
import org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto;
import org.camunda.bpm.engine.rest.dto.externaltask.FetchExternalTasksDto;
import org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto;
import org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto;
import org.camunda.bpm.engine.rest.exception.InvalidRequestException;
import org.camunda.bpm.engine.rest.dto.externaltask.LockedExternalTaskDto;
import org.camunda.bpm.engine.rest.dto.externaltask.SetRetriesForExternalTasksDto;
import org.camunda.bpm.engine.rest.sub.externaltask.ExternalTaskResource;
import org.camunda.bpm.engine.rest.sub.externaltask.impl.ExternalTaskResourceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.runtime.ProcessInstanceQuery;
/**
* @author Thorben Lindhauer
*
*/
public class ExternalTaskRestServiceImpl extends AbstractRestProcessEngineAware implements ExternalTaskRestService {
public ExternalTaskRestServiceImpl(String processEngine, ObjectMapper objectMapper) {
super(processEngine, objectMapper);
}
@Override
public List<ExternalTaskDto> getExternalTasks(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
ExternalTaskQueryDto queryDto = new ExternalTaskQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
return queryExternalTasks(queryDto, firstResult, maxResults);
}
@Override
public List<ExternalTaskDto> queryExternalTasks(ExternalTaskQueryDto queryDto, Integer firstResult, Integer maxResults) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
ExternalTaskQuery query = queryDto.toQuery(engine);
List<ExternalTask> matchingTasks;
if (firstResult != null || maxResults != null) {
matchingTasks = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingTasks = query.list();
}
List<ExternalTaskDto> taskResults = new ArrayList<ExternalTaskDto>();
for (ExternalTask task : matchingTasks) {
ExternalTaskDto resultInstance = ExternalTaskDto.fromExternalTask(task);
taskResults.add(resultInstance);
}
return taskResults;
}
protected List<ExternalTask> executePaginatedQuery(ExternalTaskQuery query, Integer firstResult, Integer maxResults) {
if (firstResult == null) {
firstResult = 0;
}
if (maxResults == null) {
maxResults = Integer.MAX_VALUE;
}
return query.listPage(firstResult, maxResults);
}
@Override
public CountResultDto getExternalTasksCount(UriInfo uriInfo) {
ExternalTaskQueryDto queryDto = new ExternalTaskQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
return queryExternalTasksCount(queryDto);
}
@Override
public CountResultDto queryExternalTasksCount(ExternalTaskQueryDto queryDto) {
ProcessEngine engine = getProcessEngine();
queryDto.setObjectMapper(getObjectMapper());
ExternalTaskQuery query = queryDto.toQuery(engine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
@Override
public List<LockedExternalTaskDto> fetchAndLock(FetchExternalTasksDto fetchingDto) {
ExternalTaskQueryBuilder fetchBuilder = fetchingDto.buildQuery(processEngine);
List<LockedExternalTask> externalTasks = fetchBuilder.execute();
return LockedExternalTaskDto.fromLockedExternalTasks(externalTasks);
}
@Override
public ExternalTaskResource getExternalTask(String externalTaskId) {
return new ExternalTaskResourceImpl(getProcessEngine(), externalTaskId, getObjectMapper());
}
@Override
public BatchDto setRetriesAsync(SetRetriesForExternalTasksDto retriesDto) {
UpdateExternalTaskRetriesBuilder builder = updateRetries(retriesDto);
Integer retries = retriesDto.getRetries();
if (retries == null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "The number of retries cannot be null.");
}
try {
Batch batch = builder.setAsync(retries);
return BatchDto.fromBatch(batch);
}
catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
}
catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
@Override
public List<String> getTopicNames(boolean withLockedTasks, boolean withUnlockedTasks,
boolean withRetriesLeft) {
return processEngine.getExternalTaskService()
.getTopicNames(withLockedTasks, withUnlockedTasks, withRetriesLeft);
}
@Override
public void setRetries(SetRetriesForExternalTasksDto retriesDto){
UpdateExternalTaskRetriesBuilder builder = updateRetries(retriesDto);
Integer retries = retriesDto.getRetries();
if (retries == null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "The number of retries cannot be null.");
}
try {
builder.set(retries);
}
catch (NotFoundException e) {
throw new InvalidRequestException(Status.NOT_FOUND, e.getMessage());
}
catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
}
}
protected UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) {
ExternalTaskService externalTaskService = getProcessEngine().getExternalTaskService();
List<String> externalTaskIds = retriesDto.getExternalTaskIds();
List<String> processInstanceIds = retriesDto.getProcessInstanceIds();
ExternalTaskQuery externalTaskQuery = null;
ProcessInstanceQuery processInstanceQuery = null;
HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
ExternalTaskQueryDto externalTaskQueryDto = retriesDto.getExternalTaskQuery();
if (externalTaskQueryDto != null) {
externalTaskQuery = externalTaskQueryDto.toQuery(getProcessEngine());
}
ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.getProcessInstanceQuery();
if (processInstanceQueryDto != null) {
processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
}
HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.getHistoricProcessInstanceQuery();
if (historicProcessInstanceQueryDto != null) {
historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(getProcessEngine());
}
return externalTaskService.updateRetries()
.externalTaskIds(externalTaskIds)
.processInstanceIds(processInstanceIds)
.externalTaskQuery(externalTaskQuery)
.processInstanceQuery(processInstanceQuery)
.historicProcessInstanceQuery(historicProcessInstanceQuery);
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--
* FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2009 Frederico Caldeira Knabben
*
* == BEGIN LICENSE ==
*
* Licensed under the terms of any of the following licenses at your
* choice:
*
* - GNU General Public License Version 2 or later (the "GPL")
* http://www.gnu.org/licenses/gpl.html
*
* - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
* http://www.gnu.org/licenses/lgpl.html
*
* - Mozilla Public License Version 1.1 or later (the "MPL")
* http://www.mozilla.org/MPL/MPL-1.1.html
*
* == END LICENSE ==
*
* Main page that holds the editor.
-->
<html>
<head>
<title>FCKeditor</title>
<meta name="robots" content="noindex, nofollow">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- @Packager.RemoveLine
<meta http-equiv="Cache-Control" content="public">
@Packager.RemoveLine -->
<script type="text/javascript">
// #1645: Alert the user if opening FCKeditor in FF3 from local filesystem
// without security.fileuri.strict_origin_policy disabled.
if ( document.location.protocol == 'file:' )
{
try
{
window.parent.document.domain ;
}
catch ( e )
{
window.addEventListener( 'load', function()
{
document.body.innerHTML = '\
<div style="border: 1px red solid; font-family: arial; font-size: 12px; color: red; padding:10px;">\
<p>\
<b>Your browser security settings don\'t allow FCKeditor to be opened from\
the local filesystem.<\/b>\
<\/p>\
<p>\
Please open the <b>about:config<\/b> page and disable the\
"security.fileuri.strict_origin_policy" option; then load this page again.\
<\/p>\
<p>\
Check our <a href="http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/FAQ#ff3perms">FAQ<\/a>\
for more information.\
<\/p>\
<\/div>' ;
}, false ) ;
}
}
// Save a reference to the default domain.
var FCK_ORIGINAL_DOMAIN ;
// Automatically detect the correct document.domain (#123).
(function()
{
var d = FCK_ORIGINAL_DOMAIN = document.domain ;
while ( true )
{
// Test if we can access a parent property.
try
{
var test = window.parent.document.domain ;
break ;
}
catch( e ) {}
// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
d = d.replace( /.*?(?:\.|$)/, '' ) ;
if ( d.length == 0 )
break ; // It was not able to detect the domain.
try
{
document.domain = d ;
}
catch (e)
{
break ;
}
}
})() ;
// Save a reference to the detected runtime domain.
var FCK_RUNTIME_DOMAIN = document.domain ;
var FCK_IS_CUSTOM_DOMAIN = ( FCK_ORIGINAL_DOMAIN != FCK_RUNTIME_DOMAIN ) ;
// Instead of loading scripts and CSSs using inline tags, all scripts are
// loaded by code. In this way we can guarantee the correct processing order,
// otherwise external scripts and inline scripts could be executed in an
// unwanted order (IE).
function LoadScript( url )
{
document.write( '<scr' + 'ipt type="text/javascript" src="' + url + '"><\/scr' + 'ipt>' ) ;
}
// Main editor scripts.
var sSuffix = ( /*@cc_on!@*/false ) ? 'ie' : 'gecko' ;
/* @Packager.RemoveLine
LoadScript( 'js/fckeditorcode_' + sSuffix + '.js' ) ;
@Packager.RemoveLine */
// @Packager.Remove.Start
LoadScript( '_source/fckconstants.js' ) ;
LoadScript( '_source/fckjscoreextensions.js' ) ;
if ( sSuffix == 'ie' )
LoadScript( '_source/classes/fckiecleanup.js' ) ;
LoadScript( '_source/internals/fckbrowserinfo.js' ) ;
LoadScript( '_source/internals/fckurlparams.js' ) ;
LoadScript( '_source/classes/fckevents.js' ) ;
LoadScript( '_source/classes/fckdataprocessor.js' ) ;
LoadScript( '_source/internals/fck.js' ) ;
LoadScript( '_source/internals/fck_' + sSuffix + '.js' ) ;
LoadScript( '_source/internals/fckconfig.js' ) ;
LoadScript( '_source/internals/fckdebug_empty.js' ) ;
LoadScript( '_source/internals/fckdomtools.js' ) ;
LoadScript( '_source/internals/fcktools.js' ) ;
LoadScript( '_source/internals/fcktools_' + sSuffix + '.js' ) ;
LoadScript( '_source/fckeditorapi.js' ) ;
LoadScript( '_source/classes/fckimagepreloader.js' ) ;
LoadScript( '_source/internals/fckregexlib.js' ) ;
LoadScript( '_source/internals/fcklistslib.js' ) ;
LoadScript( '_source/internals/fcklanguagemanager.js' ) ;
LoadScript( '_source/internals/fckxhtmlentities.js' ) ;
LoadScript( '_source/internals/fckxhtml.js' ) ;
LoadScript( '_source/internals/fckxhtml_' + sSuffix + '.js' ) ;
LoadScript( '_source/internals/fckcodeformatter.js' ) ;
LoadScript( '_source/internals/fckundo.js' ) ;
LoadScript( '_source/classes/fckeditingarea.js' ) ;
LoadScript( '_source/classes/fckkeystrokehandler.js' ) ;
LoadScript( 'dtd/fck_xhtml10transitional.js' ) ;
LoadScript( '_source/classes/fckstyle.js' ) ;
LoadScript( '_source/internals/fckstyles.js' ) ;
LoadScript( '_source/internals/fcklisthandler.js' ) ;
LoadScript( '_source/classes/fckelementpath.js' ) ;
LoadScript( '_source/classes/fckdomrange.js' ) ;
LoadScript( '_source/classes/fckdocumentfragment_' + sSuffix + '.js' ) ;
LoadScript( '_source/classes/fckw3crange.js' ) ;
LoadScript( '_source/classes/fckdomrange_' + sSuffix + '.js' ) ;
LoadScript( '_source/classes/fckdomrangeiterator.js' ) ;
LoadScript( '_source/classes/fckenterkey.js' ) ;
LoadScript( '_source/internals/fckdocumentprocessor.js' ) ;
LoadScript( '_source/internals/fckselection.js' ) ;
LoadScript( '_source/internals/fckselection_' + sSuffix + '.js' ) ;
LoadScript( '_source/internals/fcktablehandler.js' ) ;
LoadScript( '_source/internals/fcktablehandler_' + sSuffix + '.js' ) ;
LoadScript( '_source/classes/fckxml.js' ) ;
LoadScript( '_source/classes/fckxml_' + sSuffix + '.js' ) ;
LoadScript( '_source/commandclasses/fcknamedcommand.js' ) ;
LoadScript( '_source/commandclasses/fckstylecommand.js' ) ;
LoadScript( '_source/commandclasses/fck_othercommands.js' ) ;
LoadScript( '_source/commandclasses/fckshowblocks.js' ) ;
LoadScript( '_source/commandclasses/fckspellcheckcommand_' + sSuffix + '.js' ) ;
LoadScript( '_source/commandclasses/fcktextcolorcommand.js' ) ;
LoadScript( '_source/commandclasses/fckpasteplaintextcommand.js' ) ;
LoadScript( '_source/commandclasses/fckpastewordcommand.js' ) ;
LoadScript( '_source/commandclasses/fcktablecommand.js' ) ;
LoadScript( '_source/commandclasses/fckfitwindow.js' ) ;
LoadScript( '_source/commandclasses/fcklistcommands.js' ) ;
LoadScript( '_source/commandclasses/fckjustifycommands.js' ) ;
LoadScript( '_source/commandclasses/fckindentcommands.js' ) ;
LoadScript( '_source/commandclasses/fckblockquotecommand.js' ) ;
LoadScript( '_source/commandclasses/fckcorestylecommand.js' ) ;
LoadScript( '_source/commandclasses/fckremoveformatcommand.js' ) ;
LoadScript( '_source/internals/fckcommands.js' ) ;
LoadScript( '_source/classes/fckpanel.js' ) ;
LoadScript( '_source/classes/fckicon.js' ) ;
LoadScript( '_source/classes/fcktoolbarbuttonui.js' ) ;
LoadScript( '_source/classes/fcktoolbarbutton.js' ) ;
LoadScript( '_source/classes/fckspecialcombo.js' ) ;
LoadScript( '_source/classes/fcktoolbarspecialcombo.js' ) ;
LoadScript( '_source/classes/fcktoolbarstylecombo.js' ) ;
LoadScript( '_source/classes/fcktoolbarfontformatcombo.js' ) ;
LoadScript( '_source/classes/fcktoolbarfontscombo.js' ) ;
LoadScript( '_source/classes/fcktoolbarfontsizecombo.js' ) ;
LoadScript( '_source/classes/fcktoolbarpanelbutton.js' ) ;
LoadScript( '_source/internals/fcktoolbaritems.js' ) ;
LoadScript( '_source/classes/fcktoolbar.js' ) ;
LoadScript( '_source/classes/fcktoolbarbreak_' + sSuffix + '.js' ) ;
LoadScript( '_source/internals/fcktoolbarset.js' ) ;
LoadScript( '_source/internals/fckdialog.js' ) ;
LoadScript( '_source/classes/fckmenuitem.js' ) ;
LoadScript( '_source/classes/fckmenublock.js' ) ;
LoadScript( '_source/classes/fckmenublockpanel.js' ) ;
LoadScript( '_source/classes/fckcontextmenu.js' ) ;
LoadScript( '_source/internals/fck_contextmenu.js' ) ;
LoadScript( '_source/classes/fckhtmliterator.js' ) ;
LoadScript( '_source/classes/fckplugin.js' ) ;
LoadScript( '_source/internals/fckplugins.js' ) ;
// @Packager.Remove.End
// Base configuration file.
LoadScript( '../fckconfig.js' ) ;
</script>
<script type="text/javascript">
// Adobe AIR compatibility file.
if ( FCKBrowserInfo.IsAIR )
LoadScript( 'js/fckadobeair.js' ) ;
if ( FCKBrowserInfo.IsIE )
{
// Remove IE mouse flickering.
try
{
document.execCommand( 'BackgroundImageCache', false, true ) ;
}
catch (e)
{
// We have been reported about loading problems caused by the above
// line. For safety, let's just ignore errors.
}
// Create the default cleanup object used by the editor.
FCK.IECleanup = new FCKIECleanup( window ) ;
FCK.IECleanup.AddItem( FCKTempBin, FCKTempBin.Reset ) ;
FCK.IECleanup.AddItem( FCK, FCK_Cleanup ) ;
}
// The first function to be called on selection change must the the styles
// change checker, because the result of its processing may be used by another
// functions listening to the same event.
FCK.Events.AttachEvent( 'OnSelectionChange', function() { FCKStyles.CheckSelectionChanges() ; } ) ;
// The config hidden field is processed immediately, because
// CustomConfigurationsPath may be set in the page.
FCKConfig.ProcessHiddenField() ;
// Load the custom configurations file (if defined).
if ( FCKConfig.CustomConfigurationsPath.length > 0 )
LoadScript( FCKConfig.CustomConfigurationsPath ) ;
</script>
<script type="text/javascript">
// Load configurations defined at page level.
FCKConfig_LoadPageConfig() ;
FCKConfig_PreProcess() ;
// Load the full debug script.
if ( FCKConfig.Debug )
LoadScript( '_source/internals/fckdebug.js' ) ;
</script>
<script type="text/javascript">
var FCK_InternalCSS = FCKConfig.BasePath + 'css/fck_internal.css' ; // @Packager.RemoveLine
var FCK_ShowTableBordersCSS = FCKConfig.BasePath + 'css/fck_showtableborders_gecko.css' ; // @Packager.RemoveLine
/* @Packager.RemoveLine
// CSS minified by http://iceyboard.no-ip.org/projects/css_compressor (see _dev/css_compression.txt).
var FCK_InternalCSS = FCKTools.FixCssUrls( FCKConfig.BasePath + 'css/', 'html{min-height:100%}table.FCK__ShowTableBorders,table.FCK__ShowTableBorders td,table.FCK__ShowTableBorders th{border:#d3d3d3 1px solid}form{border:1px dotted #F00;padding:2px}.FCK__Flash{border:#a9a9a9 1px solid;background-position:center center;background-image:url(images/fck_flashlogo.gif);background-repeat:no-repeat;width:80px;height:80px}.FCK__UnknownObject{border:#a9a9a9 1px solid;background-position:center center;background-image:url(images/fck_plugin.gif);background-repeat:no-repeat;width:80px;height:80px}.FCK__Anchor{border:1px dotted #00F;background-position:center center;background-image:url(images/fck_anchor.gif);background-repeat:no-repeat;width:16px;height:15px;vertical-align:middle}.FCK__AnchorC{border:1px dotted #00F;background-position:1px center;background-image:url(images/fck_anchor.gif);background-repeat:no-repeat;padding-left:18px}a[name]{border:1px dotted #00F;background-position:0 center;background-image:url(images/fck_anchor.gif);background-repeat:no-repeat;padding-left:18px}.FCK__PageBreak{background-position:center center;background-image:url(images/fck_pagebreak.gif);background-repeat:no-repeat;clear:both;display:block;float:none;width:100%;border-top:#999 1px dotted;border-bottom:#999 1px dotted;border-right:0;border-left:0;height:5px}.FCK__InputHidden{width:19px;height:18px;background-image:url(images/fck_hiddenfield.gif);background-repeat:no-repeat;vertical-align:text-bottom;background-position:center center}.FCK__ShowBlocks p,.FCK__ShowBlocks div,.FCK__ShowBlocks pre,.FCK__ShowBlocks address,.FCK__ShowBlocks blockquote,.FCK__ShowBlocks h1,.FCK__ShowBlocks h2,.FCK__ShowBlocks h3,.FCK__ShowBlocks h4,.FCK__ShowBlocks h5,.FCK__ShowBlocks h6{background-repeat:no-repeat;border:1px dotted gray;padding-top:8px;padding-left:8px}.FCK__ShowBlocks p{background-image:url(images/block_p.png)}.FCK__ShowBlocks div{background-image:url(images/block_div.png)}.FCK__ShowBlocks pre{background-image:url(images/block_pre.png)}.FCK__ShowBlocks address{background-image:url(images/block_address.png)}.FCK__ShowBlocks blockquote{background-image:url(images/block_blockquote.png)}.FCK__ShowBlocks h1{background-image:url(images/block_h1.png)}.FCK__ShowBlocks h2{background-image:url(images/block_h2.png)}.FCK__ShowBlocks h3{background-image:url(images/block_h3.png)}.FCK__ShowBlocks h4{background-image:url(images/block_h4.png)}.FCK__ShowBlocks h5{background-image:url(images/block_h5.png)}.FCK__ShowBlocks h6{background-image:url(images/block_h6.png)}' ) ;
var FCK_ShowTableBordersCSS = FCKTools.FixCssUrls( FCKConfig.BasePath + 'css/', 'table:not([border]),table:not([border]) > tr > td,table:not([border]) > tr > th,table:not([border]) > tbody > tr > td,table:not([border]) > tbody > tr > th,table:not([border]) > thead > tr > td,table:not([border]) > thead > tr > th,table:not([border]) > tfoot > tr > td,table:not([border]) > tfoot > tr > th,table[border=\"0\"],table[border=\"0\"] > tr > td,table[border=\"0\"] > tr > th,table[border=\"0\"] > tbody > tr > td,table[border=\"0\"] > tbody > tr > th,table[border=\"0\"] > thead > tr > td,table[border=\"0\"] > thead > tr > th,table[border=\"0\"] > tfoot > tr > td,table[border=\"0\"] > tfoot > tr > th{border:#d3d3d3 1px dotted}' ) ;
@Packager.RemoveLine */
// Popup the debug window if debug mode is set to true. It guarantees that the
// first debug message will not be lost.
if ( FCKConfig.Debug )
FCKDebug._GetWindow() ;
// Load the active skin CSS.
document.write( FCKTools.GetStyleHtml( FCKConfig.SkinEditorCSS ) ) ;
// Load the language file.
FCKLanguageManager.Initialize() ;
LoadScript( 'lang/' + FCKLanguageManager.ActiveLanguage.Code + '.js' ) ;
</script>
<script type="text/javascript">
// Initialize the editing area context menu.
FCK_ContextMenu_Init() ;
FCKPlugins.Load() ;
</script>
<script type="text/javascript">
// Set the editor interface direction.
window.document.dir = FCKLang.Dir ;
</script>
<script type="text/javascript">
window.onload = function()
{
InitializeAPI() ;
if ( FCKBrowserInfo.IsIE )
FCK_PreloadImages() ;
else
LoadToolbarSetup() ;
}
function LoadToolbarSetup()
{
FCKeditorAPI._FunctionQueue.Add( LoadToolbar ) ;
}
function LoadToolbar()
{
var oToolbarSet = FCK.ToolbarSet = FCKToolbarSet_Create() ;
if ( oToolbarSet.IsLoaded )
StartEditor() ;
else
{
oToolbarSet.OnLoad = StartEditor ;
oToolbarSet.Load( FCKURLParams['Toolbar'] || 'Default' ) ;
}
}
function StartEditor()
{
// Remove the onload listener.
FCK.ToolbarSet.OnLoad = null ;
FCKeditorAPI._FunctionQueue.Remove( LoadToolbar ) ;
FCK.Events.AttachEvent( 'OnStatusChange', WaitForActive ) ;
// Start the editor.
FCK.StartEditor() ;
}
function WaitForActive( editorInstance, newStatus )
{
if ( newStatus == FCK_STATUS_ACTIVE )
{
if ( FCKBrowserInfo.IsGecko )
FCKTools.RunFunction( window.onresize ) ;
if ( !FCKConfig.PreventSubmitHandler )
_AttachFormSubmitToAPI() ;
FCK.SetStatus( FCK_STATUS_COMPLETE ) ;
// Call the special "FCKeditor_OnComplete" function that should be present in
// the HTML page where the editor is located.
if ( typeof( window.parent.FCKeditor_OnComplete ) == 'function' )
window.parent.FCKeditor_OnComplete( FCK ) ;
}
}
// Gecko browsers doesn't calculate well the IFRAME size so we must
// recalculate it every time the window size changes.
if ( FCKBrowserInfo.IsGecko && !FCKBrowserInfo.IsOpera )
{
window.onresize = function( e )
{
// Running in Chrome makes the window receive the event including subframes.
// we care only about this window. Ticket #1642.
// #2002: The originalTarget from the event can be the current document, the window, or the editing area.
if ( e && e.originalTarget !== document && e.originalTarget !== window && (!e.originalTarget.ownerDocument || e.originalTarget.ownerDocument != document ))
return ;
var oCell = document.getElementById( 'xEditingArea' ) ;
var eInnerElement = oCell.firstChild ;
if ( eInnerElement )
{
eInnerElement.style.height = '0px' ;
eInnerElement.style.height = ( oCell.scrollHeight - 2 ) + 'px' ;
}
}
}
</script>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0" style="height: 100%; table-layout: fixed">
<tr id="xToolbarRow" style="display: none">
<td id="xToolbarSpace" style="overflow: hidden">
<table width="100%" cellpadding="0" cellspacing="0">
<tr id="xCollapsed" style="display: none">
<td id="xExpandHandle" class="TB_Expand" colspan="3">
<img class="TB_ExpandImg" alt="" src="images/spacer.gif" width="8" height="4" /></td>
</tr>
<tr id="xExpanded" style="display: none">
<td id="xTBLeftBorder" class="TB_SideBorder" style="width: 1px; display: none;"></td>
<td id="xCollapseHandle" style="display: none" class="TB_Collapse" valign="bottom">
<img class="TB_CollapseImg" alt="" src="images/spacer.gif" width="8" height="4" /></td>
<td id="xToolbar" class="TB_ToolbarSet"></td>
<td class="TB_SideBorder" style="width: 1px"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="xEditingArea" valign="top" style="height: 100%"></td>
</tr>
</table>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2001-2011 Hartmut Kaiser
// Copyright (c) 2001-2011 Joel de Guzman
//
// 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)
#if !defined(SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM)
#define SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/spirit/home/karma/domain.hpp>
#include <boost/spirit/home/karma/directive/buffer.hpp>
#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/home/support/utree/utree_traits_fwd.hpp>
#include <boost/spirit/home/karma/detail/attributes.hpp>
#include <boost/spirit/home/support/detail/hold_any.hpp>
#include <boost/spirit/home/karma/detail/output_iterator.hpp>
#include <boost/spirit/home/support/container.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/variant.hpp>
#include <boost/detail/workaround.hpp>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace karma { namespace detail
{
///////////////////////////////////////////////////////////////////////////
// execute a generator if the given Attribute type is compatible
///////////////////////////////////////////////////////////////////////////
// this gets instantiated if the Attribute type is _not_ compatible with
// the generator
template <typename Component, typename Attribute, typename Expected
, typename Enable = void>
struct alternative_generate
{
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const&, OutputIterator&, Context&, Delimiter const&
, Attribute const&, bool& failed)
{
failed = true;
return false;
}
};
template <typename Component>
struct alternative_generate<Component, unused_type, unused_type>
{
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink, Context& ctx
, Delimiter const& d, unused_type, bool&)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
// return true if any of the generators succeed
return component.generate(sink, ctx, d, unused);
}
};
// this gets instantiated if there is no Attribute given for the
// alternative generator
template <typename Component, typename Expected>
struct alternative_generate<Component, unused_type, Expected>
: alternative_generate<Component, unused_type, unused_type> {};
// this gets instantiated if the generator does not expect to receive an
// Attribute (the generator is self contained).
template <typename Component, typename Attribute>
struct alternative_generate<Component, Attribute, unused_type>
: alternative_generate<Component, unused_type, unused_type> {};
// this gets instantiated if the Attribute type is compatible to the
// generator
template <typename Component, typename Attribute, typename Expected>
struct alternative_generate<Component, Attribute, Expected
, typename enable_if<
traits::compute_compatible_component<Expected, Attribute, karma::domain> >::type>
{
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink
, Context& ctx, Delimiter const& d, Attribute const& attr, bool&)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
return call(component, sink, ctx, d, attr
, spirit::traits::not_is_variant<Attribute, karma::domain>());
}
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink
, Context& ctx, Delimiter const& d, Attribute const& attr, mpl::true_)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
return component.generate(sink, ctx, d, attr);
}
template <typename OutputIterator, typename Context, typename Delimiter>
static bool
call(Component const& component, OutputIterator& sink
, Context& ctx, Delimiter const& d, Attribute const& attr, mpl::false_)
{
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
#endif
typedef
traits::compute_compatible_component<Expected, Attribute, domain>
component_type;
// if we got passed an empty optional, just fail generation
if (!traits::has_optional_value(attr))
return false;
// make sure, the content of the passed variant matches our
// expectations
typename traits::optional_attribute<Attribute>::type attr_ =
traits::optional_value(attr);
if (!component_type::is_compatible(spirit::traits::which(attr_)))
return false;
// returns true if any of the generators succeed
typedef typename component_type::compatible_type compatible_type;
return component.generate(sink, ctx, d
, boost::get<compatible_type>(attr_));
}
};
///////////////////////////////////////////////////////////////////////////
// alternative_generate_function: a functor supplied to fusion::any which
// will be executed for every generator in a given alternative generator
// expression
///////////////////////////////////////////////////////////////////////////
template <typename OutputIterator, typename Context, typename Delimiter,
typename Attribute, typename Strict>
struct alternative_generate_function
{
alternative_generate_function(OutputIterator& sink_, Context& ctx_
, Delimiter const& d, Attribute const& attr_)
: sink(sink_), ctx(ctx_), delim(d), attr(attr_) {}
template <typename Component>
bool operator()(Component const& component)
{
typedef
typename traits::attribute_of<Component, Context>::type
expected_type;
typedef
alternative_generate<Component, Attribute, expected_type>
generate;
// wrap the given output iterator avoid output as long as one
// component fails
detail::enable_buffering<OutputIterator> buffering(sink);
bool r = false;
bool failed = false; // will be ignored
{
detail::disable_counting<OutputIterator> nocounting(sink);
r = generate::call(component, sink, ctx, delim, attr, failed);
}
if (r)
buffering.buffer_copy();
return r;
}
// avoid double buffering
template <typename Component>
bool operator()(buffer_directive<Component> const& component)
{
typedef typename
traits::attribute_of<Component, Context>::type
expected_type;
typedef alternative_generate<
buffer_directive<Component>, Attribute, expected_type>
generate;
bool failed = false; // will be ignored
return generate::call(component, sink, ctx, delim, attr, failed);
}
OutputIterator& sink;
Context& ctx;
Delimiter const& delim;
Attribute const& attr;
private:
// silence MSVC warning C4512: assignment operator could not be generated
alternative_generate_function& operator= (alternative_generate_function const&);
};
// specialization for strict alternatives
template <typename OutputIterator, typename Context, typename Delimiter,
typename Attribute>
struct alternative_generate_function<
OutputIterator, Context, Delimiter, Attribute, mpl::true_>
{
alternative_generate_function(OutputIterator& sink_, Context& ctx_
, Delimiter const& d, Attribute const& attr_)
: sink(sink_), ctx(ctx_), delim(d), attr(attr_), failed(false) {}
template <typename Component>
bool operator()(Component const& component)
{
typedef
typename traits::attribute_of<Component, Context>::type
expected_type;
typedef
alternative_generate<Component, Attribute, expected_type>
generate;
if (failed)
return false; // give up when already failed
// wrap the given output iterator avoid output as long as one
// component fails
detail::enable_buffering<OutputIterator> buffering(sink);
bool r = false;
{
detail::disable_counting<OutputIterator> nocounting(sink);
r = generate::call(component, sink, ctx, delim, attr, failed);
}
if (r && !failed)
{
buffering.buffer_copy();
return true;
}
return false;
}
OutputIterator& sink;
Context& ctx;
Delimiter const& delim;
Attribute const& attr;
bool failed;
private:
// silence MSVC warning C4512: assignment operator could not be generated
alternative_generate_function& operator= (alternative_generate_function const&);
};
}}}}
#endif
| {
"pile_set_name": "Github"
} |
import React from "react"
import { createFragmentContainer, graphql } from "react-relay"
import { StyleSheet, Text, TextStyle, View, ViewProperties, ViewStyle } from "react-native"
import SerifText from "lib/Components/Text/Serif"
import colors from "lib/data/colors"
import fonts from "lib/data/fonts"
import { Metadata_show } from "__generated__/Metadata_show.graphql"
interface Props extends ViewProperties {
show: Metadata_show
}
class Metadata extends React.Component<Props> {
render() {
const partnerName = this.props.show.partner && this.props.show.partner.name
const showType = this.showTypeString()
return (
<View style={styles.container}>
{!!partnerName && <Text style={styles.sansSerifText}>{partnerName.toUpperCase()}</Text>}
{!!showType && <Text style={styles.sansSerifText}>{showType}</Text>}
<SerifText style={styles.serifText}>{this.props.show.name}</SerifText>
{this.dateAndLocationString()}
{this.statusText()}
</View>
)
}
showTypeString() {
if (this.props.show.kind) {
const message = this.props.show.kind.toUpperCase() + (this.props.show.kind === "fair" ? " BOOTH" : " SHOW")
return message
}
return null
}
dateAndLocationString() {
const exhibition_period = this.props.show.exhibition_period
const city = this.props.show.location && this.props.show.location.city
if (city || exhibition_period) {
const text = city ? city.trim() + ", " + exhibition_period : exhibition_period
return <SerifText style={[styles.serifText, { color: "grey" }]}>{text}</SerifText>
}
return null
}
statusText() {
if (this.props.show.status_update) {
const textColor = this.props.show.status === "upcoming" ? "green-regular" : "red-regular"
return <SerifText style={{ color: colors[textColor] }}>{this.props.show.status_update}</SerifText>
}
return null
}
}
interface Styles {
container: ViewStyle
serifText: TextStyle
sansSerifText: TextStyle
}
const styles = StyleSheet.create<Styles>({
container: {
justifyContent: "flex-start",
marginTop: 10,
},
serifText: {
margin: 2,
marginLeft: 0,
},
sansSerifText: {
fontSize: 12,
textAlign: "left",
margin: 2,
marginLeft: 0,
fontFamily: fonts["avant-garde-regular"],
},
})
export default createFragmentContainer(Metadata, {
show: graphql`
fragment Metadata_show on Show {
kind
name
exhibition_period: exhibitionPeriod
status_update: statusUpdate
status
partner {
... on Partner {
name
}
... on ExternalPartner {
name
}
}
location {
city
}
}
`,
})
| {
"pile_set_name": "Github"
} |
package com.bookstore.service;
import com.bookstore.dto.AuthorDto;
import java.util.List;
import com.bookstore.repository.AuthorRepository;
import org.springframework.stereotype.Service;
@Service
public class BookstoreService {
private final AuthorRepository authorRepository;
public BookstoreService(AuthorRepository authorRepository) {
this.authorRepository = authorRepository;
}
public List<AuthorDto> fetchAuthorsNamesAndAges() {
return authorRepository.fetchNameAndAge();
}
public List<String> fetchAuthorsNames() {
return authorRepository.fetchName();
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2017 JanusGraph Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.janusgraph.example;
import java.util.stream.Stream;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.Result;
import org.apache.tinkerpop.gremlin.driver.ResultSet;
import org.apache.tinkerpop.gremlin.process.traversal.Bindings;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.janusgraph.core.JanusGraph;
import org.janusgraph.core.attribute.Geoshape;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal;
public class RemoteGraphApp extends JanusGraphApp {
private static final Logger LOGGER = LoggerFactory.getLogger(RemoteGraphApp.class);
// used for bindings
private static final String NAME = "name";
private static final String AGE = "age";
private static final String TIME = "time";
private static final String REASON = "reason";
private static final String PLACE = "place";
private static final String LABEL = "label";
private static final String OUT_V = "outV";
private static final String IN_V = "inV";
protected JanusGraph janusgraph;
protected Cluster cluster;
protected Client client;
protected Configuration conf;
/**
* Constructs a graph app using the given properties.
* @param fileName location of the properties file
*/
public RemoteGraphApp(final String fileName) {
super(fileName);
// the server auto-commits per request, so the application code doesn't
// need to explicitly commit transactions
this.supportsTransactions = false;
}
@Override
public GraphTraversalSource openGraph() throws ConfigurationException {
LOGGER.info("opening graph");
conf = new PropertiesConfiguration(propFileName);
// using the remote driver for schema
try {
cluster = Cluster.open(conf.getString("gremlin.remote.driver.clusterFile"));
client = cluster.connect();
} catch (Exception e) {
throw new ConfigurationException(e);
}
// using the remote graph for queries
return traversal().withRemote(conf);
}
@Override
public void createElements() {
LOGGER.info("creating elements");
// Use bindings to allow the Gremlin Server to cache traversals that
// will be reused with different parameters. This minimizes the
// number of scripts that need to be compiled and cached on the server.
// https://tinkerpop.apache.org/docs/3.2.6/reference/#parameterized-scripts
final Bindings b = Bindings.instance();
// see GraphOfTheGodsFactory.java
Vertex saturn = g.addV(b.of(LABEL, "titan")).property(NAME, b.of(NAME, "saturn"))
.property(AGE, b.of(AGE, 10000)).next();
Vertex sky = g.addV(b.of(LABEL, "location")).property(NAME, b.of(NAME, "sky")).next();
Vertex sea = g.addV(b.of(LABEL, "location")).property(NAME, b.of(NAME, "sea")).next();
Vertex jupiter = g.addV(b.of(LABEL, "god")).property(NAME, b.of(NAME, "jupiter")).property(AGE, b.of(AGE, 5000))
.next();
Vertex neptune = g.addV(b.of(LABEL, "god")).property(NAME, b.of(NAME, "neptune")).property(AGE, b.of(AGE, 4500))
.next();
Vertex hercules = g.addV(b.of(LABEL, "demigod")).property(NAME, b.of(NAME, "hercules"))
.property(AGE, b.of(AGE, 30)).next();
Vertex alcmene = g.addV(b.of(LABEL, "human")).property(NAME, b.of(NAME, "alcmene")).property(AGE, b.of(AGE, 45))
.next();
Vertex pluto = g.addV(b.of(LABEL, "god")).property(NAME, b.of(NAME, "pluto")).property(AGE, b.of(AGE, 4000))
.next();
Vertex nemean = g.addV(b.of(LABEL, "monster")).property(NAME, b.of(NAME, "nemean")).next();
Vertex hydra = g.addV(b.of(LABEL, "monster")).property(NAME, b.of(NAME, "hydra")).next();
Vertex cerberus = g.addV(b.of(LABEL, "monster")).property(NAME, b.of(NAME, "cerberus")).next();
Vertex tartarus = g.addV(b.of(LABEL, "location")).property(NAME, b.of(NAME, "tartarus")).next();
g.V(b.of(OUT_V, jupiter)).as("a").V(b.of(IN_V, saturn)).addE(b.of(LABEL, "father")).from("a").next();
g.V(b.of(OUT_V, jupiter)).as("a").V(b.of(IN_V, sky)).addE(b.of(LABEL, "lives"))
.property(REASON, b.of(REASON, "loves fresh breezes")).from("a").next();
g.V(b.of(OUT_V, jupiter)).as("a").V(b.of(IN_V, neptune)).addE(b.of(LABEL, "brother")).from("a").next();
g.V(b.of(OUT_V, jupiter)).as("a").V(b.of(IN_V, pluto)).addE(b.of(LABEL, "brother")).from("a").next();
g.V(b.of(OUT_V, neptune)).as("a").V(b.of(IN_V, sea)).addE(b.of(LABEL, "lives"))
.property(REASON, b.of(REASON, "loves waves")).from("a").next();
g.V(b.of(OUT_V, neptune)).as("a").V(b.of(IN_V, jupiter)).addE(b.of(LABEL, "brother")).from("a").next();
g.V(b.of(OUT_V, neptune)).as("a").V(b.of(IN_V, pluto)).addE(b.of(LABEL, "brother")).from("a").next();
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, jupiter)).addE(b.of(LABEL, "father")).from("a").next();
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, alcmene)).addE(b.of(LABEL, "mother")).from("a").next();
if (supportsGeoshape) {
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, nemean)).addE(b.of(LABEL, "battled"))
.property(TIME, b.of(TIME, 1)).property(PLACE, b.of(PLACE, Geoshape.point(38.1f, 23.7f))).from("a")
.next();
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, hydra)).addE(b.of(LABEL, "battled"))
.property(TIME, b.of(TIME, 2)).property(PLACE, b.of(PLACE, Geoshape.point(37.7f, 23.9f))).from("a")
.next();
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, cerberus)).addE(b.of(LABEL, "battled"))
.property(TIME, b.of(TIME, 12)).property(PLACE, b.of(PLACE, Geoshape.point(39f, 22f))).from("a")
.next();
} else {
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, nemean)).addE(b.of(LABEL, "battled"))
.property(TIME, b.of(TIME, 1)).property(PLACE, b.of(PLACE, getGeoFloatArray(38.1f, 23.7f)))
.from("a").next();
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, hydra)).addE(b.of(LABEL, "battled"))
.property(TIME, b.of(TIME, 2)).property(PLACE, b.of(PLACE, getGeoFloatArray(37.7f, 23.9f)))
.from("a").next();
g.V(b.of(OUT_V, hercules)).as("a").V(b.of(IN_V, cerberus)).addE(b.of(LABEL, "battled"))
.property(TIME, b.of(TIME, 12)).property(PLACE, b.of(PLACE, getGeoFloatArray(39f, 22f))).from("a")
.next();
}
g.V(b.of(OUT_V, pluto)).as("a").V(b.of(IN_V, jupiter)).addE(b.of(LABEL, "brother")).from("a").next();
g.V(b.of(OUT_V, pluto)).as("a").V(b.of(IN_V, neptune)).addE(b.of(LABEL, "brother")).from("a").next();
g.V(b.of(OUT_V, pluto)).as("a").V(b.of(IN_V, tartarus)).addE(b.of(LABEL, "lives"))
.property(REASON, b.of(REASON, "no fear of death")).from("a").next();
g.V(b.of(OUT_V, pluto)).as("a").V(b.of(IN_V, cerberus)).addE(b.of(LABEL, "pet")).from("a").next();
g.V(b.of(OUT_V, cerberus)).as("a").V(b.of(IN_V, tartarus)).addE(b.of(LABEL, "lives")).from("a").next();
}
@Override
public void closeGraph() throws Exception {
LOGGER.info("closing graph");
try {
if (g != null) {
// this closes the remote, no need to close the empty graph
g.close();
}
if (cluster != null) {
// the cluster closes all of its clients
cluster.close();
}
} finally {
g = null;
graph = null;
client = null;
cluster = null;
}
}
@Override
public void createSchema() {
LOGGER.info("creating schema");
// get the schema request as a string
final String req = createSchemaRequest();
// submit the request to the server
final ResultSet resultSet = client.submit(req);
// drain the results completely
Stream<Result> futureList = resultSet.stream();
futureList.map(Result::toString).forEach(LOGGER::info);
}
public static void main(String[] args) {
final String fileName = (args != null && args.length > 0) ? args[0] : null;
final RemoteGraphApp app = new RemoteGraphApp(fileName);
app.runApp();
}
}
| {
"pile_set_name": "Github"
} |
const { GPU } = require('gpu.js');
const { Target } = require('../../src/layer/target');
const { setup, teardown } = require('../../src/utilities/kernel');
const { injectIstanbulCoverage } = require('../test-utils');
describe('Target Layer', () => {
beforeEach(() => {
setup(
new GPU({
mode: 'cpu',
onIstanbulCoverageVariable: injectIstanbulCoverage,
})
);
});
afterEach(() => {
teardown();
});
test('is fully back propagating values to deltas', () => {
const input = { width: 1, height: 1, weights: [[1]], deltas: [[0]] };
const target = new Target({ width: 1, height: 1 }, input);
target.validate();
target.setupKernels();
target.predict();
target.compare([[0]]);
expect(target.deltas).toEqual([new Float32Array([1])]);
});
test('uses compare1D when width = 1', () => {
const target = new Target({}, { height: 10, width: 1 });
target.setupKernels();
expect(/compare1D/.test(target.compareKernel.source)).toBeTruthy();
expect(!/compare2D/.test(target.compareKernel.source)).toBeTruthy();
});
test('uses compare2D when width > 1', () => {
const target = new Target({}, { height: 10, width: 10 });
target.setupKernels();
expect(!/compare1D/.test(target.compareKernel.source)).toBeTruthy();
expect(/compare2D/.test(target.compareKernel.source)).toBeTruthy();
});
});
| {
"pile_set_name": "Github"
} |
# List of source files containing translatable strings.
# Addons
addons/src/ao_bookmarklist.c
addons/src/ao_tasks.c
addons/src/ao_systray.c
addons/src/ao_blanklines.c
addons/src/ao_markword.c
addons/src/ao_xmltagging.c
addons/src/ao_openuri.c
addons/src/ao_wrapwords.c
addons/src/ao_doclist.c
addons/src/ao_copyfilepath.c
addons/src/addons.c
# Autoclose
autoclose/src/autoclose.c
# Automark
automark/src/automark.c
# codenav
codenav/src/codenavigation.c
codenav/src/goto_file.c
codenav/src/switch_head_impl.c
codenav/src/utils.c
# commander
commander/src/commander-plugin.c
# debugger
debugger/src/plugin.c
debugger/src/vtree.c
debugger/src/tpage.c
debugger/src/envtree.c
debugger/src/bptree.c
debugger/src/breakpoint.c
debugger/src/wtree.c
debugger/src/debug.c
debugger/src/dbm_gdb.c
debugger/src/debug_module.c
debugger/src/utils.c
debugger/src/stree.c
debugger/src/tabs.c
debugger/src/keys.c
debugger/src/markers.c
debugger/src/watch_model.c
debugger/src/callbacks.c
debugger/src/breakpoints.c
debugger/src/btnpanel.c
debugger/src/btnpanel.h
debugger/src/dconfig.c
debugger/src/dconfig.h
debugger/src/pixbuf.c
debugger/src/pixbuf.h
debugger/src/atree.h
debugger/src/atree.c
# defineformat
defineformat/src/defineformat.c
# devhelp
devhelp/src/dhp.h
devhelp/src/dhp-object.c
devhelp/src/dhp-plugin.c
devhelp/src/dhp-manpages.c
devhelp/src/dhp-settings.c
# bundled libdevhelp2
devhelp/devhelp/dh-assistant.c
devhelp/devhelp/dh-assistant.h
devhelp/devhelp/dh-assistant-view.c
devhelp/devhelp/dh-assistant-view.h
devhelp/devhelp/dh-base.c
devhelp/devhelp/dh-base.h
devhelp/devhelp/dh-book.c
devhelp/devhelp/dh-book.h
devhelp/devhelp/dh-book-manager.c
devhelp/devhelp/dh-book-manager.h
devhelp/devhelp/dh-book-tree.c
devhelp/devhelp/dh-book-tree.h
devhelp/devhelp/dh-enum-types.c
devhelp/devhelp/dh-enum-types.h
devhelp/devhelp/dh-error.c
devhelp/devhelp/dh-error.h
devhelp/devhelp/dh-keyword-model.c
devhelp/devhelp/dh-keyword-model.h
devhelp/devhelp/dh-link.c
devhelp/devhelp/dh-link.h
devhelp/devhelp/dh-marshal.c
devhelp/devhelp/dh-marshal.h
devhelp/devhelp/dh-parser.c
devhelp/devhelp/dh-parser.h
devhelp/devhelp/dh-preferences.c
devhelp/devhelp/dh-preferences.h
devhelp/devhelp/dh-search.c
devhelp/devhelp/dh-search.h
devhelp/devhelp/dh-util.c
devhelp/devhelp/dh-util.h
devhelp/devhelp/dh-window.c
devhelp/devhelp/dh-window.h
devhelp/devhelp/eggfindbar.c
devhelp/devhelp/eggfindbar.h
devhelp/devhelp/ige-conf.c
devhelp/devhelp/ige-conf-gconf.c
devhelp/devhelp/ige-conf.h
devhelp/devhelp/ige-conf-private.h
# geanyctags
geanyctags/src/geanyctags.c
# geanydoc
geanydoc/tests/unittests.c
geanydoc/src/config.c
geanydoc/src/geanydoc.c
# GeanyExtraSel
geanyextrasel/src/extrasel.c
# GeanyGenDoc
geanygendoc/src/ggd-file-type-loader.c
geanygendoc/src/ggd-doc-type.c
geanygendoc/src/ggd-tag-utils.c
geanygendoc/src/ggd-file-type-manager.c
geanygendoc/src/ggd-plugin.c
geanygendoc/src/ggd-utils.c
geanygendoc/src/ggd.c
geanygendoc/src/ggd-doc-setting.c
geanygendoc/src/ggd-file-type.c
geanygendoc/src/ggd-widget-frame.c
geanygendoc/src/ggd-options.c
geanygendoc/src/ggd-widget-doctype-selector.c
# GeanyInsertnum
geanyinsertnum/src/insertnum.c
# latex
latex/src/bibtex.c
latex/src/formatutils.c
latex/src/latexenvironments.c
latex/src/latexutils.c
latex/src/templates.c
latex/src/bibtexlabels.c
latex/src/latex.c
latex/src/latexkeybindings.c
latex/src/letters.c
latex/src/formatpatterns.c
latex/src/latexencodings.c
latex/src/latexstructure.c
latex/src/reftex.c
# geanyLua
geanylua/glspi.h
geanylua/glspi_ver.h
geanylua/glspi_run.c
geanylua/glspi_init.c
geanylua/gsdlg_lua.c
geanylua/glspi_doc.c
geanylua/gsdlg.c
geanylua/glspi_sci.c
geanylua/glspi_dlg.c
geanylua/glspi_kfile.c
geanylua/geanylua.c
geanylua/glspi_app.c
# GeanyMacro
geanymacro/src/geanymacro.c
# GeanyMiniScript
geanyminiscript/src/gms_gui.c
geanyminiscript/src/gms_gui.h
geanyminiscript/src/gms.c
geanyminiscript/src/gms.h
# GeanyNumberedBookmarks
geanynumberedbookmarks/src/geanynumberedbookmarks.c
# GeanyPG
geanypg/src/decrypt_cb.c
geanypg/src/encrypt_cb.c
geanypg/src/geanypg.c
geanypg/src/helper_functions.c
geanypg/src/key_selection_dialog.c
geanypg/src/pinentry.c
geanypg/src/sign_cb.c
geanypg/src/verify_aux.c
geanypg/src/verify_cb.c
# GeanyPrj
geanyprj/src/geanyprj.c
geanyprj/src/geanyprj.h
geanyprj/src/menu.c
geanyprj/src/project.c
geanyprj/src/sidebar.c
geanyprj/src/utils.c
geanyprj/src/xproject.c
# Geanypy
geanypy/src/geanypy-plugin.c
# geanyvc
geanyvc/src/geanyvc.c
geanyvc/src/geanyvc.h
geanyvc/src/vc_bzr.c
geanyvc/src/vc_cvs.c
geanyvc/src/vc_fossil.c
geanyvc/src/vc_git.c
geanyvc/src/vc_hg.c
geanyvc/src/vc_svk.c
geanyvc/src/vc_svn.c
geanyvc/src/utils.c
# GeniusPaste
geniuspaste/src/geniuspaste.c
# GitChangeBar
[type: gettext/glade]git-changebar/data/prefs.ui
git-changebar/src/gcb-plugin.c
# Keyrecord
keyrecord/src/keyrecord.c
# LineOperations
lineoperations/src/lineoperations.c
lineoperations/src/lo_fns.c
lineoperations/src/lo_prefs.c
# lipsum
lipsum/src/lipsum.c
# Markdown
markdown/src/conf.c
markdown/src/plugin.c
# Multiterm
multiterm/src/config.vala
multiterm/src/context-menu.vala
multiterm/src/notebook.vala
multiterm/src/plugin.vala
multiterm/src/shell-config.vala
multiterm/src/tab-label.vala
multiterm/src/terminal.vala
# Overview
overview/overview/overviewcolor.c
overview/overview/overviewplugin.c
overview/overview/overviewprefs.c
overview/overview/overviewprefspanel.c
overview/overview/overviewscintilla.c
overview/overview/overviewui.c
[type: gettext/glade]overview/data/prefs.ui
# Pairtaghighlighter
pairtaghighlighter/src/pair_tag_highlighter.c
# PoHelper
[type: gettext/glade]pohelper/data/menus.ui
[type: gettext/glade]pohelper/data/stats.ui
pohelper/src/gph-plugin.c
# Pretty-printer
pretty-printer/src/PrettyPrinter.c
pretty-printer/src/PluginEntry.c
pretty-printer/src/ConfigUI.c
# ProjectOrganizer
projectorganizer/src/prjorg-main.c
projectorganizer/src/prjorg-menu.c
projectorganizer/src/prjorg-project.c
projectorganizer/src/prjorg-sidebar.c
# Scope
scope/data/scope.glade
scope/data/scope_gtk3.glade
scope/src/break.c
scope/src/conterm.c
scope/src/debug.c
scope/src/inspect.c
scope/src/memory.c
scope/src/menu.c
scope/src/parse.c
scope/src/plugme.c
scope/src/prefs.c
scope/src/program.c
scope/src/scope.c
scope/src/thread.c
scope/src/utils.c
scope/src/views.c
scope/src/store/scptreestore.c
# sendmail
sendmail/src/sendmail.c
# Spell Check
spellcheck/src/speller.c
spellcheck/src/scplugin.c
spellcheck/src/gui.c
# Shift Column
shiftcolumn/src/shiftcolumn.c
# Tableconvert
tableconvert/src/tableconvert.c
tableconvert/src/tableconvert_ui.c
# treebrowser
treebrowser/src/treebrowser.c
# UpdateChecker
updatechecker/src/updatechecker.c
# ViMode
vimode/src/backends/backend-geany.c
# WebHelper
webhelper/src/gwh-enum-types.c
webhelper/src/gwh-keybindings.c
webhelper/src/gwh-settings.c
webhelper/src/gwh-utils.c
webhelper/src/gwh-browser.c
webhelper/src/gwh-plugin.c
# workbench
workbench/src/dialogs.c
workbench/src/menu.c
workbench/src/plugin_main.c
workbench/src/popup_menu.c
workbench/src/search_projects.c
workbench/src/sidebar.c
workbench/src/utils.c
workbench/src/wb_globals.c
workbench/src/wb_monitor.c
workbench/src/wb_project.c
workbench/src/workbench.c
# XMLSnippets
xmlsnippets/src/plugin.c
xmlsnippets/src/xmlsnippets.c
xmlsnippets/src/tests.c
xmlsnippets/src/test-stubs.c
| {
"pile_set_name": "Github"
} |
# Kodi Media Center language file
# Addon Name: Estuary
# Addon id: skin.estuary
# Addon Provider: phil65, Ichabod Fletchman
msgid ""
msgstr ""
"Project-Id-Version: KODI Main\n"
"Report-Msgid-Bugs-To: https://github.com/xbmc/xbmc/issues/\n"
"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Kodi Translation Team\n"
"Language-Team: Swedish (Sweden) (http://www.transifex.com/projects/p/kodi-main/language/sv_SE/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sv_SE\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgctxt "#31000"
msgid "Now playing"
msgstr "Spelas just nu"
msgctxt "#31001"
msgid "Search..."
msgstr "Sök..."
msgctxt "#31002"
msgid "Show media fanart as background"
msgstr "Visa media-fanart som bakgrund"
msgctxt "#31003"
msgid "Cinema mode"
msgstr "Bioläge"
msgctxt "#31004"
msgid "Change mode"
msgstr "Ändra läge"
msgctxt "#31005"
msgid "Watch as 2D"
msgstr "Se i 2D"
msgctxt "#31006"
msgid "Random movies"
msgstr "Slumpvis utvalda filmer"
msgctxt "#31007"
msgid "Unwatched movies"
msgstr "Osedda filmer"
msgctxt "#31008"
msgid "Enable category widgets"
msgstr "Aktivera gränssnittskomponenter för kategorier"
msgctxt "#31009"
msgid "Download icons"
msgstr "Ladda ner ikoner"
msgctxt "#31010"
msgid "In progress movies"
msgstr "Pågående filmer"
msgctxt "#31011"
msgid "Most played albums"
msgstr "Mest spelade album"
msgctxt "#31012"
msgid "Random albums"
msgstr "Slumpvis utvalda album"
msgctxt "#31013"
msgid "Random artists"
msgstr "Slumpvis utvalda artister"
msgctxt "#31014"
msgid "Unplayed albums"
msgstr "Ospelade album"
msgctxt "#31015"
msgid "Recent recordings"
msgstr "Nya inspelningar"
msgctxt "#31016"
msgid "Recently played channels"
msgstr "Senast spelade kanaler"
msgctxt "#31017"
msgid "Rated"
msgstr "Betygsatt"
msgctxt "#31018"
msgid "Recently played channels"
msgstr "Senast spelade kanaler"
msgctxt "#31019"
msgid "Forecast"
msgstr "Prognos"
msgctxt "#31020"
msgid "Actions"
msgstr "Åtgärder"
msgctxt "#31021"
msgid "Misc options"
msgstr "Övriga val"
msgctxt "#31022"
msgid "Sort by"
msgstr "Sortera efter"
msgctxt "#31023"
msgid "Viewtype"
msgstr "Vy"
msgctxt "#31024"
msgid "Choose rating to display for media items"
msgstr "Välj betyg att visa för mediaobjekt"
msgctxt "#31025"
msgid "No favourites found. You can add any item from media views to this list by using the context menu."
msgstr "Inga favoriter hittades. Du kan lägga till objekt från mediavyer till den här listan genom att använda innehållsmenyn."
msgctxt "#31026"
msgid "Timeshift"
msgstr "Tidsskifte"
msgctxt "#31028"
msgid "Show fanart"
msgstr "Visa fanart"
msgctxt "#31029"
msgid "Last logged in"
msgstr "Senast inloggad"
msgctxt "#31030"
msgid "System memory usage"
msgstr "Systemets minnesanvändning"
msgctxt "#31031"
msgid "Version info"
msgstr "Versionsinfo"
msgctxt "#31032"
msgid "Order"
msgstr "Sortera"
msgctxt "#31033"
msgid "Your rating"
msgstr "Ditt betyg"
msgctxt "#31035"
msgid "Pages"
msgstr "Sidor"
msgctxt "#31036"
msgid "items"
msgstr "objekt"
msgctxt "#31037"
msgid "Selected track"
msgstr "Valda spår"
msgctxt "#31038"
msgid "Rewind"
msgstr "Spolar bakåt"
msgctxt "#31039"
msgid "Fast forward"
msgstr "Spolar framåt"
msgctxt "#31041"
msgid "Camera manufacturer"
msgstr "Kameratillverkare"
msgctxt "#31042"
msgid "Playlist options"
msgstr "Alternativ för spellista"
msgctxt "#31043"
msgid "Set the type and add rules to create a smart playlist. These playlists are dynamic and include all media items from your database which apply to your chosen rules."
msgstr "Ställ in typ och lägg till regler för att skapa en smart spellista. Dessa spellistor är dynamiska och omfattar alla mediaobjekt från databasen som matchar dina valda regler."
msgctxt "#31044"
msgid "Add group"
msgstr "Lägg till grupp"
msgctxt "#31045"
msgid "Rename group"
msgstr "Byt namn på grupp"
msgctxt "#31046"
msgid "Delete group"
msgstr "Radera grupp"
msgctxt "#31048"
msgid "Available"
msgstr "Tillgänglig"
msgctxt "#31050"
msgid "Press [B]OK[/B] to stop"
msgstr "Tryck på [B]OK[/B] för att stoppa"
msgctxt "#31052"
msgid "filtered"
msgstr "filtrerad"
msgctxt "#31053"
msgid "Arial based"
msgstr "Arialbaserad"
msgctxt "#31054"
msgid "Press [B]Left[/B] to rewind, or [B]Right[/B] to fast-forward"
msgstr "Tryck [B]Vänster[/B] för att spola bakåt eller [B]Höger[/B] för att spola framåt"
msgctxt "#31056"
msgid "Go to playlist"
msgstr "Gå till spellista"
msgctxt "#31057"
msgid "Show login screen on startup"
msgstr "Visa inloggningsskärm vid uppstart"
msgctxt "#31058"
msgid "Automatic Login on startup"
msgstr "Automatisk inloggning vid uppstart"
msgctxt "#31061"
msgid "Main menu items"
msgstr "Huvudmenyobjekt"
msgctxt "#31062"
msgid "Choose weather fanart pack"
msgstr "Välj väder-fanart paket"
msgctxt "#31063"
msgid "Sections"
msgstr "Sektioner"
msgctxt "#31065"
msgid "Video playlist"
msgstr "Spellista för video"
msgctxt "#31066"
msgid "Music playlist"
msgstr "Spellista för musik"
msgctxt "#31067"
msgid "Event log"
msgstr "Eventlogg"
msgctxt "#31068"
msgid "Choose presets"
msgstr "Välj förinställningar"
msgctxt "#31069"
msgid "Last Updated"
msgstr "Senast uppdaterad"
msgctxt "#31071"
msgid "by"
msgstr "av"
msgctxt "#31072"
msgid "Power Options"
msgstr "Energialternativ"
msgctxt "#31073"
msgid "Total length"
msgstr "Total längd"
msgctxt "#31074"
msgid "Total duration"
msgstr "Total längd"
msgctxt "#31075"
msgid "Movie sets"
msgstr "Filmsamlingar"
msgctxt "#31079"
msgid "Cast not available"
msgstr "Roller inte tillgängliga"
msgctxt "#31080"
msgid "Ends at"
msgstr "Slutar"
msgctxt "#31082"
msgid "Lyrics add-on"
msgstr "Sångtexter tillägg"
msgctxt "#31083"
msgid "Lyrics add-on settings"
msgstr "Sångtexter tilläggsinställningar"
msgctxt "#31084"
msgid "Visualisation settings"
msgstr "Visualiseringsinställningar"
msgctxt "#31089"
msgid "Available groups"
msgstr "Tillgängliga grupper"
msgctxt "#31092"
msgid "Video menu"
msgstr "Videomeny"
msgctxt "#31093"
msgid "Show weather info in top bar"
msgstr "Visa väderinformation i översta fältet"
msgctxt "#31095"
msgid "Use slide animations"
msgstr "Använd glidanimeringar"
msgctxt "#31096"
msgid "Local subtitle available"
msgstr "Lokal undertext tillgänglig"
msgctxt "#31097"
msgid "Channel options"
msgstr "Kanalalternativ"
msgctxt "#31098"
msgid "Select your Kodi user profile[CR]to login and continue"
msgstr "Välj din Kodi-användarprofil[CR]för att logga in och fortsätta"
msgctxt "#31099"
msgid "IconWall"
msgstr "Ikonvägg"
msgctxt "#31100"
msgid "Shift"
msgstr "Skifta"
msgctxt "#31101"
msgid "InfoWall"
msgstr "Infovägg"
msgctxt "#31102"
msgid "Wall"
msgstr "Vägg"
msgctxt "#31103"
msgid "Enter text here..."
msgstr "Ange text här..."
msgctxt "#31104"
msgid "Your library is currently empty. In order to populate it with your personal media, enter \"Files\" section, add a media source and configure it. After the source has been added and indexed you will be able to browse your library."
msgstr "Biblioteket är för närvarande tomt. För att fylla det med din personliga media, gå till Filsektionen, lägg till en mediakälla och konfigurera den. Efter att källan har lagts till och indexerats, kommer du att kunna bläddra i biblioteket."
msgctxt "#31105"
msgid "Add video sources and set the appropriate content type in order to populate your video libraries."
msgstr "Lägg till videokällor och ange lämpligt innehållstyp för att fylla dina videobibliotek."
msgctxt "#31106"
msgid "Teletext"
msgstr "Text-tv"
msgctxt "#31107"
msgid "WideList"
msgstr "Bred lista"
msgctxt "#31110"
msgid "Enter files section"
msgstr "Gå till filsektionen"
msgctxt "#31111"
msgid "View your personal pictures or download one of the many image add-ons from the official repository."
msgstr "Visa dina personliga bilder eller ladda ner en av de många bild tilläggen från det officiella förrådet."
msgctxt "#31112"
msgid "Toggle audio stream"
msgstr "Växla ljudström"
msgctxt "#31113"
msgid "Search local library"
msgstr "Sök i det lokala biblioteket"
msgctxt "#31114"
msgid "Search YouTube"
msgstr "Sök på Youtube"
msgctxt "#31116"
msgid "Remove this main menu item"
msgstr "Ta bort det här objektet från huvudmenyn"
msgctxt "#31117"
msgid "Edit nodes"
msgstr "Redigera noder"
msgctxt "#31118"
msgid "Enter add-on browser"
msgstr "Gå till tilläggsutforskaren"
msgctxt "#31119"
msgid "You do not have any add-ons installed yet. Visit our add-on browser to browse through our collection and improve your Kodi experience."
msgstr "Du har inte några tillägg installerade ännu. Besök vår tilläggsutforskare för att bläddra igenom vår samling och förbättra din Kodi upplevelse."
msgctxt "#31120"
msgid "You did not set up a weather provider yet. In order to view weather information, choose a weather provider and set up your location."
msgstr "Du har inte ställt in en väderleverantör ännu. För att visa väderinformation, välj en väderleverantör och ange din plats."
msgctxt "#31121"
msgid "Set weather provider"
msgstr "Ställ in väderleverantör"
msgctxt "#31122"
msgid "Unwatched TV Shows"
msgstr "Osedda tv-program"
msgctxt "#31123"
msgid "Same director"
msgstr "Samma regissör"
msgctxt "#31125"
msgid "Press up for actor info"
msgstr "Tryck upp för skådespelarinformation"
msgctxt "#31126"
msgid "Press OK to read plot"
msgstr "Tryck på OK för att läsa handling"
msgctxt "#31127"
msgid "Show icons"
msgstr "Visa ikoner"
msgctxt "#31128"
msgid "Contributors"
msgstr "Bidragsgivare"
msgctxt "#31129"
msgid "General settings applying to all areas of the skin."
msgstr "Allmänna inställningar som gäller för alla områden av skalet."
msgctxt "#31130"
msgid "Main menu-related settings: Configure the home screen to your likings."
msgstr "Huvudmeny-relaterade inställningar: Konfigurera startskärmen till ditt tycke och smak."
msgctxt "#31131"
msgid "Choose skin fanart pack"
msgstr "Välj skal-fanart paket"
msgctxt "#31132"
msgid "Select Program"
msgstr "Välj program"
msgctxt "#31133"
msgid "Select Resolution"
msgstr "Välj upplösning"
msgctxt "#31134"
msgid "Remaining"
msgstr "Återstående"
msgctxt "#31136"
msgid "Click here to see latest changes..."
msgstr "Klicka här för att se de senaste ändringarna..."
msgctxt "#31137"
msgid "PVR info"
msgstr "PVR-info"
msgctxt "#31138"
msgid "Player process info"
msgstr "Spelarprocessinfo"
msgctxt "#31139"
msgid "Video decoder"
msgstr "Videoavkodare"
msgctxt "#31140"
msgid "Pixel format"
msgstr "Pixelformat"
msgctxt "#31141"
msgid "Changes for version"
msgstr "Ändringar för version"
msgctxt "#31142"
msgid "Play speed"
msgstr "Uppspelningshastighet"
msgctxt "#31143"
msgid "You did not set up PVR yet. In order to use PVR, choose a PVR client addon and configure it. Please visit http://kodi.wiki/view/PVR to learn more."
msgstr "Du har inte konfigurerat PVR ännu. För att kunna nyttja PVR måste du välja PVR-klienttillägg, samt konfigurera det. Besök http://kodi.wiki/view/PVR för att lära dig mer."
msgctxt "#31144"
msgid "Enter add-on browser"
msgstr "Gå till tilläggsutforskaren"
msgctxt "#31145"
msgid "Search add-ons"
msgstr "Sök bland tillägg"
msgctxt "#31148"
msgid "Categories"
msgstr "Kategorier"
msgctxt "#31149"
msgid "Select genre fanart pack"
msgstr "Välj genre-fanart paket"
msgctxt "#31150"
msgid "Repository"
msgstr "Förråd"
msgctxt "#31151"
msgid "Unwatched music videos"
msgstr "Osedda musikvideor"
msgctxt "#31152"
msgid "Random music videos"
msgstr "Slumpvis utvalda musikvideor"
msgctxt "#31153"
msgid "You do not have any add-ons of this type installed. Enter the add-on browser to download add-ons created by our community."
msgstr "Du har inga tillägg av denna typ installerat. Gå till tilläggshanteraren för att hämta tillägg som skapats av vår community."
msgctxt "#31154"
msgid "Press OK to switch between locations"
msgstr "Tryck på OK för att växla mellan platser"
msgctxt "#31155"
msgid "No bookmarks created yet."
msgstr "Inga bokmärken skapade än."
msgctxt "#31156"
msgid "Choose background pattern"
msgstr "Välj bakgrundsmönster"
msgctxt "#31157"
msgid "Edit categories"
msgstr "Redigera kategorier"
msgctxt "#31158"
msgid "Touch mode"
msgstr "Pekskärmsläge"
msgctxt "#31159"
msgid "Artwork"
msgstr "Utsmyckning"
msgctxt "#31160"
msgid "Show media flags"
msgstr "Visa mediaflaggor"
msgctxt "#31161"
msgid "Numeric pad"
msgstr "Numerisk knappsats"
msgctxt "#31162"
msgid "Play your personal games or download one of the many game add-ons from the official repository."
msgstr "Spela dina egna spel eller ladda ned någon av de många speltillägg från det officiella förrådet."
msgctxt "#31163"
msgid "Show Fanart background"
msgstr "Visa Fanart-bakgrund"
msgctxt "#31164"
msgid "Choose kind of profile identification"
msgstr "Välj typ av profilidentifiering"
msgctxt "#31165"
msgid "Profile name"
msgstr "Profilnamn"
msgctxt "#31166"
msgid "Profile avatar"
msgstr "Profil avatar"
msgctxt "#31167"
msgid "Animate background"
msgstr "Animera bakgrund"
| {
"pile_set_name": "Github"
} |
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function createSuiteWithWarmup( name, count, fn) {
new BenchmarkSuite(name, [count], [
new Benchmark(name, true, false, 0, fn),
]);
}
const inputs = [
'I\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\u2603\uD83D\uDCA9\uFFFD',
'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'Integer eu augue suscipit, accumsan ipsum nec, sagittis sem.',
'In vitae pellentesque dolor. Curabitur leo nunc, luctus vitae',
'risus eget, fermentum hendrerit justo.',
];
const first = 'I';
function helper(fn) {
let sum = 0;
for (const input of inputs) {
sum += fn(input);
}
return sum;
}
function startsWith(string) {
return string.startsWith(first);
}
function startsIndex(string) {
return string[0] === first;
}
function endsWith(string) {
return string.endsWith(first);
}
function endsIndex(string) {
return string[string.length - 1] === first;
}
createSuiteWithWarmup('startsWith', 1, () => helper(startsWith));
createSuiteWithWarmup('startsIndex', 1, () => helper(startsIndex));
createSuiteWithWarmup('endsWith', 1, () => helper(endsWith));
createSuiteWithWarmup('endsIndex', 1, () => helper(endsIndex));
| {
"pile_set_name": "Github"
} |
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2010-2014 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*/
// Portions Copyright [2017-2018] [Payara Foundation and/or its affiliates]
package com.sun.enterprise.security.ee.auth.login;
import static java.util.logging.Level.SEVERE;
import java.util.Set;
import java.util.logging.Level;
import javax.security.auth.login.LoginException;
import org.jvnet.libpam.PAM;
import org.jvnet.libpam.PAMException;
import org.jvnet.libpam.UnixUser;
import com.sun.appserv.security.AppservPasswordLoginModule;
import com.sun.enterprise.security.auth.realm.pam.PamRealm;
/**
* This is the main LoginModule for PAM realm that invokes the calls to libpam4j classes to authenticate the given
* username and password
*
* @author Nithya Subramanian
*/
public class PamLoginModule extends AppservPasswordLoginModule {
protected void authenticateUser() throws LoginException {
// A Unix user must have a name not null so check here.
if ((_username == null) || (_username.length() == 0)) {
throw new LoginException("Invalid Username");
}
UnixUser user = authenticate(_username, _password);
if (user == null) { // JAAS behavior
throw new LoginException("Failed Pam Login for " + _username);
}
if (_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "PAM login succeeded for: " + _username);
}
/*
* Get the groups from the libpam4j UnixUser class that has been returned after a successful authentication.
*/
String[] grpList = null;
Set<String> groupSet = user.getGroups();
if (groupSet != null) {
grpList = new String[groupSet.size()];
user.getGroups().toArray(grpList);
} else {
// Empty group list, create a zero-length group list
grpList = new String[0];
}
commitUserAuthentication(grpList);
}
/**
* Invokes the authentication call.This class uses the default PAM service - sshd
*
* @param username OS User to authenticate.
* @param password Given password.
* @returns null if authentication failed, returns the UnixUser object if authentication succeeded.
*
*/
private UnixUser authenticate(String username, String password) throws LoginException {
UnixUser user = null;
String pamService = null;
if (_currentRealm instanceof PamRealm) {
pamService = ((PamRealm) _currentRealm).getPamService();
} else {
throw new LoginException("pamrealm.invalid_realm");
}
try {
user = new PAM(pamService).authenticate(username, password);
} catch (PAMException e) {
_logger.log(SEVERE, "pam_exception_authenticate", e);
}
return user;
}
}
| {
"pile_set_name": "Github"
} |
# Microsoft Developer Studio Project File - Name="conv_dash_marker" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=conv_dash_marker - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "conv_dash_marker.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "conv_dash_marker.mak" CFG="conv_dash_marker - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "conv_dash_marker - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "conv_dash_marker - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "conv_dash_marker - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /out:"./conv_dash_marker.exe"
!ELSEIF "$(CFG)" == "conv_dash_marker - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "conv_dash_marker - Win32 Release"
# Name "conv_dash_marker - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\..\..\src\agg_arc.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_arrowhead.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_bezier_arc.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\ctrl\agg_cbox_ctrl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_curves.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_gsv_text.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\platform\win32\agg_platform_support.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\ctrl\agg_rbox_ctrl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_rounded_rect.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\ctrl\agg_slider_ctrl.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_trans_affine.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_vcgen_contour.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_vcgen_dash.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_vcgen_markers_term.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_vcgen_smooth_poly1.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\agg_vcgen_stroke.cpp
# End Source File
# Begin Source File
SOURCE=..\..\..\src\platform\win32\agg_win32_bmp.cpp
# End Source File
# Begin Source File
SOURCE=..\..\conv_dash_marker.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
| {
"pile_set_name": "Github"
} |
d1bfcefb3e66dbac4e84a791e2d459864d2ed9a6439417a935e626bd3f8bf82daa351868f5e39e005023ca3f7cbed9c09362263ec39958f14af0adbd663b826a
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{5c673951-5083-408a-a3de-a63babf1344b}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{75631612-a2f0-4a60-80e8-cd36f92f4a73}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
<Filter Include="Header Files\win32">
<UniqueIdentifier>{0d0e6712-502c-46f9-b0e5-e14256cf6143}</UniqueIdentifier>
</Filter>
<Filter Include="Assembly Files %28x86%29">
<UniqueIdentifier>{f8e51076-77af-4e45-90bf-adf37a8929fc}</UniqueIdentifier>
<Extensions>asm</Extensions>
</Filter>
<Filter Include="Assembly Files %28AMD64%29">
<UniqueIdentifier>{710e4e94-dd20-48a6-8e4d-8c9b28bb7584}</UniqueIdentifier>
</Filter>
<Filter Include="Precompiled Header Support">
<UniqueIdentifier>{811fdd7e-ea30-44c3-8790-87fb8cd7109f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\bitmath.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\cache.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\cmdline.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\cpuaccel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\date.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\debug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\debugx86.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Error.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\error_win32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\event.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\file.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\fileasync.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\filesys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\filewatcher.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\Fraction.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\halffloat.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\hash.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\int128.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\linearalloc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\list.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\log.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\math.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\memory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\profile.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\progress.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\protscope.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\refcount.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\registry.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\strutil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\text.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\thread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\thunk.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\time.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\tls.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\vdalloc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\VDNamespace.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\VDScheduler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\vdstl.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\VDString.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\vectors.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\w32assist.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\zip.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\stdaccel.cpp">
<Filter>Precompiled Header Support</Filter>
</ClCompile>
<ClCompile Include="source\stdafx.cpp">
<Filter>Precompiled Header Support</Filter>
</ClCompile>
<ClCompile Include="source\process.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\h\vd2\system\source\registrymemory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\vdstl_hash.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\vdstl_hashtable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\filestream.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\h\vd2\system\atomic.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\binary.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\bitmath.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\cache.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\cmdline.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\cpuaccel.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\date.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\debug.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\debugx86.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\Error.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\event.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\file.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\fileasync.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\filesys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\filewatcher.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\Fraction.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\halffloat.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\hash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\int128.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\list.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\math.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\memory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\profile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\progress.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\protscope.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\refcount.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\registry.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\seh.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\strutil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\text.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\thread.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\thunk.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\time.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\tls.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\unknown.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdalloc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\VDNamespace.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\VDQueue.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\VDRingBuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\VDScheduler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstdc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\VDString.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdtypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vectors.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vectors_float.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vectors_int.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\w32assist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\zip.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\win32\intrin.h">
<Filter>Header Files\win32</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\win32\miniwindows.h">
<Filter>Header Files\win32</Filter>
</ClInclude>
<ClInclude Include="h\stdafx.h">
<Filter>Precompiled Header Support</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\linearalloc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\process.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\registrymemory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstl_hash.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstl_hashmap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstl_hashset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstl_hashtable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\h\vd2\system\vdstl_vector.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<YASM Include="source\a_memory.asm">
<Filter>Assembly Files %28x86%29</Filter>
</YASM>
<YASM Include="source\a_thunk.asm">
<Filter>Assembly Files %28x86%29</Filter>
</YASM>
<YASM Include="source\a64_cpuaccel.asm">
<Filter>Assembly Files %28AMD64%29</Filter>
</YASM>
<YASM Include="source\a64_fraction.asm">
<Filter>Assembly Files %28AMD64%29</Filter>
</YASM>
<YASM Include="source\a64_int128.asm">
<Filter>Assembly Files %28AMD64%29</Filter>
</YASM>
<YASM Include="source\a64_thunk.asm">
<Filter>Assembly Files %28AMD64%29</Filter>
</YASM>
</ItemGroup>
</Project> | {
"pile_set_name": "Github"
} |
#
# Makefile for the Linux proc filesystem routines.
#
CFLAGS_vmcore.o = -O
obj-y += proc.o
proc-y := nommu.o task_nommu.o
proc-$(CONFIG_MMU) := task_mmu.o
proc-y += inode.o root.o base.o generic.o array.o \
fd.o
proc-$(CONFIG_TTY) += proc_tty.o
proc-y += cmdline.o
proc-y += consoles.o
proc-y += cpuinfo.o
proc-y += devices.o
proc-y += interrupts.o
proc-y += loadavg.o
proc-y += meminfo.o
proc-y += stat.o
proc-y += uptime.o
proc-y += version.o
proc-y += softirqs.o
proc-y += namespaces.o
proc-y += self.o
proc-y += thread_self.o
proc-$(CONFIG_PROC_SYSCTL) += proc_sysctl.o
proc-$(CONFIG_NET) += proc_net.o
proc-$(CONFIG_PROC_KCORE) += kcore.o
proc-$(CONFIG_PROC_VMCORE) += vmcore.o
proc-$(CONFIG_PRINTK) += kmsg.o
proc-$(CONFIG_PROC_PAGE_MONITOR) += page.o
| {
"pile_set_name": "Github"
} |
# copies of usefulbash commands
# start tensorboard server with only the rewards
tensorboard --logdir=run1:./results/new_flex/tensorboard/dqn1/rl,run2:./results/new_flex/tensorboard/dqn2/rl,run3:./results/new_flex/tensorboard/dqn3/rl,autoflex:./results/new_flex/tensorboard/autoflex/rl
# copy results to local machine
rsync -chavzP --exclude 'tensorboard' --exclude 'env_histories' --exclude '*.log'
[email protected]:/home/adam/git/energypy/energypy/experiments/results/new_flex
/Users/adam/Downloads
| {
"pile_set_name": "Github"
} |
uniform sampler2D nMap;
vec4 godrays(vec2 uv)
{
const int NUM_SAMPLES = 30 ;
float exposure = 0.0007;
float density = 1.;
float weight = 10.; //6.5;
vec2 pos = uv;
// FIXME: position du Soleil
vec2 lightPositionOnScreen = vec2(0.8, 0.38);
// afficher la position du soleil
//if (length(pos - lightPositionOnScreen) < 0.05)
//return vec4(0.);
vec2 deltaTextCoord = vec2(uv - lightPositionOnScreen.xy);
float dist = length(deltaTextCoord);
deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * density;
float col = 0.;
for (int i = 0; i < NUM_SAMPLES ; i++)
{
pos -= deltaTextCoord;
float sample = smoothstep(0.999, 1., texture2D(nMap, pos).r);;
sample *= weight;
col += sample;
}
col *= exposure;
col /= pow(max(dist, 0.01), 0.2);
// De jour:
return vec4(col) * vec4(.6, .6, .6, 0.);
// De nuit
// return vec4(col) * vec4(1., 0.2, 0., 0.);
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Illuminate\Foundation\Testing\Concerns;
use Closure;
use Illuminate\Foundation\Mix;
use Mockery;
trait InteractsWithContainer
{
/**
* The original Laravel Mix handler.
*
* @var \Illuminate\Foundation\Mix|null
*/
protected $originalMix;
/**
* Register an instance of an object in the container.
*
* @param string $abstract
* @param object $instance
* @return object
*/
protected function swap($abstract, $instance)
{
return $this->instance($abstract, $instance);
}
/**
* Register an instance of an object in the container.
*
* @param string $abstract
* @param object $instance
* @return object
*/
protected function instance($abstract, $instance)
{
$this->app->instance($abstract, $instance);
return $instance;
}
/**
* Mock an instance of an object in the container.
*
* @param string $abstract
* @param \Closure|null $mock
* @return \Mockery\MockInterface
*/
protected function mock($abstract, Closure $mock = null)
{
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args())));
}
/**
* Mock a partial instance of an object in the container.
*
* @param string $abstract
* @param \Closure|null $mock
* @return \Mockery\MockInterface
*/
protected function partialMock($abstract, Closure $mock = null)
{
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))->makePartial());
}
/**
* Spy an instance of an object in the container.
*
* @param string $abstract
* @param \Closure|null $mock
* @return \Mockery\MockInterface
*/
protected function spy($abstract, Closure $mock = null)
{
return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args())));
}
/**
* Register an empty handler for Laravel Mix in the container.
*
* @return $this
*/
protected function withoutMix()
{
if ($this->originalMix == null) {
$this->originalMix = app(Mix::class);
}
$this->swap(Mix::class, function () {
return '';
});
return $this;
}
/**
* Register an empty handler for Laravel Mix in the container.
*
* @return $this
*/
protected function withMix()
{
if ($this->originalMix) {
$this->app->instance(Mix::class, $this->originalMix);
}
return $this;
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/ruby
l=gets.to_i
n=l.bit_length
a=[];b=1
(n-1).times{|i|*q=n+~i,n-i;a<<q+[1<<i]<<q+[0];b&l>0&&a<<[1,n-i,l^=b];b*=2}
[[n,a.size],*a].map{|e|puts e*' '}
| {
"pile_set_name": "Github"
} |
To get the latest version, please visit http://neyric.github.com/wireit
---------------------------------------------------------------------------
Version 3.0.0pr2
Changeset:
* Complete rewrite of WireIt using YUI 3.6.0
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="isometric" renderorder="right-down" width="10" height="10" tilewidth="64" tileheight="32" nextobjectid="1">
<tileset firstgid="1" name="tileset" tilewidth="64" tileheight="64">
<image source="isometric_tileset.png" width="512" height="448"/>
</tileset>
<layer name="Ground" width="10" height="10">
<data encoding="base64" compression="zlib">
eJxjYWBgYAFiESBmBmI2IGbEglnwqGMioI4JzSwmAuYRay+y3dQwj5A/iDWPCYuZxJoHAF5jAaw=
</data>
</layer>
<layer name="Collisions" width="10" height="10">
<data encoding="base64" compression="zlib">
eJxjYEAFFgy4gRYSWx+ITdHwKKAcAADjxwFm
</data>
</layer>
</map>
| {
"pile_set_name": "Github"
} |
VERSION_NAME=1.0.1
VERSION_CODE=2
GROUP=com.github.baneizalfe.pulltodismisspager
POM_DESCRIPTION=PullToDismissPager is an Android Open Source Library for showing ViewPager in similar way Facebook app does in its Friend Request Section
POM_URL=https://github.com/baneizalfe/PullToDismissPager
POM_SCM_URL=https://github.com/baneizalfe/PullToDismissPager
POM_SCM_CONNECTION=scm:[email protected]:baneizalfe/PullToDismissPager.git
POM_SCM_DEV_CONNECTION=scm:[email protected]:baneizalfe/PullToDismissPager.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=baneizalfe
POM_DEVELOPER_NAME=Marko Milovanovic
ANDROID_BUILD_TARGET_SDK_VERSION=20
ANDROID_BUILD_TOOLS_VERSION=20.0.0
ANDROID_BUILD_SDK_VERSION=20
ANDROID_MIN_SDK_VERSION=8 | {
"pile_set_name": "Github"
} |
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# https://www.morningstarsecurity.com/research/whatweb
##
Plugin.define do
name "Hotaru-CMS"
authors [
"Brendan Coles <[email protected]>", # 2011-08-17
]
version "0.1"
description "Hotaru CMS is an open source, plugin-powered PHP content management system (CMS)"
website "http://hotarucms.org/"
# Matches #
matches [
# Version Detection # Meta Generator
{ :version=>/<meta name="generator" content="Hotaru CMS ([^\s^"^>]+)" \/>/ },
]
end
| {
"pile_set_name": "Github"
} |
{
"globalTagDefaults" : {
"paletteSwaps" : ""
},
"animatedParts" : {
"stateTypes" : {
"swoosh" : {
"default" : "idle",
"states" : {
"idle" : {
},
"fire" : {
"frames" : 3,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "idle"
},
"fire2" : {
"frames" : 3,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "idle"
},
"fire3" : {
"frames" : 3,
"cycle" : 0.1,
"mode" : "transition",
"transition" : "idle"
}
}
}
},
"parts" : {
"blade" : {
"properties" : {
"zLevel" : 0,
"fullbright" : true,
"centered" : true,
"image" : "<partImage><paletteSwaps>?<directives>?<bladeDirectives>",
"offset" : [0, 2],
"transformationGroups" : ["weapon"],
"rotationCenter" : [0, 0],
"damageArea" : [ [-0.7, -1.0], [-0.7, 2.5], [0.5, 2.5], [0.5, -1.0] ]
}
},
"bladefullbright" : {
"properties" : {
"zLevel" : 1,
"centered" : true,
"image" : "<partImage><paletteSwaps>?<directives>?<bladeDirectives>",
"offset" : [0, 2],
"transformationGroups" : ["weapon"],
"rotationCenter" : [0, 0],
"damageArea" : [ [-0.7, -1.0], [-0.7, 2.5], [0.5, 2.5], [0.5, -1.0] ]
}
},
"handle" : {
"properties" : {
"zLevel" : 1,
"centered" : true,
"image" : "<partImage><paletteSwaps>?<directives>",
"offset" : [0, 2],
"transformationGroups" : ["weapon"],
"rotationCenter" : [0, 0]
}
},
"swoosh" : {
"properties" : {
"zLevel" : -1,
"centered" : true,
"transformationGroups" : ["swoosh"],
"rotationCenter" : [0, 0]
},
"partStates" : {
"swoosh" : {
"idle" : {
"properties" : {
"image" : ""
}
},
"fire" : {
"properties" : {
"image" : "/items/active/weapons/melee/broadsword/swoosh/<elementalType>swoosh.png:<frame>",
"offset" : [0, 2.5],
"damageArea" : [[-5, 2], [-2.5, 3], [1, 3], [4, 1.75], [5, -0.25], [5, -2.25], [4, -3.25], [0, -2.5]]
}
},
"fire2" : {
"properties" : {
"image" : "/items/active/weapons/melee/broadsword/swoosh2/<elementalType>swoosh.png:<frame>",
"offset" : [5.0, 0.5],
"damageArea" : [[-4, 1], [2, 1], [2, -1], [-4, -1]]
}
},
"fire3" : {
"properties" : {
"image" : "/items/active/weapons/melee/broadsword/swoosh3/<elementalType>swoosh.png:<frame>",
"offset" : [3.5, 0],
"damageArea" : [[-4.75, 1], [2, 1], [2, -1], [-4.75, -1]]
}
}
}
}
}
}
},
"transformationGroups" : {
"weapon" : {},
"swoosh" : {}
},
"particleEmitters" : {
"physicalswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 1,
"burstCount" : 1,
"particles" : []
},
"fireswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 4,
"particles" : [
{ "particle" : "fireswoosh1"},
{ "particle" : "fireswoosh2"},
{ "particle" : "fireswoosh3"}
]
},
"electricswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "electricswoosh1"},
{ "particle" : "electricswoosh2"},
{ "particle" : "electricswoosh2"}
]
},
"poisonswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "poisonswoosh1"},
{ "particle" : "poisonswoosh2"},
{ "particle" : "fireswoosh2"}
]
},
"iceswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "iceswoosh1"},
{ "particle" : "iceswoosh2"},
{ "particle" : "iceswoosh3"}
]
},
"shadowswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "shadowswoosh1"},
{ "particle" : "shadowswoosh2"},
{ "particle" : "shadowswoosh3"}
]
},
"radioactiveswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 40,
"offsetRegion" : [-2.25, -0.25, 0.0, 2.5],
"particles" : [
{ "particle" : "radioactiveswoosh1"},
{ "particle" : "radioactiveswoosh2"},
{ "particle" : "poisonswoosh2"}
]
},
"cosmicswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 40,
"offsetRegion" : [-2.25, -0.25, 0.0, 2.5],
"particles" : [
{ "particle" : "cosmicswoosh1"},
{ "particle" : "cosmicswoosh2"},
{ "particle" : "cosmicswoosh3"}
]
},
"silverweaponswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "fireswoosh1"},
{ "particle" : "fireswoosh2"},
{ "particle" : "fireswoosh3"}
]
},
"hellfireswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "fireswoosh1"},
{ "particle" : "fireswoosh2"},
{ "particle" : "fireswoosh3"}
]
},
"aetherswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 40,
"offsetRegion" : [-2.25, -0.25, 0.0, 2.5],
"particles" : [
{ "particle" : "cosmicswoosh1"},
{ "particle" : "cosmicswoosh2"},
{ "particle" : "cosmicswoosh3"},
{ "particle" : "cosmicswoosh1"},
{ "particle" : "cosmicswoosh2"},
{ "particle" : "cosmicswoosh3"}
]
},
"bioweaponswoosh" : {
"active" : false,
"transformationGroups" : ["swoosh"],
"emissionRate" : 50,
"burstCount" : 3,
"particles" : [
{ "particle" : "poisonswoosh1"},
{ "particle" : "poisonswoosh2"},
{ "particle" : "fireswoosh2"},
{ "particle" : "poisonswoosh1"},
{ "particle" : "poisonswoosh2"},
{ "particle" : "fireswoosh2"}
]
}
},
"sounds" : {
"fire" : [ ],
"fire2" : [ ],
"fire3" : [ ],
"crit" : [ "/sfx/melee/axe_kill_organic2.ogg" ],
"nightar" : [ "/sfx/weapons/energypew.ogg" ]
}
}
| {
"pile_set_name": "Github"
} |
apiVersion: v1
kind: ServiceAccount
metadata:
name: nexus-operator
namespace: "{{ ocp4_workload_nexus_operator_project }}"
| {
"pile_set_name": "Github"
} |
"use strict";
(function() {
function log(code: string, message?: string, success?: boolean) {
message = message || '';
if (document && document.body) {
if (message) {
message = $.views.converters.html(message);
message = success === undefined ? "<br/>==== <b><em>" + message + "</em></b> ====<br/>" : message;
}
if (success === false) {
message += ": <b>Failure</b>";
}
if (code !== undefined) {
code = $.views.converters.html(code);
message = arguments.length>1 ? "<code>" + code + "...</code> " + message : "log: " + "<code>" + code + "</code> ";
}
$(document.body).append(message + "<br/>");
} else {
if (success === undefined) {
message = "==== " + message + " ====";
} else {
if (code) {
message = code + "... " + message;
}
if (!success) {
message += ": Failure";
}
}
console.log(message);
}
}
let assert = {
equal: function(a: string, b: string, code: string, message?: string) {
log(code, message || '', a === b);
},
ok: function(a: boolean, code: string, message?: string) {
log(code, message || '', a);
},
testGroup: function(message: string) {
log('', message);
}
};
function text() {
return $("#result").text();
}
$(document.body).append('<div style="display: none;" id="result"></div>');
$.views.settings.trigger(false);
/*<<<<<<<<<<<<<*/ assert.testGroup("$.templates, and basic link"); /*>>>>>>>>>>>>>*/
$(document.body).append('<script id="myTmpl" type="text/x-jsrender">{^{:name}} </script>');
let tmpl = $.templates("#myTmpl");
assert.ok(tmpl.markup === "{^{:name}} ", 'tmpl = $.templates("#myTmpl")');
assert.ok($.views.templates("#myTmpl").markup === "{^{:name}} ", 'tmpl = $.views.templates("#myTmpl")');
assert.ok($.views.templates === $.templates, '$.views.templates === $.templates');
let data = { name: "Jo" };
tmpl.link("#result", data);
assert.ok(text() === "Jo ", 'tmpl.link(...)', 'Template link');
$.templates("myTmpl", "#myTmpl");
data = { name: "Bob" };
$.templates.myTmpl.link("#result", data);
assert.ok(text() === "Bob ", '$.templates("myTmpl", "#myTmpl"); $.templates.myTmpl.link(...)', 'Named template as expando on $.templates');
let array = [{ name: "Jo" }, { name: "Amy" }, { name: "Bob" }];
tmpl.link("#result", array);
assert.ok(text() === "Jo Amy Bob ", 'tmpl.link("#result", array)', 'Link array');
let helpers = {
title: "Mr"
};
tmpl = $.templates("tmplFromString", "{^{:~title}} {^{:name}}. ");
assert.ok(tmpl.tmplName + tmpl.markup + tmpl.useViews === "tmplFromString{^{:~title}} {^{:name}}. true", 'tmpl.tmplName + tmpl.markup + tmpl.useViews', 'tmpl properties');
/*<<<<<<<<<<<<<*/ assert.testGroup("link() access helpers and set noIteration"); /*>>>>>>>>>>>>>*/
tmpl.link("#result", array, helpers);
assert.ok(text() === "Mr Jo. Mr Amy. Mr Bob. ", 'tmpl.link(..., array, helpers)', 'Access helpers');
$.views.helpers("title", "Sir");
tmpl.link("#result", array, helpers);
assert.ok(text() === "Mr Jo. Mr Amy. Mr Bob. ", 'tmpl.link(..., array, helpers)', 'Access helpers');
tmpl.link("#result", array);
assert.ok(text() === "Sir Jo. Sir Amy. Sir Bob. ", 'tmpl.link(..., array, helpers)', 'Access helpers');
tmpl = $.templates("{^{:length}} {^{for}}{^{:~title}} {^{:name}} {{/for}}");
tmpl.link("#result", array, helpers, true);
assert.ok(text() === "3 Mr Jo Mr Amy Mr Bob ", 'tmpl.link(..., array, helpers, true)', 'Link array, no iteration');
tmpl.link("#result", array, true);
assert.ok(text() === "3 Sir Jo Sir Amy Sir Bob ", 'tmpl.link(..., array, true)', 'Link array, no iteration');
$("#result").link(tmpl, array, helpers, true);
assert.ok(text() === "3 Mr Jo Mr Amy Mr Bob ", '$("#result").link(tmpl, array, helpers, true)', 'Link array, no iteration');
$("#result").link(tmpl, array, true);
assert.ok(text() === "3 Sir Jo Sir Amy Sir Bob ", '$("#result").link(tmpl, array, true)', 'Link array, no iteration');
$.observable(array).insert({name: "Jane"});
$.observable(helpers).setProperty({title: "Chief"});
$.observable(array[0]).setProperty({name: "Fiona"});
$("#result").link(tmpl, array, helpers, true);
assert.ok(text() === "4 Chief Fiona Chief Amy Chief Bob Chief Jane ", '$("#result").link(tmpl, array, helpers, true)', 'Observable changes');
$.views.helpers("title", null);
tmpl.link("#result", array, true);
assert.ok(text() === "4 Fiona Amy Bob Jane ", '$.views.helpers("title", null); ...tmpl.link(..., array, true)', 'Unregister named helper, then link array, no iteration');
/*<<<<<<<<<<<<<*/ assert.testGroup("Compile template with private resources"); /*>>>>>>>>>>>>>*/
tmpl = $.templates({
markup: "{^{:~title}}{^{:~title2}}{^{:~title3}} {^{upper:name}} {^{full/}} {{include tmpl='inner2'/}}{{include tmpl='inner'/}}",
converters: { // private converter
upper: function(val) {
return val.toUpperCase();
}
},
tags: { // private tag
full: "{{upper:~title}} {{:name}}"
},
helpers: { // private helper
title: "Mr"
},
templates: { // private template
inner: "Inner: {{:~title}} {{:name}} {{full/}} {{short/}}"
}
});
$.views.converters({lower: function(val) {return val.toLowerCase();}}, tmpl); // Additional private converter
$.templates("inner2", "Inner2", tmpl); // Additional private template
$.views.helpers({title2: "Sir",
title3: "Ms",
myob: {amount: 33},
myfn: function(a: number) {return a + 10;}
}, tmpl); // Additional private helpers
$.views.tags("short", "{{lower:name}} ", tmpl); // Additional private tag
tmpl.link("#result", array);
$.observable(array).remove(0);
assert.ok(text() === "MrSirMs AMY MR Amy Inner2Inner: Mr Amy MR Amy amy MrSirMs BOB MR Bob Inner2Inner: Mr Bob MR Bob bob MrSirMs JANE MR Jane Inner2Inner: Mr Jane MR Jane jane ",
'tmpl = $.templates({markup: ..., converters: tags ... etc', 'Compile template with resources');
assert.equal(
tmpl.converters.upper("jo") +
tmpl.converters.lower("JO") +
tmpl.tags.short.template.markup +
tmpl.helpers.title +
tmpl.helpers.title2 +
tmpl.helpers.title3 +
tmpl.helpers.myob.amount +
tmpl.helpers.myfn(5) +
tmpl.templates.inner.markup +
tmpl.templates.inner2.markup,
"JOjo{{lower:name}} MrSirMs3315Inner: {{:~title}} {{:name}} {{full/}} {{short/}}Inner2",
'tmpl.converters.upper("jo") ... +tmpl.templates.inner2.markup',
"Accessing tmpl resources");
/*<<<<<<<<<<<<<*/ assert.testGroup("template.useViews"); /*>>>>>>>>>>>>>*/
assert.ok(!$.templates("{{for/}}").useViews, '$.templates("{{for/}}").useViews' , "useViews defaults to false");
assert.ok($.templates({
markup: "{{for/}}",
useViews: true
}).useViews, '$.templates({ ... useViews: true, ...})', "useViews forced to true");
assert.ok($.templates("{{for}}{{:#parent}}{{/for}}").useViews, '$.templates("{{for}}{{:#parent}}{{/for}}").useViews', "useViews defaults to true");
/*<<<<<<<<<<<<<*/ assert.testGroup("$.views.tags()"); /*>>>>>>>>>>>>>*/
let tag = $.views.tags("add", function(val1, val2) { return val1 + "|" + val2; });
let test = tag._is;
tmpl = $.templates("{^{add first last foo=last/}} {^{privateadd first last /}}");
tag = $.views.tags("privateadd", function(val1, val2) { return val1 + "!!" + val2; }, tmpl);
test += tag._is;
assert.equal(test + tmpl({first: "A", last: "B"}), "tagtagA|B A!!B", '$.views.tags("add", function() { ... })', "create tag from function, public or private");
$.views
.tags({add: "{{: ~tagCtx.args[0] + '&' + ~tagCtx.args[1]}}"}) // Create public tag (replaces previous version)
.tags({privateadd: "{{: ~tagCtx.args[0] + '$$' + ~tagCtx.args[1]}}"}, tmpl); // Create private tag (replaces previous version)
assert.equal(tmpl({first: "A", last: "B"}), "A&B A$$B", '$.views.tags("add", "...")', "create tag from string, public or private");
$.views.tags("add", {
init: function(tagCtx, linkCtx, ctx) {
this.baseApply(arguments);
test = this.sortDataMap;
this.foo = tagCtx.props.foo;
test = this.render();
this.template = {markup: "bar"};
},
render: function(val1, val2) {
return val1 + "==" + val2 + ":" + this.foo + "?" + this.ctxPrm("xfoo");
},
template: {markup: "none"},
baseTag: "for",
contentCtx: true, // function() { return "aaa"; },
convert: function(val1, val2) {
return [val1.toLowerCase(), val2.toLowerCase()];
},
argDefault: true,
bindTo: [0, "foo"],
bindFrom: [0, "foo"],
flow: false,
ctx: { x: 'myctx' },
dataBoundOnly: true,
boundProps: ["a", "b"],
depends: function() { return "foo"; },
mapProps: ["a2", "b2"],
mapDepends: function() { return "foo"; },
setSize: true,
height: 23,
width: "3em",
className: "blue",
linkedElement: [".a", "b"],
linkedCtxParam: ["w", "xfoo"],
mainElement: "#d",
displayElement: "#e",
trigger: true,
attr: "html",
dataMap: null,
lateRender: false,
onAfterLink: function(tagCtx, linkCtx, ctx, ev, eventArgs) {},
onBind: function(tagCtx, linkCtx, ctx, ev, eventArgs) {},
onUnbind: function(tagCtx, linkCtx, ctx, ev, eventArgs) {},
onUpdate: false,
onDispose: function() {},
convertBack: "upper",
onBeforeUpdateVal: function(ev, eventArgs) {},
onBeforeChange: function(ev, eventArgs) {},
onAfterChange: function(ev, eventArgs) {},
onArrayChange: function(ev, eventArgs) {},
setValue: function(value, index, elseBlock) {},
domChange: function() {},
});
$.views.tags({privateadd: {
template: {markup: "none"},
}}, tmpl);
tmpl.link("#result", {first: "Aval", last: "Bval"});
test = $.views.tags.add.foo;
assert.equal(text(), "aval==Bval:Bval?bval none", '$.views.tags("add", {...})', "create tag from tagOptions hash, public or private");
/*<<<<<<<<<<<<<*/ assert.testGroup("$.views.converters()"); /*>>>>>>>>>>>>>*/
let converter = $.views.converters("add", function(val1, val2) { return val1 + "|" + val2 + ", "; });
test = converter("a", "b");
tmpl = $.templates("{{add: first last}} {{privateadd: first last}}");
converter = $.views.converters({privateadd: function(val1, val2) { return val1 + "!!" + val2 + ", "; }}, tmpl)
.converters.privateadd; // returns views, then access private converter resource 'privateadd'
test += converter("c", "d");
assert.equal(test + "--" + tmpl({first: "A", last: "B"}), "a|b, c!!d, --A|B, A!!B, ",
'$.views.converters("add", function() { ... })', "register converter, public or private");
converter = $.views.converters("add", null);
assert.ok(converter === null && $.views.converters.add === undefined, '$.views.converters("...", null)', "unregister converter");
/*<<<<<<<<<<<<<*/ assert.testGroup("$.views.helpers()"); /*>>>>>>>>>>>>>*/
let helper = $.views.helpers("add", function(val1: string, val2: string) { return val1 + "|" + val2 + ", "; });
test = helper("a", "b");
tmpl = $.templates("{{:~add(first, last)}} {{:~privateadd(first, last)}}");
helper = $.views.helpers({privateadd: function(val1: string, val2: string) { return val1 + "!!" + val2 + ", "; }}, tmpl)
.helpers.privateadd; // returns views, then access private helper resource 'privateadd'
test += helper("c", "d");
assert.equal(test + "--" + tmpl({first: "A", last: "B"}), "a|b, c!!d, --A|B, A!!B, ",
'$.views.helpers("add", function() { ... })', "register helper, public or private");
helper = $.views.helpers("add", null);
assert.ok(helper === null && $.views.helpers.add === undefined, '$.views.helpers("...", null)', "unregister helper");
/*<<<<<<<<<<<<<*/ assert.testGroup("$.views.viewModels()"); /*>>>>>>>>>>>>>*/
let Book = $.views.viewModels({
getters: ["title", "price"],
extend: {nameAndPrice: function(reverse?: boolean) {
return reverse ? this._price + " for " + this._title : this._title + ": " + this._price;
}}
});
let book1 = Book("Hope", "$1.50");
assert.ok(book1.title() + ": " + book1.price() === "Hope: $1.50"
&& book1.nameAndPrice() === "Hope: $1.50"
&& book1.nameAndPrice(true) === "$1.50 for Hope",
'VM=$.views.viewModels(vmOptions)', "Create VM, instantiate and access members");
tmpl = $.templates("Title: {{:title()}}, Price: {{:price()}}, PriceName: {{:nameAndPrice(true)}}");
tmpl.link("#result", book1);
assert.ok(text() === "Title: Hope, Price: $1.50, PriceName: $1.50 for Hope",
'tmpl.link("#result", book1)', "Link vm instance with template");
book1.title(book1.title() + "+");
book1.price(book1.price() + "+");
tmpl.link("#result", book1);
assert.ok(text() === "Title: Hope+, Price: $1.50+, PriceName: $1.50+ for Hope+",
'book1.title(newValue)', "Modify vm instance, with setters, then link template");
let MyVMs: JsViews.Hash<JsViews.ViewModel> = {};
Book = $.views.viewModels("Bk", {
getters: ["title", "price"],
extend: {nameAndPrice: function(reverse: boolean) {
return reverse ? this._price + " for " + this._title : this._title + ":" + this._price;
}}
});
assert.ok(Book===$.views.viewModels.Bk, '$.views.viewModels("Bk", vmOptions)', "Register named VM");
Book = $.views.viewModels("Bk", {
getters: ["title", "price"],
extend: {nameAndPrice: function(reverse: boolean) {
return reverse ? this._price + " for " + this._title : this._title + ":" + this._price;
}}
}, MyVMs);
assert.ok(Book===MyVMs.Bk, '$.views.viewModels("Bk", vmOptions, MyVMs)', "Register named VM on local MyVMs collection");
$.views.viewModels({
Bk: {
getters: ["title", "price"],
extend: {nameAndPrice: function(reverse: boolean) {
return reverse ? this._price + " for " + this._title : this._title + ":" + this._price;
}}
}
});
$.views.viewModels({
Bk: {
getters: ["title", "price"],
extend: {nameAndPrice: function(reverse: boolean) {
return reverse ? this._price + " for " + this._title : this._title + ":" + this._price;
}}
}
}, MyVMs);
test = $.views.viewModels.Bk("Hope", "$1.50").title();
assert.ok(test === "Hope", '$.views.viewModels({Bk: vmOptions})', "Register one or more named VMs");
test = MyVMs.Bk("Hope", "$1.50").title();
assert.ok(test === "Hope", '$.views.viewModels({Bk: vmOptions}, MyVMs)', "Register one or more named VMs on local myVms collection");
let bookData1 = {title: "Faith", price: "$10.50"}; // book (plain object)
book1 = Book.map(bookData1); // book (instance of Book View Model)
assert.ok(book1.title() === "Faith", 'Book.map(...)', "Instantiate vm instance from data, with map()");
book1.merge({ title: "Hope2", price: "$1.50" });
assert.ok(book1.title() === "Hope2", 'book.merge(...)', "Modify vm instance from data, with merge()");
test = book1.unmap();
assert.ok(test.title === "Hope2" && test.price === "$1.50", 'book.unmap()', "Round-trip data changes back to data, using unmap()");
let bookDataArray1 = [ // book array (plain objects)
{title: "Hope", price: "$1.50"},
{title: "Courage", price: "$2.50"}
];
let booksArray1 = Book.map(bookDataArray1); // book array (instances of Book View Model)
booksArray1.merge([
{title: "Hope2", price: "$1.50"},
{title: "Courage", price: "$222.50"}
]);
test = booksArray1.unmap();
assert.ok(test[1].title === "Courage" && test[1].price === "$222.50",
'bookArray = Book.map(dataArray) bookArray.merge(...) bookArray.unmap()', "Round-trip data array to array of book vm instances");
tmpl = $.templates("Name: {{:name()}}, Street: {{:address().street()}}, Phones:" +
"{{for phones()}} {{:number()}} ({{:person.name()}}) {{/for}}");
// The following code is from sample: https://www.jsviews.com/#viewmodelsapi@mergesampleadv plus use of parentRef
let myVmCollection: JsViews.Hash<JsViews.ViewModel> = {};
interface Person {
_name: string;
_comment: string;
_address: Address;
phones: () => Phone[];
}
interface Address {
_street: string;
}
interface Phone {
_number: string;
id: string;
}
$.views.viewModels({
Person: {
getters: [
{getter: "name", defaultVal: "No name"}, // Compiled name() get/set
{getter: "address", type: "Address", defaultVal: defaultAddress},
{getter: "phones", type: "Phone", defaultVal: [], parentRef: "person"}
],
extend: {
name: myNameGetSet, // Override name() get/set
addPhone: addPhone,
comment: comment // Additional get/set property, not initialized by data)
},
id: function(vm, plain) { // Callback function to determine 'identity'
return vm.personId === plain.personId;
}
},
Address: {
getters: ["street"]
},
Phone: {
getters: ["number"],
id: "phoneId" // Treat phoneId as 'primary key', for identity
}
}, myVmCollection); // Store View Models (typed hierarchy) on myVmCollection
// Override generated name() get/set
function myNameGetSet(this: Person, val: string) {
if (!arguments.length) { // This is standard compiled get/set code
return this._name; // If there is no argument, use as a getter
}
this._name = val; // If there is an argument, use as a setter
}
// Method for Person class
function addPhone(this: Person, phoneNo: string) { // Uses myVmCollection.Phone() to construct new instance
this.phones().push(myVmCollection.Phone(phoneNo, "person", this));
}
// get/set for comment (state on View Model instance, not initialized from data)
function comment(this: Person, val: string) {
if (!arguments.length) {
return this._comment; // If there is no argument, use as a getter
}
this._comment = val;
}
function defaultAddress(this: {name: string}) { // Function providing default address if undefined in data
return {street: 'No street for "' + this.name + '"'};
}
// First version of data - array of objects (e.g. from JSON request):
let peopleData = [
{
personId: "1",
address: {
street: "2nd Ave"
}
},
{
personId: "2",
name: "Pete",
phones: [
{number: "333 333 3333", phoneId: "2a"}
]
}
];
// Second version of data - JSON string (e.g. new JSON request):
let peopleData2 = '[{"personId":"2","name":"Peter","address":{"street":"11 1st Ave"},'
+ '"phones":[{"number":"111 111 9999","phoneId":"1a"},{"number":"333 333 9999","phoneId":"2a"}]}]';
// Instantiate View Model hierarchy using map()
let people = myVmCollection.Person.map(peopleData);
// Link template against people (array of Person instances)
tmpl.link("#result", people);
assert.equal(text(), 'Name: No name, Street: 2nd Ave, Phones:Name: Pete, Street: No street for "Pete", Phones: 333 333 3333 (Pete) ',
'Person.map(peopleData)', "map data to full VM hierarchy");
people.merge(peopleData2);
tmpl.link("#result", people);
assert.equal(text(), 'Name: Peter, Street: 11 1st Ave, Phones: 111 111 9999 (Peter) 333 333 9999 (Peter) ',
'people.merge(peopleData2)', "Merge data on full hierarchy");
people.merge(peopleData);
tmpl.link("#result", people);
assert.equal(text(), 'Name: No name, Street: 2nd Ave, Phones:Name: Pete, Street: No street for "Pete", Phones: 333 333 3333 (Pete) ',
'people.merge(peopleData)', "Merge back to previous data on full hierarchy");
people[0].name("newName");
tmpl.link("#result", people);
assert.equal(text(), 'Name: newName, Street: 2nd Ave, Phones:Name: Pete, Street: No street for "Pete", Phones: 333 333 3333 (Pete) ',
'people[0].name("newName")', "Change a property, deep in hierarchy");
people[0].addPhone("xxx xxx xxxx");
tmpl.link("#result", people);
assert.equal(text(), 'Name: newName, Street: 2nd Ave, Phones: xxx xxx xxxx (newName) Name: Pete, Street: No street for "Pete", Phones: 333 333 3333 (Pete) ',
'people[0].addPhone("xxx xxx xxxx")', "Insert instance, deep in hierarchy");
let updatedPeopleData = people.unmap();
assert.ok(updatedPeopleData[0].name === "newName" && updatedPeopleData[0].phones[0].number === "xxx xxx xxxx",
'updatedPeopleData = people.unmap()', "Round-trip back to data");
/*<<<<<<<<<<<<<*/ assert.testGroup("view"); /*>>>>>>>>>>>>>*/
test = '';
$.views.helpers("hlp", "Hlp");
$.views.tags("mytag", {
init: function(tagCtx, linkCtx, ctx) {
let view = tagCtx.view;
test = ""
+ (view === this.tagCtx.view)
+ view.ctxPrm("foo")
+ "(" + view.getIndex() + ")";
},
contentCtx: function(arg0) {
return this.ctx.root; // The returned value will be the data context inside {{mytag}}
},
show: function(this: JsViews.Tag, view: JsViews.View) {
test += "show";
},
do: function(this: JsViews.Tag, tagCtx: JsViews.TagCtx, ev: JsViews.EventObject, eventArgs: JsViews.EvtArgs) {
data3.a = "A2";
let view = tagCtx.contentView;
view.refresh();
view.ctxPrm("x", "X");
test += view.ctxPrm("x")
+ (view.parent.views._1 === view && view.parent === this.tagCtx.view)
+ view.content.markup.slice(0, 8)
+ view.type
+ view.parent.type
+ (view.get("mytag").get(true, "mytag") === view)
+ view.get("array").get(true, "item").index
+ view.root.type
+ view.getRsc("helpers", "hlp")
+ " contents: " + view.contents().length + view.contents(true).length + view.contents("em").length + view.contents(true, "em").length
+ " childTags: " + view.parent.childTags().length + view.parent.childTags(true).length + view.parent.childTags("on").length + view.parent.childTags(true, "on").length
+ " nodes: " + view.nodes().length;
},
template: "startTag {^{on ~tag.do ~tagCtx id='btn'/}} {{include tmpl=#content /}} endTag"
});
tmpl = $.templates("{^{for contentCtx=true start=0 end=1 ~foo ='FOO'}}{^{mytag a 'b' 33}} in tag {^{:~tag.show(#view)}} {^{:a}} <span><em>inspan</em></span> <input data-link='a' id='inp1'/> <input data-link='~hlp' id='inp2'/>{{/mytag}}{{/for}}");
let data3 = {a: "A"};
tmpl.link("#result", data3, {ctxHlp: "Ctxhlp"});
$("#btn").click();
assert.equal(test,
"trueFOO(0)showshowshowshowXtrue in tag mytagitemtrue0dataHlp contents: 13501 childTags: 1201 nodes: 13",
'view.get(), view.parent, view.data, view.contents(), view.childTags(), view.root etc etc', "View APIs tested");
/*<<<<<<<<<<<<<*/ assert.testGroup("tagCtx, linkCtx"); /*>>>>>>>>>>>>>*/
$.views.tags("mytag", {
linkedElement: ["input", "#inp"],
mainElement: "input",
displayElement: "#inp",
bindTo: [0, "bar"],
init: function(tagCtx, linkCtx, ctx) {
test = '' + linkCtx
+ tagCtx.ctxPrm("foo")
+ tagCtx.view.type
+ tagCtx.args[1]
+ tagCtx.props.bar
+ tagCtx.ctxPrm("foo")
+ (tagCtx.ctx === ctx)
+ tagCtx.bndArgs()
+ tagCtx.cvtArgs()
+ tagCtx.index
+ (this.tagCtxs[0] === tagCtx)
+ tagCtx.params.props.bar
+ (tagCtx.params.ctx && tagCtx.params.ctx.foo)
+ !!tagCtx.render(0, {foo: "FOO2"})
+ (tagCtx.tag === this)
+ tagCtx.tag.tagName
+ (tagCtx.tmpl === null)
+ (tagCtx.tmpl && tagCtx.tmpl.markup)
+ (tagCtx.content && tagCtx.content.markup);
},
onBind: function(tagCtx, linkCtx, ctx) {
test += " tagCtx " + tagCtx.linkedElems[1][0].outerHTML
+ tagCtx.mainElem[0].tagName
+ tagCtx.displayElem[0].tagName
+ tagCtx.contentView.type
+ tagCtx.nodes()[0].textContent
+ tagCtx.contents("#inp")[0].id
+ tagCtx.childTags().length
+ $.isFunction(tagCtx.setValues);
},
onAfterLink: function(tagCtx, linkCtx, ctx) {
test += " linkCtx " +linkCtx.data.a
+ linkCtx.elem.tagName
+ linkCtx.elem.tagName
+ (linkCtx.view === tagCtx.view)
+ linkCtx.attr
+ linkCtx.tag.tagName
+ linkCtx.ctx.root.a
+ linkCtx.type;
}
});
tmpl = $.templates("{^{mytag a 'mode' bar=b ~foo='FOO'}}inner{^{:~foo}}<input/><input id='inp'/>{{/mytag}}");
tmpl.link("#result", {a: "A", b: "B"});
assert.equal(test, "falseFOOdatamodeBFOOtrueA,modeA,mode0trueb'FOO'truetruemytagfalseinner{^{:~foo}}<input/><input id='inp'/>inner{^{:~foo}}<input/><input id='inp'/>"
+ ' tagCtx <input id="inp">INPUTINPUTmytaginnerinp0true'
+ " linkCtx ASCRIPTSCRIPTtruehtmlmytagAinline",
'tagCtx.ctxPrm(), linkCtx.attr etc etc', "tagCtx and linkCtx APIs tested, {{myTag ...}}...{{/myTag}}");
/*<<<<<<<<<<<<<*/ assert.testGroup("settings"); /*>>>>>>>>>>>>>*/
let delims = $.views.settings.delimiters();
let allowCode = $.views.settings.allowCode();
let trigger = $.views.settings.trigger();
$.views.settings.delimiters("<%", "%>", "&");
$.views.settings.allowCode(true);
$.views.settings.trigger(true);
test = "" + $.views.settings.delimiters() + $.views.settings.allowCode() + $.views.settings.trigger();
$.views.settings.delimiters(delims);
$.views.settings.allowCode(allowCode);
$.views.settings.trigger(trigger);
test += "" + $.views.settings.delimiters() + $.views.settings.allowCode() + $.views.settings.trigger();
assert.equal(test, "<%,%>,&truetrue{{,}},^falsefalse", "settings.delimiters()/allowCode()/trigger()", "get/set settings");
/*<<<<<<<<<<<<<*/ assert.testGroup("binding"); /*>>>>>>>>>>>>>*/
tmpl = $.templates('{{include ~person=person}}<input data-link="person.name" id="nmOuter"/>{^{for person}}{^{:name}}<div>{^{:~person.name}}{{if true}} <input data-link="name" id="nm"/> <input data-link="~person.name"/>{{/if}}</div>{{/for}}{{/include}}');
let data2 = {person: {name: "Jo"} };
$.link(tmpl, "#result", data2);
let view = $.view("#nm");
test = "" + (
view === $.view("#nm") &&
view === $.view($("#nm")) &&
view === $.view($("#nm")[0]) &&
view === $("#nm").view()
); // Different variants of $.view()
assert.equal(test, "true", "$.view()", "Variants of $.view() and $(...).view()");
view = $.view("#nm").parent;
test = "" + (
view === $.view("#nm", "for") &&
view === $("#nm").view("for") &&
view === $.view("#nm").get("for") &&
view === $("#nm").view().get("for")
); // Different variants of $.view(type)
view = $.view("#nm").root;
test += "" + (view === $.view("#nm", view.type))
+ "" + (view === $.view("#nm", "root"));
assert.equal(test, "truetruetrue", "$.view(type)", "Variants of $.view(..., type) and $(...).view(type)");
view = $.view("#result", true, "for");
test = "" + (
view === $.view("#result", true, "for") &&
view === $("#result").view(true, "for") &&
view === $("#result").view().get(true, "for") &&
view === $("#nmOuter").view().get(true, "for")
); // Different variants of $.view(true, type)
test += $("#nmOuter").view(true) === undefined;
test += $("#nmOuter").view().get(true).type;
assert.equal(test, "truetruefor", "$.view(type)", "Variants of $.view(..., true, type) and $(...).view(true, type)");
test = text();
$("#nmOuter").val("Bob").change();
test += text();
test += $.view("#nmOuter").type + $.view("#nm").type;
$.unlink("#result div");
$.unlink($("#result div")); // Variant
$.unlink($("#result div")[0]); // Variant
$("#nm").val("Jane").change();
$("#nmOuter").val("Fiona").change();
test += "| unlink: " + text();
test += $.view("#nmOuter").type + $.view("#nm").type;
$.link(tmpl, "#result", data2);
$("#nm").val("Carlos").change();
test += "| relink: " + text() + $.view("#nm").type;
$("#result div").unlink();
$("#nm").val("Henri").change();
test += "| unlink2: " + text() + $.view("#nm").type;
assert.equal(test, "JoJo BobBob includeif| unlink: FionaBob includefor| relink: CarlosCarlos if| unlink2: CarlosCarlos for",
"$.unlink()", "Data-linking, two-way, and unlink() variants");
$.link($.templates('{{:length}}{^{:#data[0].person.name}}'), "#result", [data2], {}, true);
$.observable(data2).setProperty({"person.name": "Maria"});
test += "| relink array noIteration: " + text();
assert.equal(test, "JoJo BobBob includeif| unlink: FionaBob includefor| relink: CarlosCarlos if| unlink2: CarlosCarlos for| relink array noIteration: 1Maria",
"$.link(tmpl ...), $.unlink()", "Data-linking, two-way, and link() / unlink() variants");
data2 = {person: {name: "Jo"} };
$("#result").html('<div data-link="person.name"></div><div data-link="~hlp"></div><input data-link="person.name"/>');
$.link(true, "#result", data2);
test = "link " + text();
$.observable(data2).setProperty({"person.name": "Fiona"});
test += text();
$("#result input").val("Henri").change();
test += text();
$.unlink();
test += " unlink ";
$("#result input").val("James").change();
test += text();
$.observable(data2).setProperty({"person.name": "Fiona"});
test += text();
$.link(true, "#result", data2, { hlp: "Helper" });
test += " link " + text();
$("#result div").unlink();
$("#result input").val("Canut").change();
test += data2.person.name + text();
$("#result").link(true, data2, { hlp: "Helper" }).link(true, data2, { hlp: "Helper2" });
test += text();
$.link(true, "#result", data2, { hlp: "Helper" }).link(true, data2, { hlp: "Helper3" });
test += text();
$.observable(data2).setProperty({"person.name": "Reggie"});
test += text();
assert.equal(test, "link JoHlpFionaHlpHenriHlp unlink HenriHlpHenriHlp link FionaHelperCanutFionaHelperCanutHelper2CanutHelper3ReggieHelper3",
"$.link(true ...), $.unlink()", "Data-linking, top-level, declarative");
$.unlink("#result");
$("#result").html('<div class="nm"></div><div class="hlp"></div><input class="nm"/>');
$.link("person.name", "#result .nm", data2, { hlp: "Helper" });
$.link("~hlp", "#result .hlp", data2, { hlp: "Helper" });
test = text();
$("#result input").val("Rick").change();
test += text();
$.observable(data2).setProperty({"person.name": "Paul"});
test += text();
$.unlink("#result");
test += " unlink ";
$("#result input").val("Josephine").change();
test += text();
$.observable(data2).setProperty("person.name", "Ray");
test += text();
assert.equal(test, "ReggieHelperRickHelperPaulHelper unlink PaulHelperPaulHelper",
"$.link(expr ...), $.unlink()", "Data-linking, top-level, programmatic");
/*<<<<<<<<<<<<<*/ assert.testGroup("Observable"); /*>>>>>>>>>>>>>*/
let data4 = {person: {name: "Jo", address: {street: "Main St"}, phones: [1, 2, 3], info: <JsViews.GetSet>null}};
data4.person.info = function(this: JsViews.Hash<any>) {
return "info: " + this.name + " " + this.address.street;
} as JsViews.GetSet;
data4.person.info.depends = function() {
return ["name", "address^street"];
};
tmpl = $.templates("{^{:person.name}} {^{:person.address.street}} {^{for person.phones}}{^{:}}{{/for}} {^{:person.info()}} {^{:~personinfo}} {^{:~personstuff()}}");
tmpl.link("#result", data4, {personinfo: "Joseph", personstuff: function() {
return "xxx";
}});
test = text();
$.observable(data4).setProperty("person.name", "Ray");
$.observable(data4).setProperty({"person.address.street": "Broadway"});
$.observable(data4.person.phones).insert(1, [5, 6]);
test += text();
$.observable(data4).setProperty({"person.address": {street: "Narrowway"}});
test += text();
$.observable(data4.person.phones).move(1, 2, 2);
test += text();
$.observable(data4.person.phones).remove(1);
test += text();
$.observable(data4.person.phones).refresh([4, 3, 2, 1]);
test += text();
$.view("#result", true, "item").ctxPrm("personinfo", "YYYY");
test += text();
assert.equal(test, "Jo Main St 123 info: Jo Main St Joseph xxxRay Broadway 15623"
+ " info: Ray Broadway Joseph xxxRay Broadway 15623"
+ " info: Ray Narrowway Joseph xxxRay Broadway 12563"
+ " info: Ray Narrowway Joseph xxxRay Broadway 1563"
+ " info: Ray Narrowway Joseph xxxRay Broadway 4321"
+ " info: Ray Narrowway Joseph xxxRay Broadway 4321"
+ " info: Ray Narrowway YYYY xxx",
"$.observable(...)", "Observable APIs");
function keydown(elem: any) {
if ("oninput" in document) {
elem.trigger("input");
} else {
elem.keydown();
}
}
var fullName = function(this: JsViews.Hash<string>, reversed: boolean) {
return reversed
? this.lastName + " " + this.firstName
: this.firstName + " " + this.lastName;
} as JsViews.GetSet;
var person = {
firstName: "Jeff",
lastName: "Smith",
fullName: fullName
};
fullName.depends = "*";
fullName.set = function(val: string) {
let vals = val.split(" ");
$.observable(this).setProperty({
lastName: vals.pop(),
firstName: vals.join(" ")
});
};
$.templates('{^{:firstName}} {^{:lastName}} {^{:fullName()}} {^{:fullName(true)}} <input id="full" data-link="fullName()"/>')
.link("#result", person);
// ................................ Act ..................................
test = text();
$.observable(person).setProperty({firstName: "newFirst", lastName: "newLast"});
test += text();
$.observable(person).setProperty({fullName: "compFirst compLast"});
test += text();
keydown($("#full").val("2wayFirst 2wayLast"));
test += text();
assert.equal(test, "Jeff Smith Jeff Smith Smith Jeff newFirst newLast newFirst newLast newLast newFirst compFirst compLast compFirst compLast compLast compFirst compFirst compLast compFirst compLast compLast compFirst ",
"fullName as JsViews.GetSet; fullName.depends/set etc", "GetSet computed function");
})();
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
* $Id: BuildTest.java 2662 2006-02-18 14:20:33Z otmarhumbel $
*/
package org.apache.commons.cli;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class BuildTest extends TestCase
{
public static Test suite() {
return new TestSuite(BuildTest.class);
}
public BuildTest(String name)
{
super(name);
}
public void setUp()
{
}
public void tearDown()
{
}
public void testSimple()
{
Options opts = new Options();
opts.addOption("a",
false,
"toggle -a");
opts.addOption("b",
true,
"toggle -b");
}
public void testDuplicateSimple()
{
Options opts = new Options();
opts.addOption("a",
false,
"toggle -a");
opts.addOption("a",
true,
"toggle -a*");
assertEquals( "last one in wins", "toggle -a*", opts.getOption("a").getDescription() );
}
public void testLong()
{
Options opts = new Options();
opts.addOption("a",
"--a",
false,
"toggle -a");
opts.addOption("b",
"--b",
true,
"set -b");
}
public void testDuplicateLong()
{
Options opts = new Options();
opts.addOption("a",
"--a",
false,
"toggle -a");
opts.addOption("a",
"--a",
false,
"toggle -a*");
assertEquals( "last one in wins", "toggle -a*", opts.getOption("a").getDescription() );
}
}
| {
"pile_set_name": "Github"
} |
# Exercise: Using UDFs
Develop a standalone Spark SQL application (using IntelliJ IDEA) that uses your own `upper` user-defined function (e.g. `my_upper`).
Protip™: Use Scala's [StringOps.toUpperCase](https://www.scala-lang.org/api/current/scala/collection/immutable/StringOps.html)
Use your UDF in SQL, i.e. in `spark.sql`.
Use [callUDF](http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.functions$) standard function to call your UDF.
Module: **Spark SQL**
Duration: **30 mins**
## Nondeterministic UDFs
Think about using non-deterministic "features" like the current timestamp or a random number. What happens when you use such "features" in your UDFs?
```scala
// Use .asNondeterministic to see the change
val my_date = udf { (n: Long) => util.Random.nextInt() }
spark
.range(1)
.withColumn("randgen", randgen('id))
.select(randgen('id) === 'randgen)
.show
```
<!--
## Solution
```text
???
```
-->
| {
"pile_set_name": "Github"
} |
/*
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Libavfilter multithreading support
*/
#include "config.h"
#include "libavutil/common.h"
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
#include "avfilter.h"
#include "internal.h"
#include "thread.h"
#if HAVE_PTHREADS
#include <pthread.h>
#elif HAVE_OS2THREADS
#include "compat/os2threads.h"
#elif HAVE_W32THREADS
#include "compat/w32pthreads.h"
#endif
typedef struct ThreadContext {
AVFilterGraph *graph;
int nb_threads;
pthread_t *workers;
avfilter_action_func *func;
/* per-execute perameters */
AVFilterContext *ctx;
void *arg;
int *rets;
int nb_rets;
int nb_jobs;
pthread_cond_t last_job_cond;
pthread_cond_t current_job_cond;
pthread_mutex_t current_job_lock;
int current_job;
unsigned int current_execute;
int done;
} ThreadContext;
static void* attribute_align_arg worker(void *v)
{
ThreadContext *c = v;
int our_job = c->nb_jobs;
int nb_threads = c->nb_threads;
unsigned int last_execute = 0;
int self_id;
pthread_mutex_lock(&c->current_job_lock);
self_id = c->current_job++;
for (;;) {
while (our_job >= c->nb_jobs) {
if (c->current_job == nb_threads + c->nb_jobs)
pthread_cond_signal(&c->last_job_cond);
while (last_execute == c->current_execute && !c->done)
pthread_cond_wait(&c->current_job_cond, &c->current_job_lock);
last_execute = c->current_execute;
our_job = self_id;
if (c->done) {
pthread_mutex_unlock(&c->current_job_lock);
return NULL;
}
}
pthread_mutex_unlock(&c->current_job_lock);
c->rets[our_job % c->nb_rets] = c->func(c->ctx, c->arg, our_job, c->nb_jobs);
pthread_mutex_lock(&c->current_job_lock);
our_job = c->current_job++;
}
}
static void slice_thread_uninit(ThreadContext *c)
{
int i;
pthread_mutex_lock(&c->current_job_lock);
c->done = 1;
pthread_cond_broadcast(&c->current_job_cond);
pthread_mutex_unlock(&c->current_job_lock);
for (i = 0; i < c->nb_threads; i++)
pthread_join(c->workers[i], NULL);
pthread_mutex_destroy(&c->current_job_lock);
pthread_cond_destroy(&c->current_job_cond);
pthread_cond_destroy(&c->last_job_cond);
av_freep(&c->workers);
}
static void slice_thread_park_workers(ThreadContext *c)
{
while (c->current_job != c->nb_threads + c->nb_jobs)
pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);
pthread_mutex_unlock(&c->current_job_lock);
}
static int thread_execute(AVFilterContext *ctx, avfilter_action_func *func,
void *arg, int *ret, int nb_jobs)
{
ThreadContext *c = ctx->graph->internal->thread;
int dummy_ret;
if (nb_jobs <= 0)
return 0;
pthread_mutex_lock(&c->current_job_lock);
c->current_job = c->nb_threads;
c->nb_jobs = nb_jobs;
c->ctx = ctx;
c->arg = arg;
c->func = func;
if (ret) {
c->rets = ret;
c->nb_rets = nb_jobs;
} else {
c->rets = &dummy_ret;
c->nb_rets = 1;
}
c->current_execute++;
pthread_cond_broadcast(&c->current_job_cond);
slice_thread_park_workers(c);
return 0;
}
static int thread_init_internal(ThreadContext *c, int nb_threads)
{
int i, ret;
if (!nb_threads) {
int nb_cpus = av_cpu_count();
// use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1)
nb_threads = nb_cpus + 1;
else
nb_threads = 1;
}
if (nb_threads <= 1)
return 1;
c->nb_threads = nb_threads;
c->workers = av_mallocz_array(sizeof(*c->workers), nb_threads);
if (!c->workers)
return AVERROR(ENOMEM);
c->current_job = 0;
c->nb_jobs = 0;
c->done = 0;
pthread_cond_init(&c->current_job_cond, NULL);
pthread_cond_init(&c->last_job_cond, NULL);
pthread_mutex_init(&c->current_job_lock, NULL);
pthread_mutex_lock(&c->current_job_lock);
for (i = 0; i < nb_threads; i++) {
ret = pthread_create(&c->workers[i], NULL, worker, c);
if (ret) {
pthread_mutex_unlock(&c->current_job_lock);
c->nb_threads = i;
slice_thread_uninit(c);
return AVERROR(ret);
}
}
slice_thread_park_workers(c);
return c->nb_threads;
}
int ff_graph_thread_init(AVFilterGraph *graph)
{
int ret;
#if HAVE_W32THREADS
w32thread_init();
#endif
if (graph->nb_threads == 1) {
graph->thread_type = 0;
return 0;
}
graph->internal->thread = av_mallocz(sizeof(ThreadContext));
if (!graph->internal->thread)
return AVERROR(ENOMEM);
ret = thread_init_internal(graph->internal->thread, graph->nb_threads);
if (ret <= 1) {
av_freep(&graph->internal->thread);
graph->thread_type = 0;
graph->nb_threads = 1;
return (ret < 0) ? ret : 0;
}
graph->nb_threads = ret;
graph->internal->thread_execute = thread_execute;
return 0;
}
void ff_graph_thread_free(AVFilterGraph *graph)
{
if (graph->internal->thread)
slice_thread_uninit(graph->internal->thread);
av_freep(&graph->internal->thread);
}
| {
"pile_set_name": "Github"
} |
/*
* Panasonic HotKey and LCD brightness control driver
* (C) 2004 Hiroshi Miura <[email protected]>
* (C) 2004 NTT DATA Intellilink Co. http://www.intellilink.co.jp/
* (C) YOKOTA Hiroshi <yokota (at) netlab. is. tsukuba. ac. jp>
* (C) 2004 David Bronaugh <dbronaugh>
* (C) 2006-2008 Harald Welte <[email protected]>
*
* derived from toshiba_acpi.c, Copyright (C) 2002-2004 John Belmonte
*
* 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
* publicshed by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*---------------------------------------------------------------------------
*
* ChangeLog:
* Sep.23, 2008 Harald Welte <[email protected]>
* -v0.95 rename driver from drivers/acpi/pcc_acpi.c to
* drivers/misc/panasonic-laptop.c
*
* Jul.04, 2008 Harald Welte <[email protected]>
* -v0.94 replace /proc interface with device attributes
* support {set,get}keycode on th input device
*
* Jun.27, 2008 Harald Welte <[email protected]>
* -v0.92 merge with 2.6.26-rc6 input API changes
* remove broken <= 2.6.15 kernel support
* resolve all compiler warnings
* various coding style fixes (checkpatch.pl)
* add support for backlight api
* major code restructuring
*
* Dac.28, 2007 Harald Welte <[email protected]>
* -v0.91 merge with 2.6.24-rc6 ACPI changes
*
* Nov.04, 2006 Hiroshi Miura <[email protected]>
* -v0.9 remove warning about section reference.
* remove acpi_os_free
* add /proc/acpi/pcc/brightness interface for HAL access
* merge dbronaugh's enhancement
* Aug.17, 2004 David Bronaugh (dbronaugh)
* - Added screen brightness setting interface
* Thanks to FreeBSD crew (acpi_panasonic.c)
* for the ideas I needed to accomplish it
*
* May.29, 2006 Hiroshi Miura <[email protected]>
* -v0.8.4 follow to change keyinput structure
* thanks Fabian Yamaguchi <[email protected]>,
* Jacob Bower <[email protected]> and
* Hiroshi Yokota for providing solutions.
*
* Oct.02, 2004 Hiroshi Miura <[email protected]>
* -v0.8.2 merge code of YOKOTA Hiroshi
* <[email protected]>.
* Add sticky key mode interface.
* Refactoring acpi_pcc_generate_keyinput().
*
* Sep.15, 2004 Hiroshi Miura <[email protected]>
* -v0.8 Generate key input event on input subsystem.
* This is based on yet another driver written by
* Ryuta Nakanishi.
*
* Sep.10, 2004 Hiroshi Miura <[email protected]>
* -v0.7 Change proc interface functions using seq_file
* facility as same as other ACPI drivers.
*
* Aug.28, 2004 Hiroshi Miura <[email protected]>
* -v0.6.4 Fix a silly error with status checking
*
* Aug.25, 2004 Hiroshi Miura <[email protected]>
* -v0.6.3 replace read_acpi_int by standard function
* acpi_evaluate_integer
* some clean up and make smart copyright notice.
* fix return value of pcc_acpi_get_key()
* fix checking return value of acpi_bus_register_driver()
*
* Aug.22, 2004 David Bronaugh <[email protected]>
* -v0.6.2 Add check on ACPI data (num_sifr)
* Coding style cleanups, better error messages/handling
* Fixed an off-by-one error in memory allocation
*
* Aug.21, 2004 David Bronaugh <[email protected]>
* -v0.6.1 Fix a silly error with status checking
*
* Aug.20, 2004 David Bronaugh <[email protected]>
* - v0.6 Correct brightness controls to reflect reality
* based on information gleaned by Hiroshi Miura
* and discussions with Hiroshi Miura
*
* Aug.10, 2004 Hiroshi Miura <[email protected]>
* - v0.5 support LCD brightness control
* based on the disclosed information by MEI.
*
* Jul.25, 2004 Hiroshi Miura <[email protected]>
* - v0.4 first post version
* add function to retrive SIFR
*
* Jul.24, 2004 Hiroshi Miura <[email protected]>
* - v0.3 get proper status of hotkey
*
* Jul.22, 2004 Hiroshi Miura <[email protected]>
* - v0.2 add HotKey handler
*
* Jul.17, 2004 Hiroshi Miura <[email protected]>
* - v0.1 start from toshiba_acpi driver written by John Belmonte
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/backlight.h>
#include <linux/ctype.h>
#include <linux/seq_file.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#ifndef ACPI_HOTKEY_COMPONENT
#define ACPI_HOTKEY_COMPONENT 0x10000000
#endif
#define _COMPONENT ACPI_HOTKEY_COMPONENT
MODULE_AUTHOR("Hiroshi Miura, David Bronaugh and Harald Welte");
MODULE_DESCRIPTION("ACPI HotKey driver for Panasonic Let's Note laptops");
MODULE_LICENSE("GPL");
#define LOGPREFIX "pcc_acpi: "
/* Define ACPI PATHs */
/* Lets note hotkeys */
#define METHOD_HKEY_QUERY "HINF"
#define METHOD_HKEY_SQTY "SQTY"
#define METHOD_HKEY_SINF "SINF"
#define METHOD_HKEY_SSET "SSET"
#define HKEY_NOTIFY 0x80
#define ACPI_PCC_DRIVER_NAME "Panasonic Laptop Support"
#define ACPI_PCC_DEVICE_NAME "Hotkey"
#define ACPI_PCC_CLASS "pcc"
#define ACPI_PCC_INPUT_PHYS "panasonic/hkey0"
/* LCD_TYPEs: 0 = Normal, 1 = Semi-transparent
ENV_STATEs: Normal temp=0x01, High temp=0x81, N/A=0x00
*/
enum SINF_BITS { SINF_NUM_BATTERIES = 0,
SINF_LCD_TYPE,
SINF_AC_MAX_BRIGHT,
SINF_AC_MIN_BRIGHT,
SINF_AC_CUR_BRIGHT,
SINF_DC_MAX_BRIGHT,
SINF_DC_MIN_BRIGHT,
SINF_DC_CUR_BRIGHT,
SINF_MUTE,
SINF_RESERVED,
SINF_ENV_STATE,
SINF_STICKY_KEY = 0x80,
};
/* R1 handles SINF_AC_CUR_BRIGHT as SINF_CUR_BRIGHT, doesn't know AC state */
static int acpi_pcc_hotkey_add(struct acpi_device *device);
static int acpi_pcc_hotkey_remove(struct acpi_device *device);
static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id pcc_device_ids[] = {
{ "MAT0012", 0},
{ "MAT0013", 0},
{ "MAT0018", 0},
{ "MAT0019", 0},
{ "", 0},
};
MODULE_DEVICE_TABLE(acpi, pcc_device_ids);
#ifdef CONFIG_PM_SLEEP
static int acpi_pcc_hotkey_resume(struct device *dev);
#endif
static SIMPLE_DEV_PM_OPS(acpi_pcc_hotkey_pm, NULL, acpi_pcc_hotkey_resume);
static struct acpi_driver acpi_pcc_driver = {
.name = ACPI_PCC_DRIVER_NAME,
.class = ACPI_PCC_CLASS,
.ids = pcc_device_ids,
.ops = {
.add = acpi_pcc_hotkey_add,
.remove = acpi_pcc_hotkey_remove,
.notify = acpi_pcc_hotkey_notify,
},
.drv.pm = &acpi_pcc_hotkey_pm,
};
static const struct key_entry panasonic_keymap[] = {
{ KE_KEY, 0, { KEY_RESERVED } },
{ KE_KEY, 1, { KEY_BRIGHTNESSDOWN } },
{ KE_KEY, 2, { KEY_BRIGHTNESSUP } },
{ KE_KEY, 3, { KEY_DISPLAYTOGGLE } },
{ KE_KEY, 4, { KEY_MUTE } },
{ KE_KEY, 5, { KEY_VOLUMEDOWN } },
{ KE_KEY, 6, { KEY_VOLUMEUP } },
{ KE_KEY, 7, { KEY_SLEEP } },
{ KE_KEY, 8, { KEY_PROG1 } }, /* Change CPU boost */
{ KE_KEY, 9, { KEY_BATTERY } },
{ KE_KEY, 10, { KEY_SUSPEND } },
{ KE_END, 0 }
};
struct pcc_acpi {
acpi_handle handle;
unsigned long num_sifr;
int sticky_mode;
u32 *sinf;
struct acpi_device *device;
struct input_dev *input_dev;
struct backlight_device *backlight;
};
struct pcc_keyinput {
struct acpi_hotkey *hotkey;
};
/* method access functions */
static int acpi_pcc_write_sset(struct pcc_acpi *pcc, int func, int val)
{
union acpi_object in_objs[] = {
{ .integer.type = ACPI_TYPE_INTEGER,
.integer.value = func, },
{ .integer.type = ACPI_TYPE_INTEGER,
.integer.value = val, },
};
struct acpi_object_list params = {
.count = ARRAY_SIZE(in_objs),
.pointer = in_objs,
};
acpi_status status = AE_OK;
status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SSET,
¶ms, NULL);
return (status == AE_OK) ? 0 : -EIO;
}
static inline int acpi_pcc_get_sqty(struct acpi_device *device)
{
unsigned long long s;
acpi_status status;
status = acpi_evaluate_integer(device->handle, METHOD_HKEY_SQTY,
NULL, &s);
if (ACPI_SUCCESS(status))
return s;
else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"evaluation error HKEY.SQTY\n"));
return -EINVAL;
}
}
static int acpi_pcc_retrieve_biosdata(struct pcc_acpi *pcc)
{
acpi_status status;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
union acpi_object *hkey = NULL;
int i;
status = acpi_evaluate_object(pcc->handle, METHOD_HKEY_SINF, NULL,
&buffer);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"evaluation error HKEY.SINF\n"));
return 0;
}
hkey = buffer.pointer;
if (!hkey || (hkey->type != ACPI_TYPE_PACKAGE)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid HKEY.SINF\n"));
status = AE_ERROR;
goto end;
}
if (pcc->num_sifr < hkey->package.count) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"SQTY reports bad SINF length\n"));
status = AE_ERROR;
goto end;
}
for (i = 0; i < hkey->package.count; i++) {
union acpi_object *element = &(hkey->package.elements[i]);
if (likely(element->type == ACPI_TYPE_INTEGER)) {
pcc->sinf[i] = element->integer.value;
} else
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid HKEY.SINF data\n"));
}
pcc->sinf[hkey->package.count] = -1;
end:
kfree(buffer.pointer);
return status == AE_OK;
}
/* backlight API interface functions */
/* This driver currently treats AC and DC brightness identical,
* since we don't need to invent an interface to the core ACPI
* logic to receive events in case a power supply is plugged in
* or removed */
static int bl_get(struct backlight_device *bd)
{
struct pcc_acpi *pcc = bl_get_data(bd);
if (!acpi_pcc_retrieve_biosdata(pcc))
return -EIO;
return pcc->sinf[SINF_AC_CUR_BRIGHT];
}
static int bl_set_status(struct backlight_device *bd)
{
struct pcc_acpi *pcc = bl_get_data(bd);
int bright = bd->props.brightness;
int rc;
if (!acpi_pcc_retrieve_biosdata(pcc))
return -EIO;
if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT])
bright = pcc->sinf[SINF_AC_MIN_BRIGHT];
if (bright < pcc->sinf[SINF_DC_MIN_BRIGHT])
bright = pcc->sinf[SINF_DC_MIN_BRIGHT];
if (bright < pcc->sinf[SINF_AC_MIN_BRIGHT] ||
bright > pcc->sinf[SINF_AC_MAX_BRIGHT])
return -EINVAL;
rc = acpi_pcc_write_sset(pcc, SINF_AC_CUR_BRIGHT, bright);
if (rc < 0)
return rc;
return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright);
}
static const struct backlight_ops pcc_backlight_ops = {
.get_brightness = bl_get,
.update_status = bl_set_status,
};
/* sysfs user interface functions */
static ssize_t show_numbatt(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct acpi_device *acpi = to_acpi_device(dev);
struct pcc_acpi *pcc = acpi_driver_data(acpi);
if (!acpi_pcc_retrieve_biosdata(pcc))
return -EIO;
return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_NUM_BATTERIES]);
}
static ssize_t show_lcdtype(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct acpi_device *acpi = to_acpi_device(dev);
struct pcc_acpi *pcc = acpi_driver_data(acpi);
if (!acpi_pcc_retrieve_biosdata(pcc))
return -EIO;
return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_LCD_TYPE]);
}
static ssize_t show_mute(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct acpi_device *acpi = to_acpi_device(dev);
struct pcc_acpi *pcc = acpi_driver_data(acpi);
if (!acpi_pcc_retrieve_biosdata(pcc))
return -EIO;
return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_MUTE]);
}
static ssize_t show_sticky(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct acpi_device *acpi = to_acpi_device(dev);
struct pcc_acpi *pcc = acpi_driver_data(acpi);
if (!acpi_pcc_retrieve_biosdata(pcc))
return -EIO;
return snprintf(buf, PAGE_SIZE, "%u\n", pcc->sinf[SINF_STICKY_KEY]);
}
static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct acpi_device *acpi = to_acpi_device(dev);
struct pcc_acpi *pcc = acpi_driver_data(acpi);
int val;
if (count && sscanf(buf, "%i", &val) == 1 &&
(val == 0 || val == 1)) {
acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, val);
pcc->sticky_mode = val;
}
return count;
}
static DEVICE_ATTR(numbatt, S_IRUGO, show_numbatt, NULL);
static DEVICE_ATTR(lcdtype, S_IRUGO, show_lcdtype, NULL);
static DEVICE_ATTR(mute, S_IRUGO, show_mute, NULL);
static DEVICE_ATTR(sticky_key, S_IRUGO | S_IWUSR, show_sticky, set_sticky);
static struct attribute *pcc_sysfs_entries[] = {
&dev_attr_numbatt.attr,
&dev_attr_lcdtype.attr,
&dev_attr_mute.attr,
&dev_attr_sticky_key.attr,
NULL,
};
static struct attribute_group pcc_attr_group = {
.name = NULL, /* put in device directory */
.attrs = pcc_sysfs_entries,
};
/* hotkey input device driver */
static int sleep_keydown_seen;
static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
{
struct input_dev *hotk_input_dev = pcc->input_dev;
int rc;
unsigned long long result;
rc = acpi_evaluate_integer(pcc->handle, METHOD_HKEY_QUERY,
NULL, &result);
if (!ACPI_SUCCESS(rc)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"error getting hotkey status\n"));
return;
}
/* hack: some firmware sends no key down for sleep / hibernate */
if ((result & 0xf) == 0x7 || (result & 0xf) == 0xa) {
if (result & 0x80)
sleep_keydown_seen = 1;
if (!sleep_keydown_seen)
sparse_keymap_report_event(hotk_input_dev,
result & 0xf, 0x80, false);
}
if (!sparse_keymap_report_event(hotk_input_dev,
result & 0xf, result & 0x80, false))
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown hotkey event: %d\n", result));
}
static void acpi_pcc_hotkey_notify(struct acpi_device *device, u32 event)
{
struct pcc_acpi *pcc = acpi_driver_data(device);
switch (event) {
case HKEY_NOTIFY:
acpi_pcc_generate_keyinput(pcc);
break;
default:
/* nothing to do */
break;
}
}
static int acpi_pcc_init_input(struct pcc_acpi *pcc)
{
struct input_dev *input_dev;
int error;
input_dev = input_allocate_device();
if (!input_dev)
return -ENOMEM;
input_dev->name = ACPI_PCC_DRIVER_NAME;
input_dev->phys = ACPI_PCC_INPUT_PHYS;
input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100;
error = sparse_keymap_setup(input_dev, panasonic_keymap, NULL);
if (error) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to setup input device keymap\n"));
goto err_free_dev;
}
error = input_register_device(input_dev);
if (error) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to register input device\n"));
goto err_free_keymap;
}
pcc->input_dev = input_dev;
return 0;
err_free_keymap:
sparse_keymap_free(input_dev);
err_free_dev:
input_free_device(input_dev);
return error;
}
static void acpi_pcc_destroy_input(struct pcc_acpi *pcc)
{
sparse_keymap_free(pcc->input_dev);
input_unregister_device(pcc->input_dev);
/*
* No need to input_free_device() since core input API refcounts
* and free()s the device.
*/
}
/* kernel module interface */
#ifdef CONFIG_PM_SLEEP
static int acpi_pcc_hotkey_resume(struct device *dev)
{
struct pcc_acpi *pcc;
if (!dev)
return -EINVAL;
pcc = acpi_driver_data(to_acpi_device(dev));
if (!pcc)
return -EINVAL;
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Sticky mode restore: %d\n",
pcc->sticky_mode));
return acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, pcc->sticky_mode);
}
#endif
static int acpi_pcc_hotkey_add(struct acpi_device *device)
{
struct backlight_properties props;
struct pcc_acpi *pcc;
int num_sifr, result;
if (!device)
return -EINVAL;
num_sifr = acpi_pcc_get_sqty(device);
if (num_sifr < 0 || num_sifr > 255) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "num_sifr out of range"));
return -ENODEV;
}
pcc = kzalloc(sizeof(struct pcc_acpi), GFP_KERNEL);
if (!pcc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Couldn't allocate mem for pcc"));
return -ENOMEM;
}
pcc->sinf = kzalloc(sizeof(u32) * (num_sifr + 1), GFP_KERNEL);
if (!pcc->sinf) {
result = -ENOMEM;
goto out_hotkey;
}
pcc->device = device;
pcc->handle = device->handle;
pcc->num_sifr = num_sifr;
device->driver_data = pcc;
strcpy(acpi_device_name(device), ACPI_PCC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_PCC_CLASS);
result = acpi_pcc_init_input(pcc);
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing keyinput handler\n"));
goto out_sinf;
}
if (!acpi_pcc_retrieve_biosdata(pcc)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Couldn't retrieve BIOS data\n"));
result = -EIO;
goto out_input;
}
/* initialize backlight */
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_PLATFORM;
props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
&pcc_backlight_ops, &props);
if (IS_ERR(pcc->backlight)) {
result = PTR_ERR(pcc->backlight);
goto out_input;
}
/* read the initial brightness setting from the hardware */
pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
/* read the initial sticky key mode from the hardware */
pcc->sticky_mode = pcc->sinf[SINF_STICKY_KEY];
/* add sysfs attributes */
result = sysfs_create_group(&device->dev.kobj, &pcc_attr_group);
if (result)
goto out_backlight;
return 0;
out_backlight:
backlight_device_unregister(pcc->backlight);
out_input:
acpi_pcc_destroy_input(pcc);
out_sinf:
kfree(pcc->sinf);
out_hotkey:
kfree(pcc);
return result;
}
static int acpi_pcc_hotkey_remove(struct acpi_device *device)
{
struct pcc_acpi *pcc = acpi_driver_data(device);
if (!device || !pcc)
return -EINVAL;
sysfs_remove_group(&device->dev.kobj, &pcc_attr_group);
backlight_device_unregister(pcc->backlight);
acpi_pcc_destroy_input(pcc);
kfree(pcc->sinf);
kfree(pcc);
return 0;
}
module_acpi_driver(acpi_pcc_driver);
| {
"pile_set_name": "Github"
} |
// Copyright 2016 The TensorFlow Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// =============================================================================
// Converts strings of arbitrary length to float values by
// hashing and cramming bits.
#include <functional>
#include "tensorflow/contrib/tensor_forest/core/ops/tree_utils.h"
#include "tensorflow/core/framework/common_shape_fns.h"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/lib/strings/numbers.h"
#include "tensorflow/core/lib/strings/strcat.h"
#include "tensorflow/core/util/work_sharder.h"
namespace tensorflow {
using tensorforest::CheckTensorBounds;
float Convert(const string& in) {
const std::size_t intval = std::hash<string>()(in);
return static_cast<float>(intval);
}
void Evaluate(const Tensor& input_data, Tensor output_data,
int32 start, int32 end) {
auto out_data = output_data.tensor<float, 2>();
const auto in_data = input_data.tensor<string, 2>();
for (int32 i = start; i < end; ++i) {
for (int32 j = 0; j < output_data.dim_size(1); ++j) {
out_data(i, j) = Convert(in_data(i, j));
}
}
}
REGISTER_OP("StringToFloat")
.Input("input_data: string")
.Output("output_data: float")
.SetShapeFn(shape_inference::UnchangedShape)
.Doc(R"doc(
Converts byte arrays represented by strings to 32-bit
floating point numbers. The output numbers themselves are meaningless, and
should only be used in == comparisons.
input_data: A batch of string features as a 2-d tensor; `input_data[i][j]`
gives the j-th feature of the i-th input.
output_data: A tensor of the same shape as input_data but the values are
float32.
)doc");
class StringToFloat : public OpKernel {
public:
explicit StringToFloat(OpKernelConstruction* context)
: OpKernel(context) {}
void Compute(OpKernelContext* context) override {
const Tensor& input_data = context->input(0);
// Check inputs.
OP_REQUIRES(context, input_data.shape().dims() == 2,
errors::InvalidArgument(
"input_data should be two-dimensional"));
// Check tensor bounds.
if (!CheckTensorBounds(context, input_data)) return;
Tensor* output_data = nullptr;
OP_REQUIRES_OK(context,
context->allocate_output(0, input_data.shape(),
&output_data));
// Evaluate input data in parallel.
const int32 num_data = static_cast<int32>(input_data.shape().dim_size(0));
auto worker_threads = context->device()->tensorflow_cpu_worker_threads();
int num_threads = worker_threads->num_threads;
if (num_threads <= 1) {
Evaluate(input_data, *output_data, 0, num_data);
} else {
auto work = [&input_data, output_data, num_data](int64 start, int64 end) {
CHECK(start <= end);
CHECK(end <= num_data);
Evaluate(input_data, *output_data,
static_cast<int32>(start), static_cast<int32>(end));
};
Shard(num_threads, worker_threads->workers, num_data, 100, work);
}
}
};
REGISTER_KERNEL_BUILDER(Name("StringToFloat").Device(DEVICE_CPU),
StringToFloat);
} // namespace tensorflow
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.