text
stringlengths 2
99.9k
| meta
dict |
---|---|
/*
* Copyright 2019 Xilinx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define FILTER_SIZE_3 0
#define FILTER_SIZE_5 1
#define FILTER_SIZE_7 0
#define RO 0
#define NO 1
#define GRAY 1
#define RGBA 0
#define INPUT_PTR_WIDTH 256
#define OUTPUT_PTR_WIDTH 256 | {
"pile_set_name": "Github"
} |
/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Enterprise License (PEL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PEL
*/
pimcore.registerNS("pimcore.document.editable");
pimcore.document.editable = Class.create({
id: null,
name: null,
realName: null,
inherited: false,
inDialogBox: null,
required: false,
requiredError: false,
setupWrapper: function (styleOptions) {
if (!styleOptions) {
styleOptions = {};
}
var container = Ext.get(this.id);
container.setStyle(styleOptions);
return container;
},
setName: function(name) {
this.name = name;
},
getName: function () {
return this.name;
},
setRealName: function(realName) {
this.realName = realName;
},
getRealName: function() {
return this.realName;
},
setInDialogBox: function(inDialogBox) {
this.inDialogBox = inDialogBox;
},
getInDialogBox: function() {
return this.inDialogBox;
},
reloadDocument: function () {
window.editWindow.reload();
},
setInherited: function(inherited, el) {
this.inherited = inherited;
// if an element given is as optional second parameter we use this for the mask
if(!(el instanceof Ext.Element)) {
el = Ext.get(this.id);
}
// check for inherited elements, and mask them if necessary
if(this.inherited) {
var mask = el.mask();
new Ext.ToolTip({
target: mask,
showDelay: 100,
trackMouse:true,
html: t("click_right_to_overwrite")
});
mask.on("contextmenu", function (e) {
var menu = new Ext.menu.Menu();
menu.add(new Ext.menu.Item({
text: t('overwrite'),
iconCls: "pimcore_icon_overwrite",
handler: function (item) {
this.setInherited(false);
}.bind(this)
}));
menu.showAt(e.getXY());
e.stopEvent();
}.bind(this));
} else {
el.unmask();
}
},
getInherited: function () {
return this.inherited;
},
setId: function (id) {
this.id = id;
},
getId: function () {
return this.id;
},
/**
* @deprecated use parseConfig()
*/
parseOptions: function (options) {
return this.parseConfig(options);
},
parseConfig: function (config) {
if(!config || config instanceof Array || typeof config != "object") {
config = {};
}
/**
* @TODO remove in Pimcore 7
* @deprecated use this.config()
*/
this.options = config;
return config;
},
/**
* HACK to get custom data from a grid instead of the tree
* better solutions are welcome ;-)
*/
getCustomPimcoreDropData : function (data){
if(typeof(data.grid) != 'undefined' && typeof(data.grid.getCustomPimcoreDropData) == 'function'){ //droped from priceList
var record = data.grid.getStore().getAt(data.rowIndex);
var data = data.grid.getCustomPimcoreDropData(record);
}
return data;
},
getContext: function() {
var context = {
scope: "documentEditor",
containerType: "document",
documentId: pimcore_document_id,
fieldname: this.name
}
return context;
},
validateRequiredValue: function(value, el, parent, mark) {
let valueLength = 1;
if (typeof value === "string") {
valueLength = trim(strip_tags(value)).length;
} else if (value == null) {
valueLength = 0;
}
if (valueLength < 1) {
parent.requiredError = true;
if (mark) {
el.addCls('editable-error');
}
} else {
parent.requiredError = false;
if (mark) {
el.removeCls('editable-error');
}
}
}
});
| {
"pile_set_name": "Github"
} |
---
title: Date Ranges
signature: |
npm install moment-range
---
If you need to work with date ranges, you can use Gianni Chiappetta's plugin `moment-range`.
Documentation can be found on the homepage [github.com/rotaready/moment-range](https://github.com/rotaready/moment-range).
And it is also available for the web at the repository below.
The repository is located at [github.com/rotaready/moment-range](https://github.com/rotaready/moment-range).
| {
"pile_set_name": "Github"
} |
/* Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _SIZES_H
#define _SIZES_H 1
#define PTR_SIZE_STR "4"
#endif /* sizes.h */
| {
"pile_set_name": "Github"
} |
parameters:
- name: build_number
type: string
- name: scenario
type: string
- name: ansible_version
type: string
default: ">=2.9,<2.10"
- name: python_version
type: string
default: 3.6
jobs:
- job: Test_PyTests
displayName: Run pytests on ${{ parameters.scenario }}
timeoutInMinutes: 120
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '${{ parameters.python_version }}'
- script: |
pip install \
"molecule[docker]>=3" \
"ansible${{ parameters.ansible_version }}"
displayName: Install molecule and Ansible
- script: pip install -r requirements-tests.txt
displayName: Install dependencies
- script: |
mkdir -p ~/.ansible/roles ~/.ansible/library ~/.ansible/module_utils
cp -a roles/* ~/.ansible/roles
cp -a plugins/modules/* ~/.ansible/library
cp -a plugins/module_utils/* ~/.ansible/module_utils
molecule create -s ${{ parameters.scenario }}
displayName: Setup test container
- script: |
pytest \
-m "not playbook" \
--verbose \
--color=yes \
--junit-xml=TEST-results-pytests.xml
displayName: Run tests
env:
IPA_SERVER_HOST: ${{ parameters.scenario }}
RUN_TESTS_IN_DOCKER: true
- task: PublishTestResults@2
inputs:
mergeTestResults: true
testRunTitle: PlaybookTests-Build${{ parameters.build_number }}
condition: succeededOrFailed()
| {
"pile_set_name": "Github"
} |
package validator
import (
"github.com/vektah/gqlparser/v2/ast"
. "github.com/vektah/gqlparser/v2/validator"
)
func init() {
AddRule("NoUnusedFragments", func(observers *Events, addError AddErrFunc) {
inFragmentDefinition := false
fragmentNameUsed := make(map[string]bool)
observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) {
if !inFragmentDefinition {
fragmentNameUsed[fragmentSpread.Name] = true
}
})
observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
inFragmentDefinition = true
if !fragmentNameUsed[fragment.Name] {
addError(
Message(`Fragment "%s" is never used.`, fragment.Name),
At(fragment.Position),
)
}
})
})
}
| {
"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.
*/
/**
* Project : WebQQCore
* Package : iqq.im.bean
* File : QQStatus.java
* Author : solosky < [email protected] >
* Created : 2013-3-24
* License : Apache License 2.0
*/
package iqq.im.bean;
/**
*
* QQ状态枚举
*
* @author solosky
*/
public enum QQStatus {
/**
* 10 : "online",
20 : "offline",
30 : "away",
40 : "hidden",
50 : "busy",
60 : "callme",
70 : "silent"
*/
ONLINE("online", 10),
OFFLINE("offline", 20),
AWAY("away", 30),
HIDDEN("hidden", 40),
BUSY("busy", 50),
CALLME("callme", 60),
SLIENT("silent", 70);
private String value;
private int status;
QQStatus(String value, int status){
this.value = value;
this.status = status;
}
/**
* <p>Getter for the field <code>value</code>.</p>
*
* @return a {@link java.lang.String} object.
*/
public String getValue(){
return value;
}
/**
* <p>Getter for the field <code>status</code>.</p>
*
* @return a int.
*/
public int getStatus(){
return status;
}
/**
* <p>valueOfRaw.</p>
*
* @param txt a {@link java.lang.String} object.
* @return a {@link iqq.im.bean.QQStatus} object.
*/
public static QQStatus valueOfRaw(String txt){
for(QQStatus s: QQStatus.values()){
if(s.value.equals(txt)){
return s;
}
}
throw new IllegalArgumentException("unknown QQStatus enum: " + txt);
}
/**
* <p>valueOfRaw.</p>
*
* @param status a int.
* @return a {@link iqq.im.bean.QQStatus} object.
*/
public static QQStatus valueOfRaw(int status){
for(QQStatus s: QQStatus.values()){
if(s.status == status){
return s;
}
}
throw new IllegalArgumentException("unknown QQStatus enum: " + status);
}
/**
* <p>isGeneralOnline.</p>
*
* @param stat a {@link iqq.im.bean.QQStatus} object.
* @return a boolean.
*/
public static boolean isGeneralOnline(QQStatus stat){
return (stat == QQStatus.ONLINE ||
stat == QQStatus.CALLME ||
stat == QQStatus.AWAY ||
stat == QQStatus.SLIENT ||
stat == QQStatus.BUSY ||
stat == QQStatus.HIDDEN);
}
}
| {
"pile_set_name": "Github"
} |
{
"css": {
"properties": {
"scale": {
"__compat": {
"mdn_url": "https://developer.mozilla.org/docs/Web/CSS/scale",
"support": {
"chrome": {
"version_added": false
},
"chrome_android": {
"version_added": false
},
"edge": {
"version_added": false
},
"firefox": [
{
"version_added": "72"
},
{
"version_added": "60",
"version_removed": "72",
"flags": [
{
"type": "preference",
"name": "layout.css.individual-transform.enabled",
"value_to_set": "true"
}
]
}
],
"firefox_android": {
"version_added": "60",
"flags": [
{
"type": "preference",
"name": "layout.css.individual-transform.enabled",
"value_to_set": "true"
}
]
},
"ie": {
"version_added": false
},
"opera": {
"version_added": false
},
"opera_android": {
"version_added": false
},
"safari": {
"version_added": false
},
"safari_ios": {
"version_added": false
},
"samsunginternet_android": {
"version_added": false
},
"webview_android": {
"version_added": false
}
},
"status": {
"experimental": false,
"standard_track": true,
"deprecated": false
}
}
}
}
}
}
| {
"pile_set_name": "Github"
} |
----------------------------------------------------------------
-- ZLib for Ada thick binding. --
-- --
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
-- --
-- Open source license information is in the zlib.ads file. --
----------------------------------------------------------------
--
-- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
-- This demo program provided by Dr Steve Sangwine <[email protected]>
--
-- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
-- of exactly the correct size is used for decompressed data, and the last
-- few bytes passed in to Zlib are checksum bytes.
-- This program compresses a string of text, and then decompresses the
-- compressed text into a buffer of the same size as the original text.
with Ada.Streams; use Ada.Streams;
with Ada.Text_IO;
with ZLib; use ZLib;
procedure Buffer_Demo is
EOL : Character renames ASCII.LF;
Text : constant String
:= "Four score and seven years ago our fathers brought forth," & EOL &
"upon this continent, a new nation, conceived in liberty," & EOL &
"and dedicated to the proposition that `all men are created equal'.";
Source : Stream_Element_Array (1 .. Text'Length);
for Source'Address use Text'Address;
begin
Ada.Text_IO.Put (Text);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line
("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
declare
Compressed_Data : Stream_Element_Array (1 .. Text'Length);
L : Stream_Element_Offset;
begin
Compress : declare
Compressor : Filter_Type;
I : Stream_Element_Offset;
begin
Deflate_Init (Compressor);
-- Compress the whole of T at once.
Translate (Compressor, Source, I, Compressed_Data, L, Finish);
pragma Assert (I = Source'Last);
Close (Compressor);
Ada.Text_IO.Put_Line
("Compressed size : "
& Stream_Element_Offset'Image (L) & " bytes");
end Compress;
-- Now we decompress the data, passing short blocks of data to Zlib
-- (because this demonstrates the problem - the last block passed will
-- contain checksum information and there will be no output, only a
-- check inside Zlib that the checksum is correct).
Decompress : declare
Decompressor : Filter_Type;
Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
Block_Size : constant := 4;
-- This makes sure that the last block contains
-- only Adler checksum data.
P : Stream_Element_Offset := Compressed_Data'First - 1;
O : Stream_Element_Offset;
begin
Inflate_Init (Decompressor);
loop
Translate
(Decompressor,
Compressed_Data
(P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
P,
Uncompressed_Data
(Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
O,
No_Flush);
Ada.Text_IO.Put_Line
("Total in : " & Count'Image (Total_In (Decompressor)) &
", out : " & Count'Image (Total_Out (Decompressor)));
exit when P = L;
end loop;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put_Line
("Decompressed text matches original text : "
& Boolean'Image (Uncompressed_Data = Source));
end Decompress;
end;
end Buffer_Demo;
| {
"pile_set_name": "Github"
} |
//
// DDSetting.m
// Duoduo
//
// Created by 独嘉 on 14-3-25.
// Copyright (c) 2014年 zuoye. All rights reserved.
//
#import "DDSetting.h"
static NSString* const kSettingVersionKey = @"SettingVersion";
@interface DDSetting(privateAPI)
- (void)checkUpdateToRestoreSetting;
@end
static NSString* kTopKey = @"TopSession";
static NSString* kShieldKey = @"ShieldSession";
@implementation DDSetting
+ (instancetype)instance
{
static DDSetting* g_setting;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
g_setting = [[DDSetting alloc] init];
});
return g_setting;
}
- (id)init
{
self = [super init];
if (self)
{
[self checkUpdateToRestoreSetting];
}
return self;
}
- (void)restoreDefaultSetting
{
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:TOP_SESSION_KEY];
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:SHIELD_SESSION_KEY];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (NSArray*)getTopSessionIDs
{
NSDictionary* topSessionDic = [[NSUserDefaults standardUserDefaults] objectForKey:TOP_SESSION_KEY];
NSString* myID = [[DDClientState shareInstance] userID];
return topSessionDic[myID];
}
- (void)addTopSessionID:(NSString*)sessionID
{
NSDictionary* topSessionDic = [[NSUserDefaults standardUserDefaults] objectForKey:TOP_SESSION_KEY];
NSString* myID = [[DDClientState shareInstance] userID];
NSArray* oldTopSessions = topSessionDic[myID];
NSMutableArray* newTopSession = [[NSMutableArray alloc] initWithArray:oldTopSessions];
if (![newTopSession containsObject:sessionID])
{
[newTopSession addObject:sessionID];
}
NSMutableDictionary* newTopSessionDic = [[NSMutableDictionary alloc] initWithDictionary:topSessionDic];
[newTopSessionDic setObject:newTopSession forKey:myID];
[[NSUserDefaults standardUserDefaults] setObject:newTopSessionDic forKey:TOP_SESSION_KEY];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void)removeTopSessionID:(NSString*)sessionID
{
NSArray* oldTopSession = [self getTopSessionIDs];
if (![oldTopSession containsObject:sessionID])
{
return;
}
else
{
NSMutableArray* newTopSession = [[NSMutableArray alloc] initWithArray:oldTopSession];
[newTopSession removeObject:sessionID];
NSString* myID = [[DDClientState shareInstance] userID];
NSDictionary* oldTopSessionDic = [[NSUserDefaults standardUserDefaults] objectForKey:TOP_SESSION_KEY];
NSMutableDictionary* newTopSessionDic = [[NSMutableDictionary alloc] initWithDictionary:oldTopSessionDic];
[newTopSessionDic setObject:newTopSession forKey:myID];
[[NSUserDefaults standardUserDefaults] setObject:newTopSessionDic forKey:TOP_SESSION_KEY];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
- (NSArray*)getShieldSessionIDs
{
NSDictionary* shieldSessionDic = [[NSUserDefaults standardUserDefaults] objectForKey:SHIELD_SESSION_KEY];
NSString* myID = [[DDClientState shareInstance] userID];
NSMutableArray* shieldSessions = [[NSMutableArray alloc] initWithArray:shieldSessionDic[myID]];
NSNumber* boolNumber = [[NSUserDefaults standardUserDefaults]objectForKey:FIRST_TIME_SET_BUSINESS_SHIELD];
if (!boolNumber)
{
if (![shieldSessions containsObject:@"group_1fis"])
{
[self addShieldSessionID:@"group_1fis"];
}
[[NSUserDefaults standardUserDefaults] setObject:@(1) forKey:FIRST_TIME_SET_BUSINESS_SHIELD];
[[NSUserDefaults standardUserDefaults] synchronize];
}
// [[NSUserDefaults standardUserDefaults] removeObjectForKey:FIRST_TIME_SET_BUSINESS_SHIELD];
// [[NSUserDefaults standardUserDefaults] synchronize];
return shieldSessions;
}
- (void)addShieldSessionID:(NSString*)sessionID
{
NSDictionary* shieldSessionDic = [[NSUserDefaults standardUserDefaults] objectForKey:SHIELD_SESSION_KEY];
NSString* myID = [[DDClientState shareInstance] userID];
NSArray* oldTopSessions = shieldSessionDic[myID];
NSMutableArray* newShieldSession = [[NSMutableArray alloc] initWithArray:oldTopSessions];
if (![newShieldSession containsObject:sessionID])
{
[newShieldSession addObject:sessionID];
}
NSMutableDictionary* newShieldSessionDic = [[NSMutableDictionary alloc] initWithDictionary:shieldSessionDic];
[newShieldSessionDic setObject:newShieldSession forKey:myID];
[[NSUserDefaults standardUserDefaults] setObject:newShieldSessionDic forKey:SHIELD_SESSION_KEY];
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (void)removeShieldSessionID:(NSString*)sessionID
{
NSDictionary* shieldSessionDic = [[NSUserDefaults standardUserDefaults] objectForKey:SHIELD_SESSION_KEY];
NSString* myID = [[DDClientState shareInstance] userID];
NSArray* oldTopSessions = shieldSessionDic[myID];
NSMutableArray* newShieldSession = [[NSMutableArray alloc] initWithArray:oldTopSessions];
if ([newShieldSession containsObject:sessionID])
{
[newShieldSession removeObject:sessionID];
}
NSMutableDictionary* newShieldSessionDic = [[NSMutableDictionary alloc] initWithDictionary:shieldSessionDic];
[newShieldSessionDic setObject:newShieldSession forKey:myID];
[[NSUserDefaults standardUserDefaults] setObject:newShieldSessionDic forKey:SHIELD_SESSION_KEY];
[[NSUserDefaults standardUserDefaults] synchronize];
}
#pragma mark - private API
- (void)checkUpdateToRestoreSetting
{
NSString* version = [[NSUserDefaults standardUserDefaults] objectForKey:kSettingVersionKey];
NSString* currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
if(!version)
{
[[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:kSettingVersionKey];
[self restoreDefaultSetting];
}
if (version && ![version isEqualToString:currentVersion])
{
// [self restoreDefaultSetting];
// [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:kSettingVersionKey];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end
| {
"pile_set_name": "Github"
} |
The Future Of Paste
===================
Introduction
------------
Paste has been under development for a while, and has lots of code in it. Too much code! The code is largely decoupled except for some core functions shared by many parts of the code. Those core functions are largely replaced in `WebOb <http://pythonpaste.org/webob/>`_, and replaced with better implementations.
The future of these pieces is to split them into independent packages, and refactor the internal Paste dependencies to rely instead on WebOb.
Already Extracted
-----------------
paste.fixture:
WebTest
ScriptTest
paste.lint:
wsgiref.validate
paste.exceptions and paste.evalexception:
WebError
paste.util.template:
Tempita
To Be Separated
---------------
paste.httpserver and paste.debug.watchthreads:
Not sure what to call this.
paste.cascade and paste.errordocuments:
Not sure; Ben has an implementation of errordocuments in ``pylons.middleware.StatusCodeRedirect``
paste.urlmap, paste.deploy.config.PrefixMiddleware:
In... some routing thing? Together with the previous package?
paste.proxy:
WSGIProxy (needs lots of cleanup though)
paste.fileapp, paste.urlparser.StaticURLParser, paste.urlparser.PkgResourcesParser:
In some new file-serving package.
paste.cgiapp, wphp.fcgi_app:
Some proxyish app... maybe WSGIProxy?
paste.translogger, paste.debug.prints, paste.util.threadedprint, wsgifilter.proxyapp.DebugHeaders:
Some... other place. Something loggy.
paste.registry, paste.config:
Not sure. Alberto Valverde expressed interest in splitting out paste.registry.
paste.cgitb_catcher:
Move to WebError? Not sure if it matters. For some reason people use this, though.
To Deprecate
------------
(In that, I won't extract these anywhere; I'm not going to do any big deletes anytime soon, though)
paste.recursive
Better to do it manually (with webob.Request.get_response)
paste.wsgiwrappers, paste.request, paste.response, paste.wsgilib, paste.httpheaders, paste.httpexceptions:
All the functionality is already in WebOb.
paste.urlparser.URLParser:
Really this is tied to paste.webkit more than anything.
paste.auth.*:
Well, these all need to be refactored, and replacements exist in AuthKit and repoze.who. Some pieces might still have utility.
paste.debug.profile:
I think repoze.profile supersedes this.
paste.debug.wdg_validator:
It could get reimplemented with more options for validators, but I'm not really that interested at the moment. The code is nothing fancy.
paste.transaction:
More general in repoze.tm
paste.url:
No one uses this
Undecided
---------
paste.debug.fsdiff:
Maybe ScriptTest?
paste.session:
It's an okay naive session system. But maybe Beaker makes it irrelevant (Beaker does seem slightly more complex to setup). But then, this can just live here indefinitely.
paste.gzipper:
I'm a little uncomfortable with this in concept. It's largely in WebOb right now, but not as middleware.
paste.reloader:
Maybe this should be moved to paste.script (i.e., paster serve)
paste.debug.debugapp, paste.script.testapp:
Alongside other debugging tools, I guess
paste.progress:
Not sure this works.
| {
"pile_set_name": "Github"
} |
"""Add TestGroup.num_leaves
Revision ID: 4640ecd97c82
Revises: 48a922151dd4
Create Date: 2013-11-08 13:11:18.802332
"""
# revision identifiers, used by Alembic.
revision = '4640ecd97c82'
down_revision = '48a922151dd4'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column('testgroup', sa.Column('num_leaves', sa.Integer(), nullable=False, server_default='0'))
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('testgroup', 'num_leaves')
### end Alembic commands ###
| {
"pile_set_name": "Github"
} |
(function() {
var escope, esprima, expect, harmony;
expect = require('chai').expect;
esprima = require('esprima');
harmony = require('../third_party/esprima');
escope = require('..');
describe('global increment', function() {
return it('becomes read/write', function() {
var ast, globalScope, scopeManager;
ast = esprima.parse("b++;");
scopeManager = escope.analyze(ast);
expect(scopeManager.scopes).to.have.length(1);
globalScope = scopeManager.scopes[0];
expect(globalScope.type).to.be.equal('global');
expect(globalScope.variables).to.have.length(0);
expect(globalScope.references).to.have.length(1);
return expect(globalScope.references[0].isReadWrite()).to.be["true"];
});
});
}).call(this);
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImdsb2JhbC1pbmNyZW1lbnQuY29mZmVlIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXVCQTtBQUFBLE1BQUEsZ0NBQUE7O0FBQUEsRUFBQSxNQUFBLEdBQVMsT0FBQSxDQUFTLE1BQVQsQ0FBZSxDQUFDLE1BQXpCLENBQUE7O0FBQUEsRUFDQSxPQUFBLEdBQVUsT0FBQSxDQUFTLFNBQVQsQ0FEVixDQUFBOztBQUFBLEVBRUEsT0FBQSxHQUFVLE9BQUEsQ0FBUyx3QkFBVCxDQUZWLENBQUE7O0FBQUEsRUFHQSxNQUFBLEdBQVMsT0FBQSxDQUFTLElBQVQsQ0FIVCxDQUFBOztBQUFBLEVBS0EsUUFBQSxDQUFVLGtCQUFWLEVBQTZCLFNBQUEsR0FBQTtXQUN6QixFQUFBLENBQUksb0JBQUosRUFBeUIsU0FBQSxHQUFBO0FBQ3JCLFVBQUEsOEJBQUE7QUFBQSxNQUFBLEdBQUEsR0FBTSxPQUFPLENBQUMsS0FBUixDQUFpQixNQUFqQixDQUFOLENBQUE7QUFBQSxNQUlBLFlBQUEsR0FBZSxNQUFNLENBQUMsT0FBUCxDQUFlLEdBQWYsQ0FKZixDQUFBO0FBQUEsTUFLQSxNQUFBLENBQU8sWUFBWSxDQUFDLE1BQXBCLENBQTJCLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxNQUFwQyxDQUEyQyxDQUEzQyxDQUxBLENBQUE7QUFBQSxNQU1BLFdBQUEsR0FBYyxZQUFZLENBQUMsTUFBTyxDQUFBLENBQUEsQ0FObEMsQ0FBQTtBQUFBLE1BT0EsTUFBQSxDQUFPLFdBQVcsQ0FBQyxJQUFuQixDQUF3QixDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsS0FBL0IsQ0FBc0MsUUFBdEMsQ0FQQSxDQUFBO0FBQUEsTUFRQSxNQUFBLENBQU8sV0FBVyxDQUFDLFNBQW5CLENBQTZCLENBQUMsRUFBRSxDQUFDLElBQUksQ0FBQyxNQUF0QyxDQUE2QyxDQUE3QyxDQVJBLENBQUE7QUFBQSxNQVNBLE1BQUEsQ0FBTyxXQUFXLENBQUMsVUFBbkIsQ0FBOEIsQ0FBQyxFQUFFLENBQUMsSUFBSSxDQUFDLE1BQXZDLENBQThDLENBQTlDLENBVEEsQ0FBQTthQVVBLE1BQUEsQ0FBTyxXQUFXLENBQUMsVUFBVyxDQUFBLENBQUEsQ0FBRSxDQUFDLFdBQTFCLENBQUEsQ0FBUCxDQUErQyxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsTUFBRCxFQVhoQztJQUFBLENBQXpCLEVBRHlCO0VBQUEsQ0FBN0IsQ0FMQSxDQUFBO0FBQUEiLCJmaWxlIjoiZ2xvYmFsLWluY3JlbWVudC5qcyIsInNvdXJjZVJvb3QiOiIvc291cmNlLyIsInNvdXJjZXNDb250ZW50IjpbIiMgLSotIGNvZGluZzogdXRmLTggLSotXG4jICBDb3B5cmlnaHQgKEMpIDIwMTUgWXVzdWtlIFN1enVraSA8dXRhdGFuZS50ZWFAZ21haWwuY29tPlxuI1xuIyAgUmVkaXN0cmlidXRpb24gYW5kIHVzZSBpbiBzb3VyY2UgYW5kIGJpbmFyeSBmb3Jtcywgd2l0aCBvciB3aXRob3V0XG4jICBtb2RpZmljYXRpb24sIGFyZSBwZXJtaXR0ZWQgcHJvdmlkZWQgdGhhdCB0aGUgZm9sbG93aW5nIGNvbmRpdGlvbnMgYXJlIG1ldDpcbiNcbiMgICAgKiBSZWRpc3RyaWJ1dGlvbnMgb2Ygc291cmNlIGNvZGUgbXVzdCByZXRhaW4gdGhlIGFib3ZlIGNvcHlyaWdodFxuIyAgICAgIG5vdGljZSwgdGhpcyBsaXN0IG9mIGNvbmRpdGlvbnMgYW5kIHRoZSBmb2xsb3dpbmcgZGlzY2xhaW1lci5cbiMgICAgKiBSZWRpc3RyaWJ1dGlvbnMgaW4gYmluYXJ5IGZvcm0gbXVzdCByZXByb2R1Y2UgdGhlIGFib3ZlIGNvcHlyaWdodFxuIyAgICAgIG5vdGljZSwgdGhpcyBsaXN0IG9mIGNvbmRpdGlvbnMgYW5kIHRoZSBmb2xsb3dpbmcgZGlzY2xhaW1lciBpbiB0aGVcbiMgICAgICBkb2N1bWVudGF0aW9uIGFuZC9vciBvdGhlciBtYXRlcmlhbHMgcHJvdmlkZWQgd2l0aCB0aGUgZGlzdHJpYnV0aW9uLlxuI1xuIyAgVEhJUyBTT0ZUV0FSRSBJUyBQUk9WSURFRCBCWSBUSEUgQ09QWVJJR0hUIEhPTERFUlMgQU5EIENPTlRSSUJVVE9SUyBcIkFTIElTXCJcbiMgIEFORCBBTlkgRVhQUkVTUyBPUiBJTVBMSUVEIFdBUlJBTlRJRVMsIElOQ0xVRElORywgQlVUIE5PVCBMSU1JVEVEIFRPLCBUSEVcbiMgIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkgQU5EIEZJVE5FU1MgRk9SIEEgUEFSVElDVUxBUiBQVVJQT1NFXG4jICBBUkUgRElTQ0xBSU1FRC4gSU4gTk8gRVZFTlQgU0hBTEwgPENPUFlSSUdIVCBIT0xERVI+IEJFIExJQUJMRSBGT1IgQU5ZXG4jICBESVJFQ1QsIElORElSRUNULCBJTkNJREVOVEFMLCBTUEVDSUFMLCBFWEVNUExBUlksIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFU1xuIyAgKElOQ0xVRElORywgQlVUIE5PVCBMSU1JVEVEIFRPLCBQUk9DVVJFTUVOVCBPRiBTVUJTVElUVVRFIEdPT0RTIE9SIFNFUlZJQ0VTO1xuIyAgTE9TUyBPRiBVU0UsIERBVEEsIE9SIFBST0ZJVFM7IE9SIEJVU0lORVNTIElOVEVSUlVQVElPTikgSE9XRVZFUiBDQVVTRUQgQU5EXG4jICBPTiBBTlkgVEhFT1JZIE9GIExJQUJJTElUWSwgV0hFVEhFUiBJTiBDT05UUkFDVCwgU1RSSUNUIExJQUJJTElUWSwgT1IgVE9SVFxuIyAgKElOQ0xVRElORyBORUdMSUdFTkNFIE9SIE9USEVSV0lTRSkgQVJJU0lORyBJTiBBTlkgV0FZIE9VVCBPRiBUSEUgVVNFIE9GXG4jICBUSElTIFNPRlRXQVJFLCBFVkVOIElGIEFEVklTRUQgT0YgVEhFIFBPU1NJQklMSVRZIE9GIFNVQ0ggREFNQUdFLlxuXG5leHBlY3QgPSByZXF1aXJlKCdjaGFpJykuZXhwZWN0XG5lc3ByaW1hID0gcmVxdWlyZSAnZXNwcmltYSdcbmhhcm1vbnkgPSByZXF1aXJlICcuLi90aGlyZF9wYXJ0eS9lc3ByaW1hJ1xuZXNjb3BlID0gcmVxdWlyZSAnLi4nXG5cbmRlc2NyaWJlICdnbG9iYWwgaW5jcmVtZW50JywgLT5cbiAgICBpdCAnYmVjb21lcyByZWFkL3dyaXRlJywgLT5cbiAgICAgICAgYXN0ID0gZXNwcmltYS5wYXJzZSBcIlwiXCJcbiAgICAgICAgYisrO1xuICAgICAgICBcIlwiXCJcblxuICAgICAgICBzY29wZU1hbmFnZXIgPSBlc2NvcGUuYW5hbHl6ZSBhc3RcbiAgICAgICAgZXhwZWN0KHNjb3BlTWFuYWdlci5zY29wZXMpLnRvLmhhdmUubGVuZ3RoIDFcbiAgICAgICAgZ2xvYmFsU2NvcGUgPSBzY29wZU1hbmFnZXIuc2NvcGVzWzBdXG4gICAgICAgIGV4cGVjdChnbG9iYWxTY29wZS50eXBlKS50by5iZS5lcXVhbCAnZ2xvYmFsJ1xuICAgICAgICBleHBlY3QoZ2xvYmFsU2NvcGUudmFyaWFibGVzKS50by5oYXZlLmxlbmd0aCAwXG4gICAgICAgIGV4cGVjdChnbG9iYWxTY29wZS5yZWZlcmVuY2VzKS50by5oYXZlLmxlbmd0aCAxXG4gICAgICAgIGV4cGVjdChnbG9iYWxTY29wZS5yZWZlcmVuY2VzWzBdLmlzUmVhZFdyaXRlKCkpLnRvLmJlLnRydWVcblxuIyB2aW06IHNldCBzdz00IHRzPTQgZXQgdHc9ODAgOlxuIl19 | {
"pile_set_name": "Github"
} |
source 'http://rubygems.org'
gem 'rake'
gemspec
| {
"pile_set_name": "Github"
} |
/*
* Part of the CCNx Java Library.
*
* Copyright (C) 2008, 2009, 2011 Palo Alto Research Center, Inc.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. You should have received
* a copy of the GNU Lesser General Public License along with this library;
* if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.ccnx.ccn.impl.support;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Routes output from the daemon stdout/stderr to a file
*/
public class DaemonOutput extends Thread {
private InputStream _is;
private OutputStream _os;
public DaemonOutput(InputStream is, OutputStream os) throws FileNotFoundException {
_is = is;
_os = os;
this.start();
}
public void run() {
while (true) {
try {
while (_is.available() > 0) {
int size = _is.available();
byte[] b = new byte[size];
_is.read(b, 0, size);
_os.write(b);
_os.flush();
}
Thread.sleep(1000);
} catch (IOException e) {
return;
} catch (InterruptedException e) {}
}
}
public void close() throws IOException {
try {
_os.close();
} finally {
_is.close();
}
}
}
| {
"pile_set_name": "Github"
} |
/**
* This module implements some stubs for the voice call service unit tests.
*
* Copyright (C) Sierra Wireless Inc.
*
*/
#include "legato.h"
#include "interfaces.h"
//--------------------------------------------------------------------------------------------------
/**
* le_audio_OpenModemVoiceTx() stub.
*
*/
//--------------------------------------------------------------------------------------------------
le_audio_StreamRef_t le_audio_OpenModemVoiceTx
(
void
)
{
return (le_audio_StreamRef_t) 0x100A;
}
//--------------------------------------------------------------------------------------------------
/**
* le_audio_OpenModemVoiceRx() stub.
*
*/
//--------------------------------------------------------------------------------------------------
le_audio_StreamRef_t le_audio_OpenModemVoiceRx
(
void
)
{
return (le_audio_StreamRef_t) 0x100B;
}
| {
"pile_set_name": "Github"
} |
//
// things.edf
//
// EDF for Eternity Engine v3.40.50
//
// thingtypes define monsters, fireballs, decorations, etc.
// thingtypes may be defined elsewhere, and order is unimportant.
// User-defined thing types should use DoomEd numbers greater than 20000, and
// DeHackEd numbers greater than 10000 in all cases, to remain compatible with
// future versions of Eternity. See the EDF documentation for important
// information on the format of thingtype fields.
//
// Doom Thing Types ------------------------------------------------------------
// DoomEdNums: 1 - 3999
// DeHackEd Nums: 0 - 137, 141, 142, 144, 158 - 169
includeifenabled("doom/things.edf", "DOOM")
// Heretic Thing Types ---------------------------------------------------------
// DoomEdNums: 7001 - 7299
// DeHackEd Nums: 300 - 399
includeifenabled("heretic/things.edf", "HERETIC")
// Common Objects --------------------------------------------------------------
//
// TeleportSpot
//
// This is the object used to tag line-to-thing teleport exit spots. It is
// shared by all gamemodes.
//
thingtype TeleportSpot : Mobj, 14, 42
{
compatname TeleportDest
flags NOSECTOR|NOBLOCKMAP
}
// BOOM Objects ----------------------------------------------------------------
thingtype BoomPushPoint : Mobj, 5001, 138
{
compatname PointPusher
spawnstate S_TNT1
radius 0.0001220703125 // haleyjd: very odd values...
height 0.0001220703125
mass 10
flags NOBLOCKMAP
}
thingtype BoomPullPoint : Mobj, 5002, 139
{
compatname PointPuller
spawnstate S_TNT1
radius 0.0001220703125 // haleyjd: very odd values...
height 0.0001220703125
mass 10
flags NOBLOCKMAP
}
// MBF Objects -----------------------------------------------------------------
thingtype MBFHelperDog : Mobj, 888, 140
{
spawnhealth 500
painchance 180
speed 10
radius 12.0
height 28.0
activesound dgact
seesound dgsit
attacksound dgatk
painsound dgpain
deathsound dgdth
cflags SOLID|SHOOTABLE|COUNTKILL|JUMPDOWN|FOOTCLIP|SPACMONSTER|PASSMOBJ|AUTOTRANSLATE
obituary_melee "was chased down by a rabid puppy"
firstdecoratestate S_DOGS_STND
states
@"
Spawn:
DOGS AB 10 A_Look
loop
See:
DOGS AABBCCDD 2 A_Chase
loop
Melee:
DOGS EF 8 A_FaceTarget
DOGS G 8 A_SargAttack
goto See
Pain:
DOGS H 2
DOGS H 2 A_Pain
goto See
Death:
DOGS I 8
DOGS J 8 A_Scream
DOGS K 4
DOGS L 4 A_Fall
DOGS M 4
DOGS N -1
stop
Raise:
DOGS NMLKJI 5
goto See
"@
}
// Note: Beta BFG fireballs (deh# 141, 142, 144) are defined in doom/things.edf
// SMMU Objects ----------------------------------------------------------------
thingtype SMMUCameraSpot : Mobj, 5003, 1062
{
spawnstate S_TNT1
mass 10
flags NOBLOCKMAP
}
// Eternity Engine Objects -----------------------------------------------------
// Environmental Sequence Point
thingtype EEEnviroSequence : Mobj, 1300
{
spawnstate S_TNT1
cflags NOBLOCKMAP|NOGRAVITY
}
// Sector Sequence Override
thingtype EESectorSequence : Mobj, 1500
{
spawnstate S_TNT1
cflags NOBLOCKMAP|NOGRAVITY
}
thingtype Unknown : Mobj, 5005
{
spawnstate S_UNKNOWN
radius 32.0
height 56.0
cflags NOBLOCKMAP|NOGRAVITY
}
thingtype EESkyboxCam : Mobj, 5006
{
compatname SkyCamCompat
spawnstate S_TNT1
radius 10.0
height 10.0
mass 10
flags NOBLOCKMAP|NOGRAVITY
}
thingtype EEParticleDrip : Mobj, 5007, 1051
{
spawnstate S_TNT1
radius 1.0
height 1.0
flags NOBLOCKMAP|NOGRAVITY
particlefx DRIP
}
// What's this??? o_O
thingtype EERavenObj : Unknown, 5008
{
skinsprite EERV
}
// Hexen compatible map spots for scripting
thingtype EEMapSpot : Mobj, 9001, 1052
{
compatname MapSpot
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
thingtype EEMapSpotGravity : Mobj, 9013, 1053
{
compatname MapSpotGravity
spawnstate S_TNT1
cflags DONTDRAW|NOSPLASH
}
// Particle fountains (9027 - 9033)
thingtype EEParticleFountain
{
spawnstate S_TNT1
height 0.0
}
// Sound Environment Zone controller
thingtype EESoundEnvironment : Mobj, 9048
{
compatname SoundEnvironment
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
// Polyobject spots
thingtype EEPolyObjAnchor : Mobj, 9300, 1054
{
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
thingtype EEPolyObjSpawnSpot : Mobj, 9301, 1055
{
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
thingtype EEPolyObjSpawnSpotCrush : Mobj, 9302, 1056
{
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
thingtype EEPolyObjSpawnSpotDamage : Mobj, 9303, 1057
{
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
// Ambience object
thingtype EEAmbience : Mobj, 14065
{
compatname AmbientSound
spawnstate S_EE_AMBIENCE_SPAWN
cflags NOBLOCKMAP|NOGRAVITY
}
// Music Changer
thingtype EEMusicChanger : Mobj, 145
{
compatname MusicChanger
spawnstate S_TNT1
cflags NOBLOCKMAP|NOSECTOR|NOGRAVITY
}
// Doom Builder's 3D mode camera spots often get left in maps.
// Let's define an Unknown object with the default DoomEdNum.
thingtype DoomBuilderCameraSpot : Unknown
{
compatname DoomBuilderCamera
translucency 33%
}
// Terrain Objects
thingtype EETerrainLavaSplash : Mobj, -1, 1045
{
compatname LavaSplash
spawnstate S_LAVASPLASH1
cflags NOBLOCKMAP|NOGRAVITY|NOSPLASH
}
thingtype EETerrainLavaSmoke : Mobj, -1, 1046
{
compatname LavaSmoke
spawnstate S_LAVASMOKE1
cflags NOBLOCKMAP|NOGRAVITY|NOSPLASH
translucency 26624
}
thingtype EETerrainWaterSplash : Mobj, -1, 1047
{
compatname WaterSplash
spawnstate S_SPLASH1
deathstate S_SPLASHX
radius 2.0
height 4.0
cflags NOBLOCKMAP|DROPOFF|MISSILE|LOGRAV|NOSPLASH|NOCROSS|CANNOTPUSH|NOZERODAMAGE
}
thingtype EETerrainWaterBase : Mobj, -1, 1048
{
compatname WaterSplashBase
spawnstate S_SPLASHBASE1
cflags NOBLOCKMAP|NOGRAVITY|NOSPLASH
}
thingtype EETerrainSludgeChunk : Mobj, -1, 1049
{
compatname SludgeChunk
spawnstate S_SLUDGE1
deathstate S_SLUDGEX
radius 2.0
height 4.0
mass 150
cflags NOBLOCKMAP|DROPOFF|MISSILE|LOGRAV|NOSPLASH|NOCROSS|CANNOTPUSH|NOZERODAMAGE
}
thingtype EETerrainSludgeBase : Mobj, -1, 1050
{
compatname SludgeSplash
spawnstate S_SLUDGEBASE1
cflags NOBLOCKMAP|NOGRAVITY|NOSPLASH
}
// Eternity TC Objects ---------------------------------------------------------
// WARNING: NONE of the thingtypes below here are considered documented, and
// many are subject to future removal -- most are left-over from Eternity TC
// development and have not been removed because they use potentially useful
// code that may be generalized for editor use. DO NOT depend upon the presence,
// availability, or DeHackEd number of any object below this point.
thingtype ETCFogSpawner
{
spawnstate S_SPAWNFOG1
flags NOBLOCKMAP
flags2 NOTHRUST|FLOATBOB|DONTDRAW
}
thingtype ETCSmallFog
{
spawnstate S_FOGPATCHS1
deathstate S_FOGPATCHS0
speed 65536
flags NOBLOCKMAP|NOGRAVITY|NOCLIP|FLOAT|TRANSLUCENT
}
thingtype ETCMediumFog
{
spawnstate S_FOGPATCHM1
deathstate S_FOGPATCHM0
speed 65536
flags NOBLOCKMAP|NOGRAVITY|NOCLIP|FLOAT|TRANSLUCENT
}
thingtype ETCLargeFog
{
spawnstate S_FOGPATCHL1
deathstate S_FOGPATCHL0
speed 65536
flags NOBLOCKMAP|NOGRAVITY|NOCLIP|FLOAT|TRANSLUCENT
}
thingtype ETCTotalInvisiSphere
{
spawnstate S_PNS2_1
flags SPECIAL|COUNTITEM|TRANSLUCENT
}
// Damage Types ----------------------------------------------------------------
// Note: the "Unknown" type, number 0, is defined by the engine and cannot be
// overridden or altered. It is unnecessary and is not recommended to assign
// your own damage types numbers. They are provided for backward compatibility
// only. If the obituary string begins with a $, it is a BEX mnemonic for the
// internal string to use as the message.
// Normal damagetypes
damagetype Fist { num 1; obituary "$OB_FIST" }
damagetype Pistol { num 2; obituary "$OB_PISTOL" }
damagetype Shotgun { num 3; obituary "$OB_SHOTGUN" }
damagetype Chaingun { num 4; obituary "$OB_CHAINGUN" }
damagetype Plasma { num 7; obituary "$OB_PLASMA" }
damagetype BFG { num 8; obituary "$OB_BFG" }
damagetype BFG_Splash { num 9; obituary "$OB_BFG_SPLASH" }
damagetype Chainsaw { num 10; obituary "$OB_CHAINSAW" }
damagetype SShotgun { num 11; obituary "$OB_SSHOTGUN" }
damagetype BetaBFG { num 22; obituary "$OB_BETABFG" }
damagetype BFGBurst { num 23; obituary "$OB_BFGBURST" }
// Damagetypes that are sourceless, or want to be treated that way.
damagetype Slime { num 12; obituary "$OB_SLIME"; sourceless true }
damagetype Lava { num 13; obituary "$OB_LAVA"; sourceless true }
damagetype Crush { num 14; obituary "$OB_CRUSH"; sourceless true }
damagetype Telefrag { num 15; obituary "$OB_TELEFRAG"; sourceless true }
damagetype Falling { num 16; obituary "$OB_FALLING"; sourceless true }
damagetype Suicide { num 17; obituary "$OB_SUICIDE"; sourceless true }
damagetype Barrel { num 18; obituary "$OB_BARREL"; sourceless true }
damagetype Splash { num 19; obituary "$OB_SPLASH"; sourceless true }
damagetype Quake { num 26; obituary "$OB_QUAKE"; sourceless true }
// Damage types that can kill oneself, and thus have a special message for it.
damagetype Rocket
{
num 5
obituary "$OB_ROCKET"
obituaryself "$OB_ROCKET_SELF"
}
damagetype R_Splash
{
num 6
obituary "$OB_R_SPLASH"
obituaryself "$OB_R_SPLASH_SELF"
}
damagetype BFG11k_Splash { num 21; obituaryself "$OB_BFG11K_SELF" }
damagetype Grenade
{
num 25
obituary "$OB_GRENADE"
obituaryself "$OB_GRENADE_SELF"
}
// These two damagetypes are special in that the message they trigger depends on
// the thing doing the damage, be it a monster, or a player weapon.
damagetype Hit { num 20 }
damagetype PlayerMisc { num 24 }
// These damagetypes are special in that things with certain flag values will
// inflict them regardless of the value of their mod field.
damagetype Fire { num 27 }
// Doom Retro MT_EXTRA ----------------------------------------------------------------
// DoomEdNums: -1
// DeHackEd Nums: 151 - 250
// EMPTYMOBJ macro from Doom Retro's info.c
thingtype DREmptyMobj : Mobj
{
// Basically everything is just null
spawnhealth 0
reactiontime 0
radius 0.0
height 0.0
correct_height 0.0
mass 0
}
thingtype DRExtraMobj00 : DREmptyMobj, -1, 151 {}
thingtype DRExtraMobj01 : DREmptyMobj, -1, 152 {}
thingtype DRExtraMobj02 : DREmptyMobj, -1, 153 {}
thingtype DRExtraMobj03 : DREmptyMobj, -1, 154 {}
thingtype DRExtraMobj04 : DREmptyMobj, -1, 155 {}
thingtype DRExtraMobj05 : DREmptyMobj, -1, 156 {}
thingtype DRExtraMobj06 : DREmptyMobj, -1, 157 {}
thingtype DRExtraMobj07 : DREmptyMobj, -1, 158 {}
thingtype DRExtraMobj08 : DREmptyMobj, -1, 159 {}
thingtype DRExtraMobj09 : DREmptyMobj, -1, 160 {}
thingtype DRExtraMobj10 : DREmptyMobj, -1, 161 {}
thingtype DRExtraMobj11 : DREmptyMobj, -1, 162 {}
thingtype DRExtraMobj12 : DREmptyMobj, -1, 163 {}
thingtype DRExtraMobj13 : DREmptyMobj, -1, 164 {}
thingtype DRExtraMobj14 : DREmptyMobj, -1, 165 {}
thingtype DRExtraMobj15 : DREmptyMobj, -1, 166 {}
thingtype DRExtraMobj16 : DREmptyMobj, -1, 167 {}
thingtype DRExtraMobj17 : DREmptyMobj, -1, 168 {}
thingtype DRExtraMobj18 : DREmptyMobj, -1, 169 {}
thingtype DRExtraMobj19 : DREmptyMobj, -1, 170 {}
thingtype DRExtraMobj20 : DREmptyMobj, -1, 171 {}
thingtype DRExtraMobj21 : DREmptyMobj, -1, 172 {}
thingtype DRExtraMobj22 : DREmptyMobj, -1, 173 {}
thingtype DRExtraMobj23 : DREmptyMobj, -1, 174 {}
thingtype DRExtraMobj24 : DREmptyMobj, -1, 175 {}
thingtype DRExtraMobj25 : DREmptyMobj, -1, 176 {}
thingtype DRExtraMobj26 : DREmptyMobj, -1, 177 {}
thingtype DRExtraMobj27 : DREmptyMobj, -1, 178 {}
thingtype DRExtraMobj28 : DREmptyMobj, -1, 179 {}
thingtype DRExtraMobj29 : DREmptyMobj, -1, 180 {}
thingtype DRExtraMobj30 : DREmptyMobj, -1, 181 {}
thingtype DRExtraMobj31 : DREmptyMobj, -1, 182 {}
thingtype DRExtraMobj32 : DREmptyMobj, -1, 183 {}
thingtype DRExtraMobj33 : DREmptyMobj, -1, 184 {}
thingtype DRExtraMobj34 : DREmptyMobj, -1, 185 {}
thingtype DRExtraMobj35 : DREmptyMobj, -1, 186 {}
thingtype DRExtraMobj36 : DREmptyMobj, -1, 187 {}
thingtype DRExtraMobj37 : DREmptyMobj, -1, 188 {}
thingtype DRExtraMobj38 : DREmptyMobj, -1, 189 {}
thingtype DRExtraMobj39 : DREmptyMobj, -1, 190 {}
thingtype DRExtraMobj40 : DREmptyMobj, -1, 191 {}
thingtype DRExtraMobj41 : DREmptyMobj, -1, 192 {}
thingtype DRExtraMobj42 : DREmptyMobj, -1, 193 {}
thingtype DRExtraMobj43 : DREmptyMobj, -1, 194 {}
thingtype DRExtraMobj44 : DREmptyMobj, -1, 195 {}
thingtype DRExtraMobj45 : DREmptyMobj, -1, 196 {}
thingtype DRExtraMobj46 : DREmptyMobj, -1, 197 {}
thingtype DRExtraMobj47 : DREmptyMobj, -1, 198 {}
thingtype DRExtraMobj48 : DREmptyMobj, -1, 199 {}
thingtype DRExtraMobj49 : DREmptyMobj, -1, 200 {}
thingtype DRExtraMobj50 : DREmptyMobj, -1, 201 {}
thingtype DRExtraMobj51 : DREmptyMobj, -1, 202 {}
thingtype DRExtraMobj52 : DREmptyMobj, -1, 203 {}
thingtype DRExtraMobj53 : DREmptyMobj, -1, 204 {}
thingtype DRExtraMobj54 : DREmptyMobj, -1, 205 {}
thingtype DRExtraMobj55 : DREmptyMobj, -1, 206 {}
thingtype DRExtraMobj56 : DREmptyMobj, -1, 207 {}
thingtype DRExtraMobj57 : DREmptyMobj, -1, 208 {}
thingtype DRExtraMobj58 : DREmptyMobj, -1, 209 {}
thingtype DRExtraMobj59 : DREmptyMobj, -1, 210 {}
thingtype DRExtraMobj60 : DREmptyMobj, -1, 211 {}
thingtype DRExtraMobj61 : DREmptyMobj, -1, 212 {}
thingtype DRExtraMobj62 : DREmptyMobj, -1, 213 {}
thingtype DRExtraMobj63 : DREmptyMobj, -1, 214 {}
thingtype DRExtraMobj64 : DREmptyMobj, -1, 215 {}
thingtype DRExtraMobj65 : DREmptyMobj, -1, 216 {}
thingtype DRExtraMobj66 : DREmptyMobj, -1, 217 {}
thingtype DRExtraMobj67 : DREmptyMobj, -1, 218 {}
thingtype DRExtraMobj68 : DREmptyMobj, -1, 219 {}
thingtype DRExtraMobj69 : DREmptyMobj, -1, 220 {}
thingtype DRExtraMobj70 : DREmptyMobj, -1, 221 {}
thingtype DRExtraMobj71 : DREmptyMobj, -1, 222 {}
thingtype DRExtraMobj72 : DREmptyMobj, -1, 223 {}
thingtype DRExtraMobj73 : DREmptyMobj, -1, 224 {}
thingtype DRExtraMobj74 : DREmptyMobj, -1, 225 {}
thingtype DRExtraMobj75 : DREmptyMobj, -1, 226 {}
thingtype DRExtraMobj76 : DREmptyMobj, -1, 227 {}
thingtype DRExtraMobj77 : DREmptyMobj, -1, 228 {}
thingtype DRExtraMobj78 : DREmptyMobj, -1, 229 {}
thingtype DRExtraMobj79 : DREmptyMobj, -1, 230 {}
thingtype DRExtraMobj80 : DREmptyMobj, -1, 231 {}
thingtype DRExtraMobj81 : DREmptyMobj, -1, 232 {}
thingtype DRExtraMobj82 : DREmptyMobj, -1, 233 {}
thingtype DRExtraMobj83 : DREmptyMobj, -1, 234 {}
thingtype DRExtraMobj84 : DREmptyMobj, -1, 235 {}
thingtype DRExtraMobj85 : DREmptyMobj, -1, 236 {}
thingtype DRExtraMobj86 : DREmptyMobj, -1, 237 {}
thingtype DRExtraMobj87 : DREmptyMobj, -1, 238 {}
thingtype DRExtraMobj88 : DREmptyMobj, -1, 239 {}
thingtype DRExtraMobj89 : DREmptyMobj, -1, 240 {}
thingtype DRExtraMobj90 : DREmptyMobj, -1, 241 {}
thingtype DRExtraMobj91 : DREmptyMobj, -1, 242 {}
thingtype DRExtraMobj92 : DREmptyMobj, -1, 243 {}
thingtype DRExtraMobj93 : DREmptyMobj, -1, 244 {}
thingtype DRExtraMobj94 : DREmptyMobj, -1, 245 {}
thingtype DRExtraMobj95 : DREmptyMobj, -1, 246 {}
thingtype DRExtraMobj96 : DREmptyMobj, -1, 247 {}
thingtype DRExtraMobj97 : DREmptyMobj, -1, 248 {}
thingtype DRExtraMobj98 : DREmptyMobj, -1, 249 {}
thingtype DRExtraMobj99 : DREmptyMobj, -1, 250 {}
| {
"pile_set_name": "Github"
} |
package com.dianrong.common.uniauth.server.synchronous.hr.service;
import com.dianrong.common.uniauth.common.bean.InfoName;
import com.dianrong.common.uniauth.common.bean.dto.HrSynchronousLogDto;
import com.dianrong.common.uniauth.common.bean.dto.PageDto;
import com.dianrong.common.uniauth.common.util.StringUtil;
import com.dianrong.common.uniauth.common.util.SystemUtil;
import com.dianrong.common.uniauth.server.data.entity.HrDept;
import com.dianrong.common.uniauth.server.data.entity.HrJob;
import com.dianrong.common.uniauth.server.data.entity.HrLe;
import com.dianrong.common.uniauth.server.data.entity.HrPerson;
import com.dianrong.common.uniauth.server.data.entity.HrSynchronousLog;
import com.dianrong.common.uniauth.server.data.entity.HrSynchronousLogExample;
import com.dianrong.common.uniauth.server.data.mapper.HrSynchronousLogMapper;
import com.dianrong.common.uniauth.server.exp.AppException;
import com.dianrong.common.uniauth.server.synchronous.exp.AcquireLockFailureException;
import com.dianrong.common.uniauth.server.synchronous.exp.DeleteFTPFileFailureException;
import com.dianrong.common.uniauth.server.synchronous.exp.FileLoadFailureException;
import com.dianrong.common.uniauth.server.synchronous.exp.ForeignKeyCheckFailureException;
import com.dianrong.common.uniauth.server.synchronous.exp.InvalidContentException;
import com.dianrong.common.uniauth.server.synchronous.exp.SFTPServerProcessException;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.DepartmentList;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.HrSynchronousLogResult;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.HrSynchronousLogType;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.JobList;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.LegalEntityList;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.LoadContent;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.PersonList;
import com.dianrong.common.uniauth.server.synchronous.hr.bean.SynchronousFile;
import com.dianrong.common.uniauth.server.synchronous.hr.support.HrDataSynchronousSwitcher;
import com.dianrong.common.uniauth.server.synchronous.hr.support.HrDeptAnalyzer;
import com.dianrong.common.uniauth.server.synchronous.hr.support.HrJobAnalyzer;
import com.dianrong.common.uniauth.server.synchronous.hr.support.HrLeAnalyzer;
import com.dianrong.common.uniauth.server.synchronous.hr.support.HrPersonAnalyzer;
import com.dianrong.common.uniauth.server.synchronous.hr.support.SFTPFileDeleter;
import com.dianrong.common.uniauth.server.synchronous.support.FileContentAnalyzer;
import com.dianrong.common.uniauth.server.synchronous.support.FileLoader;
import com.dianrong.common.uniauth.server.synchronous.support.ProcessLocker;
import com.dianrong.common.uniauth.server.util.BeanConverter;
import com.dianrong.common.uniauth.server.util.ParamCheck;
import com.dianrong.common.uniauth.server.util.UniBundle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
/**
* 处理批量的更新的逻辑.
*/
@Slf4j
@Service
public class Synchronous {
private static final int THREAD_POOL_SIZE = 5;
/**
* 异步线程池.
*/
private static final ExecutorService EXECUTOR_SERVICE = Executors
.newFixedThreadPool(THREAD_POOL_SIZE);
/**
* 文件内容分析器.
*/
private FileContentAnalyzer<DepartmentList> hrDeptAnalyzer = new HrDeptAnalyzer();
private FileContentAnalyzer<JobList> hrJobAnalyzer = new HrJobAnalyzer();
private FileContentAnalyzer<LegalEntityList> hrLeAnalyzer = new HrLeAnalyzer();
private FileContentAnalyzer<PersonList> hrPersonAnalyzer = new HrPersonAnalyzer();
/**
* 获取锁任务.
*/
@Autowired
private ProcessLocker processLocker;
/**
* 加载文件的加载器.
*/
@Resource(name = "fuzzyMatchUCMFileNameLoader")
private FileLoader fileLoader;
/**
* 开关.
*/
@Autowired
private HrDataSynchronousSwitcher switchControl;
/**
* 在过期多少天之后删除.
*/
@Value("#{uniauthConfig['synchronization.hr.delete.expired.days']?:'7'}")
private int deleteAfterExpiredDays = 7;
/**
* 数据库操作service
*/
@Autowired
private SynchronousDb synchronousDb;
/**
* 同步日志记录Mapper.
*/
@Autowired
private HrSynchronousLogMapper hrSynchronousLogMapper;
@Autowired
private SFTPFileDeleter ftpFileDeleter;
/**
* 异步执行同步数据处理逻辑.
*/
public void startSynchronize() {
startSynchronize(false);
}
/**
* 同步数据处理逻辑.
*
* @param asynchronous 是否异步执行.
*/
public void startSynchronize(boolean asynchronous) {
if (!switchControl.isOn()) {
log.info("HR data synchronous switch is off, so just ignore startSynchronize call.");
return;
}
try {
// 获取锁
processLocker.lock();
} catch (AcquireLockFailureException ale) {
log.info("Acquire lock failed, " + ale.getMessage(), ale);
throw new AppException(InfoName.ACQUIRE_LOCK_FAILED,
UniBundle.getMsg("hr.data.synchronous.lock.acquire.failed", ale.getHoldLockServerIp()));
}
if (asynchronous) {
EXECUTOR_SERVICE.submit(new Runnable() {
@Override
public void run() {
synchronousDataProcess();
}
});
} else {
synchronousDataProcess();
}
}
/**
* 同步数据处理方法.
*/
private void synchronousDataProcess() {
// 同步日志对象.
HrSynchronousLog hrSynchronousLog = new HrSynchronousLog();
hrSynchronousLog.setSynchronousStartTime(new Date());
// 同步HR数据
hrSynchronousLog.setSynchronousType(HrSynchronousLogType.SYNCHRONOUS_HR_DATA.toString());
hrSynchronousLog.setComputerIp(SystemUtil.getLocalIp());
try {
// 加载所有的文件内容
LoadContent<String> depContent =
fileLoader.loadFileContent(SynchronousFile.DEPT_UA.getName());
DepartmentList departmentList = hrDeptAnalyzer.analyze(depContent.getContent());
LoadContent<String> jobContent = fileLoader.loadFileContent(SynchronousFile.JOB_UA.getName());
JobList jobList = hrJobAnalyzer.analyze(jobContent.getContent());
LoadContent<String> leContent = fileLoader.loadFileContent(SynchronousFile.LE_UA.getName());
LegalEntityList legalEntityList = hrLeAnalyzer.analyze(leContent.getContent());
LoadContent<String> personContent =
fileLoader.loadFileContent(SynchronousFile.PERSON_UA.getName());
PersonList personList = hrPersonAnalyzer.analyze(personContent.getContent());
hrSynchronousLog.setProcessContent(StringUtil.subStrIfNeed(Arrays
.asList(depContent.getSourceName(), jobContent.getSourceName(), leContent.getSourceName(),
personContent.getSourceName()).toString(), 200));
// 外键约束检测
foreignKeyCheck(departmentList, jobList, legalEntityList, personList);
// 数据库操作
synchronousDb.dbProcess(departmentList, jobList, legalEntityList, personList);
// 同步成功
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.SUCCESS.toString());
} catch (FileLoadFailureException | SFTPServerProcessException flfe) {
// 加载FTP文件失败
log.error("Synchronous HR system data failed, load ftp file failed.", flfe);
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.FAILURE.toString());
hrSynchronousLog.setFailureMsg(flfe.getMessage());
throw new AppException(InfoName.INTERNAL_ERROR, flfe.getMessage());
} catch (InvalidContentException fkfe) {
// 解析文件内容失败
log.error("Synchronous HR system data failed, ftp file content is invalid.", fkfe);
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.FAILURE.toString());
hrSynchronousLog.setFailureMsg(fkfe.getMessage());
throw new AppException(InfoName.INTERNAL_ERROR, fkfe.getMessage());
} catch (ForeignKeyCheckFailureException fkfe) {
// 外键Check失败
log.error("Synchronous HR system data failed, foreign key check failure.", fkfe);
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.FAILURE.toString());
hrSynchronousLog.setFailureMsg(fkfe.getMessage());
throw new AppException(InfoName.INTERNAL_ERROR, fkfe.getMessage());
} catch (Exception e) {
// 其他异常
log.error("Synchronous HR system data failed, exception occured.", e);
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.FAILURE.toString());
String expInfo = StringUtil.subStrIfNeed(ExceptionUtils.getStackTrace(e), 2000);
hrSynchronousLog.setFailureMsg(expInfo);
throw new AppException(InfoName.INTERNAL_ERROR, expInfo);
} finally {
hrSynchronousLog.setSynchronousEndTime(new Date());
// 插入同步日志
hrSynchronousLogMapper.insert(hrSynchronousLog);
}
}
/**
* 根据条件分页查询同步日志数据.
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param type 日志类型
* @param computerIp 操作服务器的ip
* @param result 同步结果
* @param pageNumber 分页页码
* @param pageSize 分页大小
* @return 查询结果
*/
public PageDto<HrSynchronousLogDto> queryHrSynchronousLog(Date startTime, Date endTime,
String type, String computerIp, String result, Integer pageNumber, Integer pageSize) {
if (pageNumber == null || pageSize == null) {
throw new AppException(InfoName.VALIDATE_FAIL,
UniBundle.getMsg("common.parameter.empty", "pageNumber, pageSize"));
}
HrSynchronousLogExample hrSynchronousLogExample = new HrSynchronousLogExample();
hrSynchronousLogExample.setOrderByClause("create_date desc");
hrSynchronousLogExample.setPageOffSet(pageNumber * pageSize);
hrSynchronousLogExample.setPageSize(pageSize);
HrSynchronousLogExample.Criteria criteria = hrSynchronousLogExample.createCriteria();
if (startTime != null) {
criteria.andSynchronousStartTimeGreaterThanOrEqualTo(startTime);
}
if (endTime != null) {
criteria.andSynchronousEndTimeLessThan(endTime);
}
if (StringUtils.hasText(type)) {
criteria.andSynchronousTypeEqualTo(type);
}
if (StringUtils.hasText(computerIp)) {
criteria.andComputerIpLike("%" + computerIp + "%");
}
if (StringUtils.hasText(result)) {
criteria.andSynchronousResultEqualTo(result);
}
int count = hrSynchronousLogMapper.countByExample(hrSynchronousLogExample);
ParamCheck.checkPageParams(pageNumber, pageSize, count);
List<HrSynchronousLog> hrSynchronousLogs =
hrSynchronousLogMapper.selectByExample(hrSynchronousLogExample);
if (hrSynchronousLogs == null) {
return null;
}
List<HrSynchronousLogDto> hrSynchronousLogDtos = new ArrayList<>(hrSynchronousLogs.size());
for (HrSynchronousLog hrSynchronousLog : hrSynchronousLogs) {
hrSynchronousLogDtos.add(BeanConverter.convert(hrSynchronousLog));
}
return new PageDto<>(pageNumber, pageSize, count, hrSynchronousLogDtos);
}
/**
* 删除过期的FTP同步文件.
*/
public void deleteExpiredFtpFile() {
deleteExpiredFtpFile(false);
}
/**
* 删除过期的FTP同步文件.
*/
public void deleteExpiredFtpFile(boolean asynchronous) {
// if (!switchControl.isOn()) {
// 关闭删除文件的处理.
if (true) {
log.info("HR data synchronous switch is off, so just ignore delete expired FTP file call.");
return;
}
try {
// 获取锁
processLocker.lock();
} catch (AcquireLockFailureException ale) {
log.info("Acquire lock failed, " + ale.getMessage(), ale);
throw new AppException(InfoName.ACQUIRE_LOCK_FAILED,
UniBundle.getMsg("hr.data.synchronous.lock.acquire.failed", ale.getHoldLockServerIp()));
}
if (asynchronous) {
EXECUTOR_SERVICE.submit(new Runnable() {
@Override
public void run() {
deleteExpiredFileProcess();
}
});
} else {
deleteExpiredFileProcess();
}
}
/**
* 删除过期文件的实际执行逻辑.
*/
private void deleteExpiredFileProcess() {
// 同步日志对象.
HrSynchronousLog hrSynchronousLog = new HrSynchronousLog();
hrSynchronousLog.setSynchronousStartTime(new Date());
// 同步HR数据
hrSynchronousLog.setSynchronousType(HrSynchronousLogType.DELETE_FTP_HR_EXPIRED_DATA.toString());
hrSynchronousLog.setComputerIp(SystemUtil.getLocalIp());
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_YEAR, -deleteAfterExpiredDays);
try {
List<String> successDeleteFileNames =
ftpFileDeleter.deleteFtpFileByExpiredTime(calendar.getTime());
// 删除成功
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.SUCCESS.toString());
hrSynchronousLog
.setProcessContent(StringUtil.subStrIfNeed(successDeleteFileNames.toString(), 200));
} catch (DeleteFTPFileFailureException dfe) {
log.debug("Failed delete files update time before:" + calendar.getTime(), dfe);
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.FAILURE.toString());
hrSynchronousLog.setProcessContent(dfe.getDeleteSuccessFileNames().toString());
hrSynchronousLog.setFailureMsg(dfe.getMessage());
throw new AppException(InfoName.INTERNAL_ERROR, dfe.getMessage());
} catch (Exception e) {
log.debug("Failed delete files update time before:" + calendar.getTime(), e);
hrSynchronousLog.setSynchronousResult(HrSynchronousLogResult.FAILURE.toString());
String expInfo = ExceptionUtils.getStackTrace(e);
hrSynchronousLog.setFailureMsg(expInfo);
throw new AppException(InfoName.INTERNAL_ERROR, expInfo);
} finally {
hrSynchronousLog.setSynchronousEndTime(new Date());
// 插入同步日志
hrSynchronousLogMapper.insert(hrSynchronousLog);
}
}
/**
* 根据传入的内容,进行外键分析检测.
*
* @param departmentList 部门信息列表.
* @param jobList 职位信息列表.
* @param legalEntityList 法律实体信息列表.
* @param personList 员工信息列表.
* @throws ForeignKeyCheckFailureException 外键检测不过.
*/
private void foreignKeyCheck(DepartmentList departmentList, JobList jobList,
LegalEntityList legalEntityList, PersonList personList)
throws ForeignKeyCheckFailureException {
// 收集外键id集合
Set<Long> leIds = new HashSet<>(legalEntityList.content().size());
Set<Long> jobIds = new HashSet<>(jobList.content().size());
Set<Long> deptIds = new HashSet<>(departmentList.content().size());
Set<Long> personIds = new HashSet<>(personList.content().size());
for (HrLe hrLe : legalEntityList.content()) {
leIds.add(hrLe.getCompanyId());
}
for (HrJob hrJob : jobList.content()) {
jobIds.add(hrJob.getJobId());
}
for (HrDept hrDept : departmentList.content()) {
deptIds.add(hrDept.getDepartmentId());
}
for (HrPerson hrPerson : personList.content()) {
personIds.add(hrPerson.getPersonId());
}
// Check hr_dept表的外键
/*
* 1 parent_dept_id 需要是deptId.
* 2 manager_id 需要是personId.
* */
for (HrDept hrDept : departmentList.content()) {
// 父部门id check.
Long deptId = hrDept.getParentsDeptId();
if (deptId != null && !deptIds.contains(deptId)) {
throwForeignKeyCheckFailureException(departmentList.synchronousFile().getTableName(),
"parentsDeptId", deptId, departmentList.synchronousFile().getTableName(),
"departmentId");
}
// 部门manager id check.
Long managerId = hrDept.getManagerId();
if (managerId != null && !personIds.contains(managerId)) {
throwForeignKeyCheckFailureException(departmentList.synchronousFile().getTableName(),
"managerId", managerId, personList.synchronousFile().getTableName(), "personId");
}
}
// Check hr_person表的外键
/*
* 1 department_id 需要是deptId.
* 2 job_id 需要是jobId.
* 3 manager_id 需要是personId.
* 4 legal_entities_id 需要是leId.
* */
for (HrPerson hrPerson : personList.content()) {
// buId check.
Long buId = hrPerson.getBuId();
if (buId != null && !deptIds.contains(buId)) {
throwForeignKeyCheckFailureException(personList.synchronousFile().getTableName(),
"buId", buId, departmentList.synchronousFile().getTableName(),
"departmentId");
}
// 部门id check.
Long deptId = hrPerson.getDepartmentId();
if (deptId != null && !deptIds.contains(deptId)) {
throwForeignKeyCheckFailureException(personList.synchronousFile().getTableName(),
"departmentId", deptId, departmentList.synchronousFile().getTableName(),
"departmentId");
}
// 职位id check.
Long jobId = hrPerson.getJobId();
if (jobId != null && !jobIds.contains(jobId)) {
throwForeignKeyCheckFailureException(personList.synchronousFile().getTableName(), "jobId",
jobId, jobList.synchronousFile().getTableName(), "jobId");
}
// 部门manager id check.
Long managerId = hrPerson.getManagerId();
if (managerId != null && !personIds.contains(managerId)) {
throwForeignKeyCheckFailureException(personList.synchronousFile().getTableName(),
"managerId", managerId, personList.synchronousFile().getTableName(), "personId");
}
// companyId check.
Long companyId = hrPerson.getCompanyId();
if (companyId != null && !leIds.contains(companyId)) {
throwForeignKeyCheckFailureException(personList.synchronousFile().getTableName(),
"companyId", companyId, legalEntityList.synchronousFile().getTableName(), "companyId");
}
}
}
/**
* 外键检测错误,抛出异常.
*/
private void throwForeignKeyCheckFailureException(String checkedTableName,
String checkedFieldName, Object checkedFieldVal, String linkedTableName,
String linkedFieldName) {
StringBuilder msg = new StringBuilder();
msg.append("Check foreign key failure.");
msg.append("The checked table name:").append(checkedTableName).append(",");
msg.append("The checked field name:").append(checkedFieldName).append(",");
msg.append("The checked field value:").append(checkedFieldVal).append(",");
msg.append("The foreign linked table name:").append(linkedTableName).append(".");
msg.append("The foreign linked field name:").append(linkedFieldName).append(".");
ForeignKeyCheckFailureException fkc = new ForeignKeyCheckFailureException(msg.toString());
fkc.setCheckedTableName(checkedTableName);
fkc.setCheckedFieldName(checkedFieldName);
fkc.setCheckedFieldVal(checkedFieldVal);
fkc.setLinkedTableName(linkedTableName);
fkc.setLinkedFieldName(linkedFieldName);
throw fkc;
}
}
| {
"pile_set_name": "Github"
} |
<?php
class Excellence_Custom_Block_Custom_Order extends Mage_Core_Block_Template{
public function getCustomVars(){
$model = Mage::getModel('custom/custom_order');
return $model->getByOrder($this->getOrder()->getId());
}
public function getOrder()
{
return Mage::registry('current_order');
}
} | {
"pile_set_name": "Github"
} |
name = "disable";
group = "breakpoints";
shortDescription = "Disable breakpoint(s)";
longDescription = "disable <breakpoint-id> : Disables the breakpoint with the given id.";
seeAlso = [ "enable", "delete", "ignore" ];
function execute() {
if (arguments.length == 0) {
// disable all breakpoints
state = 1;
scheduleGetBreakpoints();
} else {
var id = parseInt(arguments[0]);
if (isNaN(id)) {
message("Breakpoint id expected.");
return;
}
scheduleGetBreakpointData(id);
breakpointId = id;
state = 3;
}
};
function handleResponse(resp) {
if (state == 1) {
var breakpoints = resp.result;
if (breakpoints == undefined)
return;
for (var id in breakpoints) {
var data = breakpoints[id];
if (data.enabled) {
data.enabled = false;
scheduleSetBreakpointData(id, data);
}
}
state = 2;
} else if (state == 2) {
state = 0;
} else if (state == 3) {
var data = resp.result;
if (data == undefined) {
message("No breakpoint number " + breakpointId + ".");
return;
} else if (data.enabled) {
data.enabled = false;
scheduleSetBreakpointData(breakpointId, data);
state = 4;
}
} else if (state == 4) {
state = 0;
}
}
| {
"pile_set_name": "Github"
} |
const normalize = require('./normalize')
const dot = require('./dot')
/**
* Get the angle between two 3D vectors
* @param {vec3} a - the first operand
* @param {vec3} b - the second operand
* @returns {Number} the angle in radians
*/
const angle = (a, b) => {
const tempA = normalize(a)
const tempB = normalize(b)
const cosine = dot(tempA, tempB)
return cosine > 1.0 ? 0 : Math.acos(cosine)
}
module.exports = angle
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2018.
~
~ This file is part of MoneyWallet.
~
~ MoneyWallet 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.
~
~ MoneyWallet 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 MoneyWallet. If not, see <http://www.gnu.org/licenses/>.
-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tool="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/view_header_height" >
<com.oriondev.moneywallet.ui.view.theme.ThemedTextView
android:id="@+id/total_sum_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/view_header_text_margin"
android:layout_marginLeft="@dimen/view_header_text_margin"
android:layout_marginEnd="@dimen/view_header_text_margin"
android:layout_marginRight="@dimen/view_header_text_margin"
android:text="@string/hint_total_sum"
app:theme_textColor="textOverColorPrimary"/>
<com.oriondev.moneywallet.ui.view.theme.ThemedHorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:overScrollMode="never"
android:scrollbars="none"
android:layout_toRightOf="@id/total_sum_text_view"
android:layout_toEndOf="@id/total_sum_text_view" >
<com.oriondev.moneywallet.ui.view.theme.ThemedTextView
android:id="@+id/total_money_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollHorizontally="true"
android:paddingStart="@dimen/view_header_text_margin"
android:paddingLeft="@dimen/view_header_text_margin"
android:paddingEnd="@dimen/view_header_text_margin"
android:paddingRight="@dimen/view_header_text_margin"
android:layout_gravity="end|center_vertical"
app:theme_textColor="textOverColorPrimary"
tool:text="$ 450.99 - £ 50.45"/>
</com.oriondev.moneywallet.ui.view.theme.ThemedHorizontalScrollView>
</RelativeLayout> | {
"pile_set_name": "Github"
} |
{\rtf1\ansi\ansicpg1252\cocoartf1334
{\fonttbl}
{\colortbl;\red255\green255\blue255;}
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>ExpansionFulfillmentStyle Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/ExpansionFulfillmentStyle" class="dashAnchor"></a>
<a title="ExpansionFulfillmentStyle Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html">SwipeCellKit Docs</a> (100% documented)</p>
<p class="header-right"><a href="https://github.com/SwipeCellKit/SwipeCellKit"><img src="../img/gh.png"/>View on GitHub</a></p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html">SwipeCellKit Reference</a>
<img id="carat" src="../img/carat.png" />
ExpansionFulfillmentStyle Enumeration Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Guides.html">Guides</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../advanced.html">Advanced</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/SwipeAction.html">SwipeAction</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SwipeCollectionViewCell.html">SwipeCollectionViewCell</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SwipeTableViewCell.html">SwipeTableViewCell</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/ExpansionFulfillmentStyle.html">ExpansionFulfillmentStyle</a>
</li>
<li class="nav-group-task">
<a href="../Enums/SwipeActionStyle.html">SwipeActionStyle</a>
</li>
<li class="nav-group-task">
<a href="../Enums/SwipeActionsOrientation.html">SwipeActionsOrientation</a>
</li>
<li class="nav-group-task">
<a href="../Enums/SwipeTransitionStyle.html">SwipeTransitionStyle</a>
</li>
<li class="nav-group-task">
<a href="../Enums/SwipeVerticalAlignment.html">SwipeVerticalAlignment</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/SwipeActionTransitioning.html">SwipeActionTransitioning</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/SwipeCollectionViewCellDelegate.html">SwipeCollectionViewCellDelegate</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/SwipeExpanding.html">SwipeExpanding</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/SwipeTableViewCellDelegate.html">SwipeTableViewCellDelegate</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ScaleAndAlphaExpansion.html">ScaleAndAlphaExpansion</a>
</li>
<li class="nav-group-task">
<a href="../Structs/ScaleTransition.html">ScaleTransition</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeActionTransitioningContext.html">SwipeActionTransitioningContext</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeExpansionAnimationTimingParameters.html">SwipeExpansionAnimationTimingParameters</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeExpansionStyle.html">SwipeExpansionStyle</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeExpansionStyle/Target.html">– Target</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeExpansionStyle/Trigger.html">– Trigger</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeExpansionStyle/CompletionAnimation.html">– CompletionAnimation</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeExpansionStyle/FillOptions.html">– FillOptions</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SwipeOptions.html">SwipeOptions</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>ExpansionFulfillmentStyle</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">ExpansionFulfillmentStyle</span></code></pre>
</div>
</div>
<p>Describes how expansion should be resolved once the action has been fulfilled.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:12SwipeCellKit25ExpansionFulfillmentStyleO6deleteA2CmF"></a>
<a name="//apple_ref/swift/Element/delete" class="dashAnchor"></a>
<a class="token" href="#/s:12SwipeCellKit25ExpansionFulfillmentStyleO6deleteA2CmF">delete</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Implies the item will be deleted upon action fulfillment.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">delete</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:12SwipeCellKit25ExpansionFulfillmentStyleO5resetA2CmF"></a>
<a name="//apple_ref/swift/Element/reset" class="dashAnchor"></a>
<a class="token" href="#/s:12SwipeCellKit25ExpansionFulfillmentStyleO5resetA2CmF">reset</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Implies the item will be reset and the actions view hidden upon action fulfillment.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="k">case</span> <span class="n">reset</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>© 2018 <a class="link" href="https://twitter.com/mkurabi" target="_blank" rel="external">Mohammad Kurabi</a>. All rights reserved. (Last updated: 2018-05-26)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.8.4</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
| {
"pile_set_name": "Github"
} |
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
| Middleware options can be located in `app/Http/Kernel.php`
|
*/
// Homepage Route
//Route::get('/', 'WelcomeController@welcome')->name('welcome');
// Authentication Routes
Auth::routes();
// Public Resource Route
Route::get('material.min.css.template', 'ThemesManagementController@template');
// Public Routes
Route::group(['middleware' => 'web'], function () {
// Activation Routes
Route::get('/activate', ['as' => 'activate', 'uses' => 'Auth\ActivateController@initial']);
Route::get('/activate/{token}', ['as' => 'authenticated.activate', 'uses' => 'Auth\ActivateController@activate']);
Route::get('/activation', ['as' => 'authenticated.activation-resend', 'uses' => 'Auth\ActivateController@resend']);
Route::get('/exceeded', ['as' => 'exceeded', 'uses' => 'Auth\ActivateController@exceeded']);
// Socialite Register Routes
Route::get('/social/redirect/{provider}', ['as' => 'social.redirect', 'uses' => 'Auth\SocialController@getSocialRedirect']);
Route::get('/social/handle/{provider}', ['as' => 'social.handle', 'uses' => 'Auth\SocialController@getSocialHandle']);
// Route to for user to reactivate their user deleted account.
Route::get('/re-activate/{token}', ['as' => 'user.reactivate', 'uses' => 'RestoreUserController@userReActivate']);
});
// Registered and Activated User Routes
Route::group(['middleware' => ['auth', 'activated']], function () {
// Homepage Route
Route::get('/', ['as' => 'public.home', 'uses' => 'UserController@index']);
// Activation Routes
Route::get('/activation-required', ['uses' => 'Auth\ActivateController@activationRequired'])->name('activation-required');
Route::get('/logout', ['uses' => 'Auth\LoginController@logout'])->name('logout');
// Homepage Route - Redirect based on user role is in controller.
Route::get('/home', ['as' => 'public.home', 'uses' => 'UserController@index']);
// Show users profile - viewable by other users.
Route::get('profile/{username}', [
'as' => '{username}',
'uses' => 'ProfilesController@show',
]);
// Route to show user avatar
Route::get('images/profile/{id}/avatar/{image}', [
'uses' => 'ProfilesController@userProfileAvatar',
]);
// Route for user profile background image
Route::get('images/profile/{id}/background/{image}', [
'uses' => 'ProfilesController@userProfileBackgroundImage',
]);
});
// Registered, activated, and is current user routes.
Route::group(['middleware' => ['auth', 'activated', 'currentUser']], function () {
// User Profile and Account Routes
Route::resource(
'profile',
'ProfilesController', [
'only' => [
'account',
'show',
'edit',
'update',
'create',
],
]
);
Route::put('profile/{username}/updateUserAccount', [
'as' => '{username}',
'uses' => 'ProfilesController@updateUserAccount',
]);
Route::put('profile/{username}/updateUserPassword', [
'as' => '{username}',
'uses' => 'ProfilesController@updateUserPassword',
]);
Route::delete('profile/{username}/deleteUserAccount', [
'as' => '{username}',
'uses' => 'ProfilesController@deleteUserAccount',
]);
// Route for user profile background image
Route::get('account', [
'as' => '{username}',
'uses' => 'ProfilesController@account',
]);
// Update User Profile Ajax Route
Route::post('profile/{username}/updateAjax', [
'as' => '{username}',
'uses' => 'ProfilesController@update',
]);
// Route to upload user avatar.
Route::post('avatar/upload', ['as' => 'avatar.upload', 'uses' => 'ProfilesController@upload']);
// Route to uplaod user background image
Route::post('background/upload', ['as' => 'background.upload', 'uses' => 'ProfilesController@uploadBackground']);
// User Tasks Routes
Route::resource('/tasks', 'TasksController');
});
// Registered, activated, and is admin routes.
Route::group(['middleware' => ['auth', 'activated', 'role:admin']], function () {
Route::resource('/users/deleted', 'SoftDeletesController', [
'only' => [
'index', 'show', 'update', 'destroy',
],
]);
Route::resource('users', 'UsersManagementController', [
'names' => [
'index' => 'users',
'create' => 'create',
'destroy' => 'user.destroy',
],
'except' => [
'deleted',
],
]);
Route::resource('themes', 'ThemesManagementController', [
'names' => [
'index' => 'themes',
'destroy' => 'themes.destroy',
],
]);
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');
Route::get('php', 'AdminDetailsController@listPHPInfo');
Route::get('routes', 'AdminDetailsController@listRoutes');
});
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `type_id` fn in crate `std`.">
<meta name="keywords" content="rust, rustlang, rust-lang, type_id">
<title>std::intrinsics::type_id - Rust</title>
<link rel="stylesheet" type="text/css" href="../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../main.css">
<link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<a href='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a>
<p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>intrinsics</a></p><script>window.sidebarCurrent = {name: 'type_id', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content fn">
<h1 class='fqn'><span class='in-band'>Function <a href='../index.html'>std</a>::<wbr><a href='index.html'>intrinsics</a>::<wbr><a class='fn' href=''>type_id</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-4815' class='srclink' href='../../core/intrinsics/fn.type_id.html?gotosrc=4815' title='goto source code'>[src]</a></span></h1>
<pre class='rust fn'>pub unsafe extern "rust-intrinsic" fn type_id<T>() -> <a class='primitive' href='../primitive.u64.html'>u64</a> <span class='where'>where T: 'static + ?<a class='trait' href='../../std/marker/trait.Sized.html' title='std::marker::Sized'>Sized</a></span></pre><div class='stability'><em class='stab unstable'>Unstable (<code>core_intrinsics</code> <a href="https://github.com/rust-lang/rust/issues/0">#0</a>)<p>: intrinsics are unlikely to ever be stabilized, instead they should be used through stabilized interfaces in the rest of the standard library</p>
</em></div><div class='docblock'><p>Gets an identifier which is globally unique to the specified type. This
function will return the same value for a type regardless of whichever
crate it is invoked in.</p>
</div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "std";
window.playgroundUrl = "https://play.rust-lang.org/";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script src="../../playpen.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html> | {
"pile_set_name": "Github"
} |
/**
* @file path路径相关的工具集
* @author houyu([email protected])
*/
export const pathResolver = (originPath, path, errorCb) => {
const segs = (originPath + '/' + path).split('/');
return segs.reduce((resStack, seg) => {
if (seg !== '' && seg !== '.') {
if (seg === '..') {
if (resStack.length === 0) {
errorCb && errorCb();
}
resStack.pop();
}
else {
resStack.push(seg);
}
}
return resStack;
}, []);
};
/**
* 在app工程里面的路径,需要替换path为绝对路径
*
* @param {string} basePath - 计算绝对路径时使用的基础路径
* @param {string} pagePath - 计算绝对路径时使用的页面级路径
* @param {string} path - 相对小程序的路径,会被变成绝对路径
* @return {string} 计算出的文件的绝对路径
*/
export const absolutePathResolver = (basePath, pagePath, path) => {
const httpRegExp = /^https?:\/\//;
// 远程地址无需转换
if (httpRegExp.test(path)) {
return path;
}
// 绝对路径的话,不用page路径
const pageRoute = /^\//.test(path) ? '' : pagePath.replace(/[^\/]*$/g, '');
let prefixPath = '/';
basePath = basePath.replace(httpRegExp, function (...args) {
prefixPath = args[0];
return '';
});
return prefixPath + pathResolver(`${basePath}/${pageRoute}`, path).join('/');
};
| {
"pile_set_name": "Github"
} |
/*!
* jQuery Validation Plugin v1.14.0
*
* http://jqueryvalidation.org/
*
* Copyright (c) 2015 Jörn Zaefferer
* Released under the MIT license
*/
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
define( ["jquery", "./jquery.validate"], factory );
} else {
factory( jQuery );
}
}(function( $ ) {
(function() {
function stripHtml(value) {
// remove html tags and space chars
return value.replace(/<.[^<>]*?>/g, " ").replace(/ | /gi, " ")
// remove punctuation
.replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "");
}
$.validator.addMethod("maxWords", function(value, element, params) {
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length <= params;
}, $.validator.format("Please enter {0} words or less."));
$.validator.addMethod("minWords", function(value, element, params) {
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
}, $.validator.format("Please enter at least {0} words."));
$.validator.addMethod("rangeWords", function(value, element, params) {
var valueStripped = stripHtml(value),
regex = /\b\w+\b/g;
return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
}, $.validator.format("Please enter between {0} and {1} words."));
}());
// Accept a value from a file input based on a required mimetype
$.validator.addMethod("accept", function(value, element, param) {
// Split mime on commas in case we have multiple types we can accept
var typeParam = typeof param === "string" ? param.replace(/\s/g, "").replace(/,/g, "|") : "image/*",
optionalValue = this.optional(element),
i, file;
// Element is optional
if (optionalValue) {
return optionalValue;
}
if ($(element).attr("type") === "file") {
// If we are using a wildcard, make it regex friendly
typeParam = typeParam.replace(/\*/g, ".*");
// Check if the element has a FileList before checking each file
if (element.files && element.files.length) {
for (i = 0; i < element.files.length; i++) {
file = element.files[i];
// Grab the mimetype from the loaded file, verify it matches
if (!file.type.match(new RegExp( "\\.?(" + typeParam + ")$", "i"))) {
return false;
}
}
}
}
// Either return true because we've validated each file, or because the
// browser does not support element.files and the FileList feature
return true;
}, $.validator.format("Please enter a value with a valid mimetype."));
$.validator.addMethod("alphanumeric", function(value, element) {
return this.optional(element) || /^\w+$/i.test(value);
}, "Letters, numbers, and underscores only please");
/*
* Dutch bank account numbers (not 'giro' numbers) have 9 digits
* and pass the '11 check'.
* We accept the notation with spaces, as that is common.
* acceptable: 123456789 or 12 34 56 789
*/
$.validator.addMethod("bankaccountNL", function(value, element) {
if (this.optional(element)) {
return true;
}
if (!(/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(value))) {
return false;
}
// now '11 check'
var account = value.replace(/ /g, ""), // remove spaces
sum = 0,
len = account.length,
pos, factor, digit;
for ( pos = 0; pos < len; pos++ ) {
factor = len - pos;
digit = account.substring(pos, pos + 1);
sum = sum + factor * digit;
}
return sum % 11 === 0;
}, "Please specify a valid bank account number");
$.validator.addMethod("bankorgiroaccountNL", function(value, element) {
return this.optional(element) ||
($.validator.methods.bankaccountNL.call(this, value, element)) ||
($.validator.methods.giroaccountNL.call(this, value, element));
}, "Please specify a valid bank or giro account number");
/**
* BIC is the business identifier code (ISO 9362). This BIC check is not a guarantee for authenticity.
*
* BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional)
*
* BIC definition in detail:
* - First 4 characters - bank code (only letters)
* - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters)
* - Next 2 characters - location code (letters and digits)
* a. shall not start with '0' or '1'
* b. second character must be a letter ('O' is not allowed) or one of the following digits ('0' for test (therefore not allowed), '1' for passive participant and '2' for active participant)
* - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits)
*/
$.validator.addMethod("bic", function(value, element) {
return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value );
}, "Please specify a valid BIC code");
/*
* Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities
* Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
*/
$.validator.addMethod( "cifES", function( value ) {
"use strict";
var num = [],
controlDigit, sum, i, count, tmp, secondDigit;
value = value.toUpperCase();
// Quick format test
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) {
return false;
}
for ( i = 0; i < 9; i++ ) {
num[ i ] = parseInt( value.charAt( i ), 10 );
}
// Algorithm for checking CIF codes
sum = num[ 2 ] + num[ 4 ] + num[ 6 ];
for ( count = 1; count < 8; count += 2 ) {
tmp = ( 2 * num[ count ] ).toString();
secondDigit = tmp.charAt( 1 );
sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) );
}
/* The first (position 1) is a letter following the following criteria:
* A. Corporations
* B. LLCs
* C. General partnerships
* D. Companies limited partnerships
* E. Communities of goods
* F. Cooperative Societies
* G. Associations
* H. Communities of homeowners in horizontal property regime
* J. Civil Societies
* K. Old format
* L. Old format
* M. Old format
* N. Nonresident entities
* P. Local authorities
* Q. Autonomous bodies, state or not, and the like, and congregations and religious institutions
* R. Congregations and religious institutions (since 2008 ORDER EHA/451/2008)
* S. Organs of State Administration and regions
* V. Agrarian Transformation
* W. Permanent establishments of non-resident in Spain
*/
if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) {
sum += "";
controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 );
value += controlDigit;
return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) );
}
return false;
}, "Please specify a valid CIF number." );
/*
* Brazillian CPF number (Cadastrado de Pessoas Físicas) is the equivalent of a Brazilian tax registration number.
* CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation.
*/
$.validator.addMethod("cpfBR", function(value) {
// Removing special characters from value
value = value.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "");
// Checking value to have 11 digits only
if (value.length !== 11) {
return false;
}
var sum = 0,
firstCN, secondCN, checkResult, i;
firstCN = parseInt(value.substring(9, 10), 10);
secondCN = parseInt(value.substring(10, 11), 10);
checkResult = function(sum, cn) {
var result = (sum * 10) % 11;
if ((result === 10) || (result === 11)) {result = 0;}
return (result === cn);
};
// Checking for dump data
if (value === "" ||
value === "00000000000" ||
value === "11111111111" ||
value === "22222222222" ||
value === "33333333333" ||
value === "44444444444" ||
value === "57776577765" ||
value === "66666666666" ||
value === "77777777777" ||
value === "88888888888" ||
value === "99999999999"
) {
return false;
}
// Step 1 - using first Check Number:
for ( i = 1; i <= 9; i++ ) {
sum = sum + parseInt(value.substring(i - 1, i), 10) * (11 - i);
}
// If first Check Number (CN) is valid, move to Step 2 - using second Check Number:
if ( checkResult(sum, firstCN) ) {
sum = 0;
for ( i = 1; i <= 10; i++ ) {
sum = sum + parseInt(value.substring(i - 1, i), 10) * (12 - i);
}
return checkResult(sum, secondCN);
}
return false;
}, "Please specify a valid CPF number");
/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
* Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
* Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
*/
$.validator.addMethod("creditcardtypes", function(value, element, param) {
if (/[^0-9\-]+/.test(value)) {
return false;
}
value = value.replace(/\D/g, "");
var validTypes = 0x0000;
if (param.mastercard) {
validTypes |= 0x0001;
}
if (param.visa) {
validTypes |= 0x0002;
}
if (param.amex) {
validTypes |= 0x0004;
}
if (param.dinersclub) {
validTypes |= 0x0008;
}
if (param.enroute) {
validTypes |= 0x0010;
}
if (param.discover) {
validTypes |= 0x0020;
}
if (param.jcb) {
validTypes |= 0x0040;
}
if (param.unknown) {
validTypes |= 0x0080;
}
if (param.all) {
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
}
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard
return value.length === 16;
}
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
return value.length === 16;
}
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex
return value.length === 15;
}
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub
return value.length === 14;
}
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute
return value.length === 15;
}
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
return value.length === 16;
}
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
return value.length === 16;
}
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
return value.length === 15;
}
if (validTypes & 0x0080) { //unknown
return true;
}
return false;
}, "Please enter a valid credit card number.");
/**
* Validates currencies with any given symbols by @jameslouiz
* Symbols can be optional or required. Symbols required by default
*
* Usage examples:
* currency: ["£", false] - Use false for soft currency validation
* currency: ["$", false]
* currency: ["RM", false] - also works with text based symbols such as "RM" - Malaysia Ringgit etc
*
* <input class="currencyInput" name="currencyInput">
*
* Soft symbol checking
* currencyInput: {
* currency: ["$", false]
* }
*
* Strict symbol checking (default)
* currencyInput: {
* currency: "$"
* //OR
* currency: ["$", true]
* }
*
* Multiple Symbols
* currencyInput: {
* currency: "$,£,¢"
* }
*/
$.validator.addMethod("currency", function(value, element, param) {
var isParamString = typeof param === "string",
symbol = isParamString ? param : param[0],
soft = isParamString ? true : param[1],
regex;
symbol = symbol.replace(/,/g, "");
symbol = soft ? symbol + "]" : symbol + "]?";
regex = "^[" + symbol + "([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$";
regex = new RegExp(regex);
return this.optional(element) || regex.test(value);
}, "Please specify a valid currency");
$.validator.addMethod("dateFA", function(value, element) {
return this.optional(element) || /^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(value);
}, $.validator.messages.date);
/**
* Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
*
* @example $.validator.methods.date("01/01/1900")
* @result true
*
* @example $.validator.methods.date("01/13/1990")
* @result false
*
* @example $.validator.methods.date("01.01.1900")
* @result false
*
* @example <input name="pippo" class="{dateITA:true}" />
* @desc Declares an optional input element whose value must be a valid date.
*
* @name $.validator.methods.dateITA
* @type Boolean
* @cat Plugins/Validate/Methods
*/
$.validator.addMethod("dateITA", function(value, element) {
var check = false,
re = /^\d{1,2}\/\d{1,2}\/\d{4}$/,
adata, gg, mm, aaaa, xdata;
if ( re.test(value)) {
adata = value.split("/");
gg = parseInt(adata[0], 10);
mm = parseInt(adata[1], 10);
aaaa = parseInt(adata[2], 10);
xdata = new Date(Date.UTC(aaaa, mm - 1, gg, 12, 0, 0, 0));
if ( ( xdata.getUTCFullYear() === aaaa ) && ( xdata.getUTCMonth () === mm - 1 ) && ( xdata.getUTCDate() === gg ) ) {
check = true;
} else {
check = false;
}
} else {
check = false;
}
return this.optional(element) || check;
}, $.validator.messages.date);
$.validator.addMethod("dateNL", function(value, element) {
return this.optional(element) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(value);
}, $.validator.messages.date);
// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept
$.validator.addMethod("extension", function(value, element, param) {
param = typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif";
return this.optional(element) || value.match(new RegExp("\\.(" + param + ")$", "i"));
}, $.validator.format("Please enter a value with a valid extension."));
/**
* Dutch giro account numbers (not bank numbers) have max 7 digits
*/
$.validator.addMethod("giroaccountNL", function(value, element) {
return this.optional(element) || /^[0-9]{1,7}$/.test(value);
}, "Please specify a valid giro account number");
/**
* IBAN is the international bank account number.
* It has a country - specific format, that is checked here too
*/
$.validator.addMethod("iban", function(value, element) {
// some quick simple tests to prevent needless work
if (this.optional(element)) {
return true;
}
// remove spaces and to upper case
var iban = value.replace(/ /g, "").toUpperCase(),
ibancheckdigits = "",
leadingZeroes = true,
cRest = "",
cOperator = "",
countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p;
// check the country code and find the country specific format
countrycode = iban.substring(0, 2);
bbancountrypatterns = {
"AL": "\\d{8}[\\dA-Z]{16}",
"AD": "\\d{8}[\\dA-Z]{12}",
"AT": "\\d{16}",
"AZ": "[\\dA-Z]{4}\\d{20}",
"BE": "\\d{12}",
"BH": "[A-Z]{4}[\\dA-Z]{14}",
"BA": "\\d{16}",
"BR": "\\d{23}[A-Z][\\dA-Z]",
"BG": "[A-Z]{4}\\d{6}[\\dA-Z]{8}",
"CR": "\\d{17}",
"HR": "\\d{17}",
"CY": "\\d{8}[\\dA-Z]{16}",
"CZ": "\\d{20}",
"DK": "\\d{14}",
"DO": "[A-Z]{4}\\d{20}",
"EE": "\\d{16}",
"FO": "\\d{14}",
"FI": "\\d{14}",
"FR": "\\d{10}[\\dA-Z]{11}\\d{2}",
"GE": "[\\dA-Z]{2}\\d{16}",
"DE": "\\d{18}",
"GI": "[A-Z]{4}[\\dA-Z]{15}",
"GR": "\\d{7}[\\dA-Z]{16}",
"GL": "\\d{14}",
"GT": "[\\dA-Z]{4}[\\dA-Z]{20}",
"HU": "\\d{24}",
"IS": "\\d{22}",
"IE": "[\\dA-Z]{4}\\d{14}",
"IL": "\\d{19}",
"IT": "[A-Z]\\d{10}[\\dA-Z]{12}",
"KZ": "\\d{3}[\\dA-Z]{13}",
"KW": "[A-Z]{4}[\\dA-Z]{22}",
"LV": "[A-Z]{4}[\\dA-Z]{13}",
"LB": "\\d{4}[\\dA-Z]{20}",
"LI": "\\d{5}[\\dA-Z]{12}",
"LT": "\\d{16}",
"LU": "\\d{3}[\\dA-Z]{13}",
"MK": "\\d{3}[\\dA-Z]{10}\\d{2}",
"MT": "[A-Z]{4}\\d{5}[\\dA-Z]{18}",
"MR": "\\d{23}",
"MU": "[A-Z]{4}\\d{19}[A-Z]{3}",
"MC": "\\d{10}[\\dA-Z]{11}\\d{2}",
"MD": "[\\dA-Z]{2}\\d{18}",
"ME": "\\d{18}",
"NL": "[A-Z]{4}\\d{10}",
"NO": "\\d{11}",
"PK": "[\\dA-Z]{4}\\d{16}",
"PS": "[\\dA-Z]{4}\\d{21}",
"PL": "\\d{24}",
"PT": "\\d{21}",
"RO": "[A-Z]{4}[\\dA-Z]{16}",
"SM": "[A-Z]\\d{10}[\\dA-Z]{12}",
"SA": "\\d{2}[\\dA-Z]{18}",
"RS": "\\d{18}",
"SK": "\\d{20}",
"SI": "\\d{15}",
"ES": "\\d{20}",
"SE": "\\d{20}",
"CH": "\\d{5}[\\dA-Z]{12}",
"TN": "\\d{20}",
"TR": "\\d{5}[\\dA-Z]{17}",
"AE": "\\d{3}\\d{16}",
"GB": "[A-Z]{4}\\d{14}",
"VG": "[\\dA-Z]{4}\\d{16}"
};
bbanpattern = bbancountrypatterns[countrycode];
// As new countries will start using IBAN in the
// future, we only check if the countrycode is known.
// This prevents false negatives, while almost all
// false positives introduced by this, will be caught
// by the checksum validation below anyway.
// Strict checking should return FALSE for unknown
// countries.
if (typeof bbanpattern !== "undefined") {
ibanregexp = new RegExp("^[A-Z]{2}\\d{2}" + bbanpattern + "$", "");
if (!(ibanregexp.test(iban))) {
return false; // invalid country specific format
}
}
// now check the checksum, first convert to digits
ibancheck = iban.substring(4, iban.length) + iban.substring(0, 4);
for (i = 0; i < ibancheck.length; i++) {
charAt = ibancheck.charAt(i);
if (charAt !== "0") {
leadingZeroes = false;
}
if (!leadingZeroes) {
ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(charAt);
}
}
// calculate the result of: ibancheckdigits % 97
for (p = 0; p < ibancheckdigits.length; p++) {
cChar = ibancheckdigits.charAt(p);
cOperator = "" + cRest + "" + cChar;
cRest = cOperator % 97;
}
return cRest === 1;
}, "Please specify a valid IBAN");
$.validator.addMethod("integer", function(value, element) {
return this.optional(element) || /^-?\d+$/.test(value);
}, "A positive or negative non-decimal number please");
$.validator.addMethod("ipv4", function(value, element) {
return this.optional(element) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(value);
}, "Please enter a valid IP v4 address.");
$.validator.addMethod("ipv6", function(value, element) {
return this.optional(element) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value);
}, "Please enter a valid IP v6 address.");
$.validator.addMethod("lettersonly", function(value, element) {
return this.optional(element) || /^[a-z]+$/i.test(value);
}, "Letters only please");
$.validator.addMethod("letterswithbasicpunc", function(value, element) {
return this.optional(element) || /^[a-z\-.,()'"\s]+$/i.test(value);
}, "Letters or punctuation only please");
$.validator.addMethod("mobileNL", function(value, element) {
return this.optional(element) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(value);
}, "Please specify a valid mobile number");
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
$.validator.addMethod("mobileUK", function(phone_number, element) {
phone_number = phone_number.replace(/\(|\)|\s+|-/g, "");
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/);
}, "Please specify a valid mobile number");
/*
* The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain
*/
$.validator.addMethod( "nieES", function( value ) {
"use strict";
value = value.toUpperCase();
// Basic format test
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) {
return false;
}
// Test NIE
//T
if ( /^[T]{1}/.test( value ) ) {
return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) );
}
//XYZ
if ( /^[XYZ]{1}/.test( value ) ) {
return (
value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt(
value.replace( "X", "0" )
.replace( "Y", "1" )
.replace( "Z", "2" )
.substring( 0, 8 ) % 23
)
);
}
return false;
}, "Please specify a valid NIE number." );
/*
* The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals
*/
$.validator.addMethod( "nifES", function( value ) {
"use strict";
value = value.toUpperCase();
// Basic format test
if ( !value.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)") ) {
return false;
}
// Test NIF
if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) {
return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) );
}
// Test specials NIF (starts with K, L or M)
if ( /^[KLM]{1}/.test( value ) ) {
return ( value[ 8 ] === String.fromCharCode( 64 ) );
}
return false;
}, "Please specify a valid NIF number." );
jQuery.validator.addMethod( "notEqualTo", function( value, element, param ) {
return this.optional(element) || !$.validator.methods.equalTo.call( this, value, element, param );
}, "Please enter a different value, values must not be the same." );
$.validator.addMethod("nowhitespace", function(value, element) {
return this.optional(element) || /^\S+$/i.test(value);
}, "No white space please");
/**
* Return true if the field value matches the given format RegExp
*
* @example $.validator.methods.pattern("AR1004",element,/^AR\d{4}$/)
* @result true
*
* @example $.validator.methods.pattern("BR1004",element,/^AR\d{4}$/)
* @result false
*
* @name $.validator.methods.pattern
* @type Boolean
* @cat Plugins/Validate/Methods
*/
$.validator.addMethod("pattern", function(value, element, param) {
if (this.optional(element)) {
return true;
}
if (typeof param === "string") {
param = new RegExp("^(?:" + param + ")$");
}
return param.test(value);
}, "Invalid format.");
/**
* Dutch phone numbers have 10 digits (or 11 and start with +31).
*/
$.validator.addMethod("phoneNL", function(value, element) {
return this.optional(element) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(value);
}, "Please specify a valid phone number.");
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
$.validator.addMethod("phoneUK", function(phone_number, element) {
phone_number = phone_number.replace(/\(|\)|\s+|-/g, "");
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/);
}, "Please specify a valid phone number");
/**
* matches US phone number format
*
* where the area code may not start with 1 and the prefix may not start with 1
* allows '-' or ' ' as a separator and allows parens around area code
* some people may want to put a '1' in front of their number
*
* 1(212)-999-2345 or
* 212 999 2344 or
* 212-999-0983
*
* but not
* 111-123-5434
* and not
* 212 123 4567
*/
$.validator.addMethod("phoneUS", function(phone_number, element) {
phone_number = phone_number.replace(/\s+/g, "");
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/);
}, "Please specify a valid phone number");
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
$.validator.addMethod("phonesUK", function(phone_number, element) {
phone_number = phone_number.replace(/\(|\)|\s+|-/g, "");
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/);
}, "Please specify a valid uk phone number");
/**
* Matches a valid Canadian Postal Code
*
* @example jQuery.validator.methods.postalCodeCA( "H0H 0H0", element )
* @result true
*
* @example jQuery.validator.methods.postalCodeCA( "H0H0H0", element )
* @result false
*
* @name jQuery.validator.methods.postalCodeCA
* @type Boolean
* @cat Plugins/Validate/Methods
*/
$.validator.addMethod( "postalCodeCA", function( value, element ) {
return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/.test( value );
}, "Please specify a valid postal code" );
/*
* Valida CEPs do brasileiros:
*
* Formatos aceitos:
* 99999-999
* 99.999-999
* 99999999
*/
$.validator.addMethod("postalcodeBR", function(cep_value, element) {
return this.optional(element) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
}, "Informe um CEP válido.");
/* Matches Italian postcode (CAP) */
$.validator.addMethod("postalcodeIT", function(value, element) {
return this.optional(element) || /^\d{5}$/.test(value);
}, "Please specify a valid postal code");
$.validator.addMethod("postalcodeNL", function(value, element) {
return this.optional(element) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(value);
}, "Please specify a valid postal code");
// Matches UK postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
$.validator.addMethod("postcodeUK", function(value, element) {
return this.optional(element) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(value);
}, "Please specify a valid UK postcode");
/*
* Lets you say "at least X inputs that match selector Y must be filled."
*
* The end result is that neither of these inputs:
*
* <input class="productinfo" name="partnumber">
* <input class="productinfo" name="description">
*
* ...will validate unless at least one of them is filled.
*
* partnumber: {require_from_group: [1,".productinfo"]},
* description: {require_from_group: [1,".productinfo"]}
*
* options[0]: number of fields that must be filled in the group
* options[1]: CSS selector that defines the group of conditionally required fields
*/
$.validator.addMethod("require_from_group", function(value, element, options) {
var $fields = $(options[1], element.form),
$fieldsFirst = $fields.eq(0),
validator = $fieldsFirst.data("valid_req_grp") ? $fieldsFirst.data("valid_req_grp") : $.extend({}, this),
isValid = $fields.filter(function() {
return validator.elementValue(this);
}).length >= options[0];
// Store the cloned validator for future validation
$fieldsFirst.data("valid_req_grp", validator);
// If element isn't being validated, run each require_from_group field's validation rules
if (!$(element).data("being_validated")) {
$fields.data("being_validated", true);
$fields.each(function() {
validator.element(this);
});
$fields.data("being_validated", false);
}
return isValid;
}, $.validator.format("Please fill at least {0} of these fields."));
/*
* Lets you say "either at least X inputs that match selector Y must be filled,
* OR they must all be skipped (left blank)."
*
* The end result, is that none of these inputs:
*
* <input class="productinfo" name="partnumber">
* <input class="productinfo" name="description">
* <input class="productinfo" name="color">
*
* ...will validate unless either at least two of them are filled,
* OR none of them are.
*
* partnumber: {skip_or_fill_minimum: [2,".productinfo"]},
* description: {skip_or_fill_minimum: [2,".productinfo"]},
* color: {skip_or_fill_minimum: [2,".productinfo"]}
*
* options[0]: number of fields that must be filled in the group
* options[1]: CSS selector that defines the group of conditionally required fields
*
*/
$.validator.addMethod("skip_or_fill_minimum", function(value, element, options) {
var $fields = $(options[1], element.form),
$fieldsFirst = $fields.eq(0),
validator = $fieldsFirst.data("valid_skip") ? $fieldsFirst.data("valid_skip") : $.extend({}, this),
numberFilled = $fields.filter(function() {
return validator.elementValue(this);
}).length,
isValid = numberFilled === 0 || numberFilled >= options[0];
// Store the cloned validator for future validation
$fieldsFirst.data("valid_skip", validator);
// If element isn't being validated, run each skip_or_fill_minimum field's validation rules
if (!$(element).data("being_validated")) {
$fields.data("being_validated", true);
$fields.each(function() {
validator.element(this);
});
$fields.data("being_validated", false);
}
return isValid;
}, $.validator.format("Please either skip these fields or fill at least {0} of them."));
/* Validates US States and/or Territories by @jdforsythe
* Can be case insensitive or require capitalization - default is case insensitive
* Can include US Territories or not - default does not
* Can include US Military postal abbreviations (AA, AE, AP) - default does not
*
* Note: "States" always includes DC (District of Colombia)
*
* Usage examples:
*
* This is the default - case insensitive, no territories, no military zones
* stateInput: {
* caseSensitive: false,
* includeTerritories: false,
* includeMilitary: false
* }
*
* Only allow capital letters, no territories, no military zones
* stateInput: {
* caseSensitive: false
* }
*
* Case insensitive, include territories but not military zones
* stateInput: {
* includeTerritories: true
* }
*
* Only allow capital letters, include territories and military zones
* stateInput: {
* caseSensitive: true,
* includeTerritories: true,
* includeMilitary: true
* }
*
*
*
*/
$.validator.addMethod("stateUS", function(value, element, options) {
var isDefault = typeof options === "undefined",
caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive,
includeTerritories = ( isDefault || typeof options.includeTerritories === "undefined" ) ? false : options.includeTerritories,
includeMilitary = ( isDefault || typeof options.includeMilitary === "undefined" ) ? false : options.includeMilitary,
regex;
if (!includeTerritories && !includeMilitary) {
regex = "^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$";
} else if (includeTerritories && includeMilitary) {
regex = "^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$";
} else if (includeTerritories) {
regex = "^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$";
} else {
regex = "^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$";
}
regex = caseSensitive ? new RegExp(regex) : new RegExp(regex, "i");
return this.optional(element) || regex.test(value);
},
"Please specify a valid state");
// TODO check if value starts with <, otherwise don't try stripping anything
$.validator.addMethod("strippedminlength", function(value, element, param) {
return $(value).text().length >= param;
}, $.validator.format("Please enter at least {0} characters"));
$.validator.addMethod("time", function(value, element) {
return this.optional(element) || /^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(value);
}, "Please enter a valid time, between 00:00 and 23:59");
$.validator.addMethod("time12h", function(value, element) {
return this.optional(element) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(value);
}, "Please enter a valid time in 12-hour am/pm format");
// same as url, but TLD is optional
$.validator.addMethod("url2", function(value, element) {
return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
}, $.validator.messages.url);
/**
* Return true, if the value is a valid vehicle identification number (VIN).
*
* Works with all kind of text inputs.
*
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
* @desc Declares a required input element whose value must be a valid vehicle identification number.
*
* @name $.validator.methods.vinUS
* @type Boolean
* @cat Plugins/Validate/Methods
*/
$.validator.addMethod("vinUS", function(v) {
if (v.length !== 17) {
return false;
}
var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ],
FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ],
rs = 0,
i, n, d, f, cd, cdv;
for (i = 0; i < 17; i++) {
f = FL[i];
d = v.slice(i, i + 1);
if (i === 8) {
cdv = d;
}
if (!isNaN(d)) {
d *= f;
} else {
for (n = 0; n < LL.length; n++) {
if (d.toUpperCase() === LL[n]) {
d = VL[n];
d *= f;
if (isNaN(cdv) && n === 8) {
cdv = LL[n];
}
break;
}
}
}
rs += d;
}
cd = rs % 11;
if (cd === 10) {
cd = "X";
}
if (cd === cdv) {
return true;
}
return false;
}, "The specified vehicle identification number (VIN) is invalid.");
$.validator.addMethod("zipcodeUS", function(value, element) {
return this.optional(element) || /^\d{5}(-\d{4})?$/.test(value);
}, "The specified US ZIP Code is invalid");
$.validator.addMethod("ziprange", function(value, element) {
return this.optional(element) || /^90[2-5]\d\{2\}-\d{4}$/.test(value);
}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx");
})); | {
"pile_set_name": "Github"
} |
index.md
welcome.md
documentation.md
style_guide.md
benchmarks.md
| {
"pile_set_name": "Github"
} |
<?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
| {
"pile_set_name": "Github"
} |
package intercept
import (
"bufio"
"bytes"
"io/ioutil"
"net/http"
"net/http/httputil"
"strconv"
"github.com/empijei/cli/lg"
"github.com/empijei/wapty/ui/apis"
)
//ResponseQueue represents the queue of the response to requests that have been intercepted
var ResponseQueue chan *pendingResponse
func init() {
ResponseQueue = make(chan *pendingResponse)
}
//Called by the dispatchLoop if a response is intercepted
func handleResponse(presp *pendingResponse) {
res := presp.originalResponse
ContentLength := res.ContentLength
res.ContentLength = -1
res.Header.Del("Content-Length")
rawRes, err := httputil.DumpResponse(res, true)
if err != nil {
lg.Errorf("intercept: dumping response %v", err)
presp.modifiedResponse <- &mayBeResponse{err: err}
return
}
var editedResponse *http.Response
editedResponseDump, action := editBuffer(apis.PLD_RESPONSE, rawRes, presp.originalRequest.URL.Scheme+"://"+presp.originalRequest.Host)
switch action {
case apis.EDT_FORWARD:
res.ContentLength = ContentLength
res.Header.Set("Content-Length", strconv.Itoa(int(ContentLength)))
editedResponse = res
case apis.EDT_EDIT, apis.EDT_PROVIDERESP:
editedResponseBuffer := bufio.NewReader(bytes.NewReader(editedResponseDump))
editedResponse, err = http.ReadResponse(editedResponseBuffer, presp.originalRequest)
if err != nil {
//TODO check this error and hijack connection to send raw bytes
lg.Error("Error during edited response parsing, forwarding original response.")
res.ContentLength = ContentLength
editedResponse = res
}
status.addRawEditedResponse(presp.id, editedResponseDump)
case apis.EDT_DROP:
editedResponse = caseDrop()
default:
//TODO implement this
lg.Error("Not implemented yet")
}
presp.modifiedResponse <- &mayBeResponse{res: editedResponse, err: err}
}
func preProcessResponse(req *http.Request, res *http.Response, ID int) *http.Response {
res = decodeResponse(res)
//Skip intercept if request was not intercepted, just add the response to the Status
status.addResponse(ID, res)
//TODO autoEdit here
//TODO add to status as edited if autoedited
return res
}
func editResponse(req *http.Request, res *http.Response, ID int) (*http.Response, error) {
//Request was intercepted, go through the intercept/edit process
//TODO use the autoedited one to edit
ModifiedResponse := make(chan *mayBeResponse)
ResponseQueue <- &pendingResponse{id: ID, modifiedResponse: ModifiedResponse, originalRequest: req, originalResponse: res}
mayBeRes := <-ModifiedResponse
return mayBeRes.res, mayBeRes.err
}
//Making use of the net.http package to remove all the encoding by exausting the
//request body and replacing it with a io.ReadCloser with the complete response.
//This takes care of Transfer-Encoding and Content-Encoding
func decodeResponse(res *http.Response) *http.Response {
defer func() { _ = res.Body.Close() }()
buf, err := ioutil.ReadAll(res.Body)
if err != nil {
lg.Error(err)
return res
}
res.Body = ioutil.NopCloser(bytes.NewBuffer(buf))
res.TransferEncoding = nil
stripHTHHeaders(&(res.Header))
res.ContentLength = int64(len(buf))
return res
}
func caseDrop() (res *http.Response) {
return GenerateResponse("Interceptor", "Response was dropped", 418)
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef STORAGE_LEVELDB_PORT_PORT_H_
#define STORAGE_LEVELDB_PORT_PORT_H_
#include <string.h>
// Include the appropriate platform specific file below. If you are
// porting to a new platform, see "port_example.h" for documentation
// of what the new port_<platform>.h file must provide.
#if defined(LEVELDB_PLATFORM_POSIX)
# include "port/port_posix.h"
#elif defined(LEVELDB_PLATFORM_CHROMIUM)
# include "port/port_chromium.h"
#endif
#endif // STORAGE_LEVELDB_PORT_PORT_H_
| {
"pile_set_name": "Github"
} |
namespace Volo.Blogging.Tagging
{
public class TagConsts
{
/// <summary>
/// Default value: 64
/// </summary>
public static int MaxNameLength { get; set; } = 64;
/// <summary>
/// Default value: 512
/// </summary>
public static int MaxDescriptionLength { get; set; } = 512;
}
}
| {
"pile_set_name": "Github"
} |
package se.ansman.kotshi
/**
* Annotation to be placed on enum an enum value or sealed class subclass to indicate that it is the default value if
* an unknown or missing entry is encountered.
*
* Only one value can be annotated.
*
* If no entry is annotated the adapter will throw an exception if an unknown value is encountered.
*
* Example:
* ```
* @JsonSerializable
* enum class SomeEnum {
* @Json(name = "some-value")
* SOME_VALUE,
* @Json(name = "some-other-value")
* SOME_OTHER_VALUE,
* @JsonDefaultValue
* UNKNOWN
* }
* ```
*/
@Target(AnnotationTarget.FIELD, AnnotationTarget.CLASS)
@MustBeDocumented
@Retention(AnnotationRetention.SOURCE)
annotation class JsonDefaultValue
| {
"pile_set_name": "Github"
} |
{
"name": "@taskbotjs/example",
"description": "An example project for TaskBotJS.",
"license": "MIT",
"repository": "github:eropple/taskbotjs",
"version": "0.9.1-wip",
"main": "dist",
"files": [
"*"
],
"scripts": {
"build": "tsc",
"clean": "rm -rf dist",
"precommit": "npm run test",
"consumer": "../service/bin/taskbot.js --config-file cfg/example.config.js",
"producer": "node ./dist/producer",
"prepush": "npm run test",
"test": "tslint --project . && jest",
"watch": "tsc --watch --preserveWatchOutput"
},
"dependencies": {
"@taskbotjs/client": "0.9.1-wip",
"@taskbotjs/service": "0.9.1-wip",
"@types/chance": "^1.0.0",
"bunyan": "^1.8.12",
"bunyan-prettystream-circularsafe": "^0.3.1",
"chance": "^1.0.16",
"luxon": "^1.3.0",
"sleep-promise": "^8.0.0"
},
"devDependencies": {
"tslint": "^5.11.0",
"typescript": "^3.1.6"
},
"engines": {
"node": ">= 8.10.0"
}
}
| {
"pile_set_name": "Github"
} |
rule k2318_37124aadc6210b12
{
meta:
copyright="Copyright (c) 2014-2018 Support Intelligence Inc, All Rights Reserved."
engine="saphire/1.3.8 divinorum/0.9992 icewater/0.4"
viz_url="http://icewater.io/en/cluster/query?h64=k2318.37124aadc6210b12"
cluster="k2318.37124aadc6210b12"
cluster_size="11"
filetype = ""
tlp = "amber"
version = "icewater snowflake"
author = "Rick Wesson (@wessorh) [email protected]"
date = "20180910"
license = "RIL-1.0 [Rick's Internet License]"
family="iframe html redirector"
md5_hashes="['fa90668fb4aa2fe5b1529f9fd26f6d6c19e23d3c','6ebc44d6755a3d39f3b43da64160ccdb7ba2e71e','bdcdfef92ad98e3ba85c4d819bcd34e47a9f7ac5']"
cluster_members="http://icewater.io/en/cluster/detail?h64=k2318.37124aadc6210b12"
strings:
$hex_string = { 697a653d223122207374796c653d2277696474683a2031303025223e3c6f7074696f6e2076616c75653d22222053454c45435445443ec2fbe1e5f0e8f2e53c2f }
condition:
filesize > 16384 and filesize < 65536
and $hex_string
}
| {
"pile_set_name": "Github"
} |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- |
-- Module : Network.Google.ServiceBroker.Types.Sum
-- Copyright : (c) 2015-2016 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <[email protected]>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.Google.ServiceBroker.Types.Sum where
import Network.Google.Prelude hiding (Bytes)
-- | V1 error format.
data Xgafv
= X1
-- ^ @1@
-- v1 error format
| X2
-- ^ @2@
-- v2 error format
deriving (Eq, Ord, Enum, Read, Show, Data, Typeable, Generic)
instance Hashable Xgafv
instance FromHttpApiData Xgafv where
parseQueryParam = \case
"1" -> Right X1
"2" -> Right X2
x -> Left ("Unable to parse Xgafv from: " <> x)
instance ToHttpApiData Xgafv where
toQueryParam = \case
X1 -> "1"
X2 -> "2"
instance FromJSON Xgafv where
parseJSON = parseJSONText "Xgafv"
instance ToJSON Xgafv where
toJSON = toJSONText
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="R User Library" level="project" />
<orderEntry type="library" name="R Skeletons" level="application" />
</component>
</module> | {
"pile_set_name": "Github"
} |
<?php
/**
* @package AlecadddPlugin
*/
namespace Inc\Api\Callbacks;
use Inc\Base\BaseController;
class AdminCallbacks extends BaseController
{
public function adminDashboard()
{
return require_once( "$this->plugin_path/templates/admin.php" );
}
public function adminCpt()
{
return require_once( "$this->plugin_path/templates/cpt.php" );
}
public function adminTaxonomy()
{
return require_once( "$this->plugin_path/templates/taxonomy.php" );
}
public function adminWidget()
{
return require_once( "$this->plugin_path/templates/widget.php" );
}
public function adminGallery()
{
echo "<h1>Gallery Manager</h1>";
}
public function adminTestimonial()
{
echo "<h1>Testimonial Manager</h1>";
}
public function adminTemplates()
{
echo "<h1>Templates Manager</h1>";
}
public function adminAuth()
{
echo "<h1>Templates Manager</h1>";
}
public function adminMembership()
{
echo "<h1>Membership Manager</h1>";
}
public function adminChat()
{
echo "<h1>Chat Manager</h1>";
}
} | {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FFMpeg\Exception;
class RuntimeException extends \RuntimeException implements ExceptionInterface
{
}
| {
"pile_set_name": "Github"
} |
#include <QtWidgets>
#include "projectdialog.h"
ProjectDialog::ProjectDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
projectA->addItem("Giosue Carducci");
projectA->addItem("Eyvind Johnson");
projectA->addItem("Sally Prudhomme");
projectA->addItem("Henryk Sienkiewicz");
projectA->addItem("Carl Spitteler");
projectA->addItem("Rabindranath Tagore");
projectA->addItem("Kawabata Yasunari");
projectB->addItem("Rudolf Eucken");
projectB->addItem("Anatole France");
projectB->addItem("Rudyard Kipling");
projectB->addItem("Thomas Mann");
projectB->addItem("Eugene O'Neill");
projectB->addItem("Sigrid Undset");
}
void ProjectDialog::on_leftButton_clicked()
{
moveCurrentItem(projectB, projectA);
}
void ProjectDialog::on_rightButton_clicked()
{
moveCurrentItem(projectA, projectB);
}
void ProjectDialog::moveCurrentItem(ProjectListWidget *source,
ProjectListWidget *target)
{
if (source->currentItem()) {
QListWidgetItem *newItem = source->currentItem()->clone();
target->addItem(newItem);
target->setCurrentItem(newItem);
delete source->currentItem();
}
}
| {
"pile_set_name": "Github"
} |
int warningInHeader()
{
}
void myfun()
{
int i = 0;
if (i = 3) {}
}
errorInHeader;
| {
"pile_set_name": "Github"
} |
<?php
/**
* @package Joomla.UnitTest
* @subpackage Github
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* Test class for JGithubPulls.
*
* @package Joomla.UnitTest
* @subpackage Github
*
* @since 1.7.0
*/
class JGithubPullsTest extends \PHPUnit\Framework\TestCase
{
/**
* @var JRegistry Options for the GitHub object.
* @since 2.5.0
*/
protected $options;
/**
* @var JGithubHttp Mock client object.
* @since 2.5.0
*/
protected $client;
/**
* @var JHttpResponse Mock response object.
* @since 3.1.4
*/
protected $response;
/**
* @var JGithubPackagePulls Object under test.
* @since 2.5.0
*/
protected $object;
/**
* @var string Sample JSON string.
* @since 2.5.0
*/
protected $sampleString = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
/**
* @var string Sample JSON error message.
* @since 2.5.0
*/
protected $errorString = '{"message": "Generic Error"}';
/**
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*
* @access protected
*
* @return void
*/
protected function setUp()
{
parent::setUp();
$this->options = new JRegistry;
$this->client = $this->getMockBuilder('JGithubHttp')->setMethods(array('get', 'post', 'delete', 'patch', 'put'))->getMock();
$this->response = $this->getMockBuilder('JHttpResponse')->getMock();
$this->object = new JGithubPackagePulls($this->options, $this->client);
}
/**
* Overrides the parent tearDown method.
*
* @return void
*
* @see \PHPUnit\Framework\TestCase::tearDown()
* @since 3.6
*/
protected function tearDown()
{
unset($this->options, $this->client, $this->response, $this->object);
parent::tearDown();
}
/**
* Test...
*
* @param string $name The method name.
*
* @return string
*/
protected function getMethod($name)
{
$class = new ReflectionClass('JGithubPulls');
$method = $class->getMethod($name);
$method->setAccessible(true);
return $method;
}
/**
* Tests the create method
*
* @return void
*/
public function testCreate()
{
$this->response->code = 201;
$this->response->body = $this->sampleString;
$pull = new stdClass;
$pull->title = 'My Pull Request';
$pull->base = 'staging';
$pull->head = 'joomla-jenkins:mychanges';
$pull->body = 'These are my changes - please review them';
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls', json_encode($pull))
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->create('joomla', 'joomla-platform', 'My Pull Request', 'staging', 'joomla-jenkins:mychanges',
'These are my changes - please review them'),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the create method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testCreateFailure()
{
$this->response->code = 501;
$this->response->body = $this->errorString;
$pull = new stdClass;
$pull->title = 'My Pull Request';
$pull->base = 'staging';
$pull->head = 'joomla-jenkins:mychanges';
$pull->body = 'These are my changes - please review them';
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls', json_encode($pull))
->will($this->returnValue($this->response));
$this->object->create('joomla', 'joomla-platform', 'My Pull Request', 'staging', 'joomla-jenkins:mychanges',
'These are my changes - please review them');
}
/**
* Tests the createComment method
*
* @return void
*/
public function testCreateComment()
{
$this->response->code = 201;
$this->response->body = $this->sampleString;
$pull = new stdClass;
$pull->body = 'My Insightful Comment';
$pull->commit_id = 'abcde12345';
$pull->path = '/path/to/file';
$pull->position = 254;
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls/523/comments', json_encode($pull))
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->createComment('joomla', 'joomla-platform', 523, 'My Insightful Comment', 'abcde12345', '/path/to/file', 254),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the createComment method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testCreateCommentFailure()
{
$this->response->code = 501;
$this->response->body = $this->errorString;
$pull = new stdClass;
$pull->body = 'My Insightful Comment';
$pull->commit_id = 'abcde12345';
$pull->path = '/path/to/file';
$pull->position = 254;
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls/523/comments', json_encode($pull))
->will($this->returnValue($this->response));
$this->object->createComment('joomla', 'joomla-platform', 523, 'My Insightful Comment', 'abcde12345', '/path/to/file', 254);
}
/**
* Tests the createCommentReply method
*
* @return void
*/
public function testCreateCommentReply()
{
$this->response->code = 201;
$this->response->body = $this->sampleString;
$pull = new stdClass;
$pull->body = 'My Insightful Comment';
$pull->in_reply_to = 434;
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls/523/comments', json_encode($pull))
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->createCommentReply('joomla', 'joomla-platform', 523, 'My Insightful Comment', 434),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the createCommentReply method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testCreateCommentReplyFailure()
{
$this->response->code = 501;
$this->response->body = $this->errorString;
$pull = new stdClass;
$pull->body = 'My Insightful Comment';
$pull->in_reply_to = 434;
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls/523/comments', json_encode($pull))
->will($this->returnValue($this->response));
$this->object->createCommentReply('joomla', 'joomla-platform', 523, 'My Insightful Comment', 434);
}
/**
* Tests the createFromIssue method
*
* @return void
*/
public function testCreateFromIssue()
{
$this->response->code = 201;
$this->response->body = $this->sampleString;
$pull = new stdClass;
$pull->issue = 254;
$pull->base = 'staging';
$pull->head = 'joomla-jenkins:mychanges';
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls', json_encode($pull))
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->createFromIssue('joomla', 'joomla-platform', 254, 'staging', 'joomla-jenkins:mychanges'),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the createFromIssue method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testCreateFromIssueFailure()
{
$this->response->code = 501;
$this->response->body = $this->errorString;
$pull = new stdClass;
$pull->issue = 254;
$pull->base = 'staging';
$pull->head = 'joomla-jenkins:mychanges';
$this->client->expects($this->once())
->method('post')
->with('/repos/joomla/joomla-platform/pulls', json_encode($pull))
->will($this->returnValue($this->response));
$this->object->createFromIssue('joomla', 'joomla-platform', 254, 'staging', 'joomla-jenkins:mychanges');
}
/**
* Tests the deleteComment method
*
* @return void
*/
public function testDeleteComment()
{
$this->response->code = 204;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('delete')
->with('/repos/joomla/joomla-platform/pulls/comments/254')
->will($this->returnValue($this->response));
$this->object->deleteComment('joomla', 'joomla-platform', 254);
}
/**
* Tests the deleteComment method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testDeleteCommentFailure()
{
$this->response->code = 504;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('delete')
->with('/repos/joomla/joomla-platform/pulls/comments/254')
->will($this->returnValue($this->response));
$this->object->deleteComment('joomla', 'joomla-platform', 254);
}
/**
* Tests the edit method
*
* @return void
*/
public function testEdit()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$pull = new stdClass;
$pull->title = 'My Pull Request';
$pull->body = 'These are my changes - please review them';
$pull->state = 'Closed';
$this->client->expects($this->once())
->method('patch')
->with('/repos/joomla/joomla-platform/pulls/523', json_encode($pull))
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->edit('joomla', 'joomla-platform', 523, 'My Pull Request', 'These are my changes - please review them', 'Closed'),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the edit method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testEditFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$pull = new stdClass;
$pull->title = 'My Pull Request';
$pull->body = 'These are my changes - please review them';
$this->client->expects($this->once())
->method('patch')
->with('/repos/joomla/joomla-platform/pulls/523', json_encode($pull))
->will($this->returnValue($this->response));
$this->object->edit('joomla', 'joomla-platform', 523, 'My Pull Request', 'These are my changes - please review them');
}
/**
* Tests the editComment method
*
* @return void
*/
public function testEditComment()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$pull = new stdClass;
$pull->body = 'This comment is now even more insightful';
$this->client->expects($this->once())
->method('patch')
->with('/repos/joomla/joomla-platform/pulls/comments/523', json_encode($pull))
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->editComment('joomla', 'joomla-platform', 523, 'This comment is now even more insightful'),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the editComment method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testEditCommentFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$pull = new stdClass;
$pull->body = 'This comment is now even more insightful';
$this->client->expects($this->once())
->method('patch')
->with('/repos/joomla/joomla-platform/pulls/comments/523', json_encode($pull))
->will($this->returnValue($this->response));
$this->object->editComment('joomla', 'joomla-platform', 523, 'This comment is now even more insightful');
}
/**
* Tests the get method
*
* @return void
*/
public function testGet()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->get('joomla', 'joomla-platform', 523),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the get method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testGetFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523')
->will($this->returnValue($this->response));
$this->object->get('joomla', 'joomla-platform', 523);
}
/**
* Tests the getComment method
*
* @return void
*/
public function testGetComment()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/comments/523')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->getComment('joomla', 'joomla-platform', 523),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the getComment method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testGetCommentFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/comments/523')
->will($this->returnValue($this->response));
$this->object->getComment('joomla', 'joomla-platform', 523);
}
/**
* Tests the getComments method
*
* @return void
*/
public function testGetComments()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/comments')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->getComments('joomla', 'joomla-platform', 523),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the getComments method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testGetCommentsFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/comments')
->will($this->returnValue($this->response));
$this->object->getComments('joomla', 'joomla-platform', 523);
}
/**
* Tests the getCommits method
*
* @return void
*/
public function testGetCommits()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/commits')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->getCommits('joomla', 'joomla-platform', 523),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the getCommits method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testGetCommitsFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/commits')
->will($this->returnValue($this->response));
$this->object->getCommits('joomla', 'joomla-platform', 523);
}
/**
* Tests the getFiles method
*
* @return void
*/
public function testGetFiles()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/files')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->getFiles('joomla', 'joomla-platform', 523),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the getFiles method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testGetFilesFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/files')
->will($this->returnValue($this->response));
$this->object->getFiles('joomla', 'joomla-platform', 523);
}
/**
* Tests the getList method
*
* @return void
*/
public function testGetList()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls?state=closed')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->getList('joomla', 'joomla-platform', 'closed'),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the getList method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testGetListFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls')
->will($this->returnValue($this->response));
$this->object->getList('joomla', 'joomla-platform');
}
/**
* Tests the isMerged method when the pull request has been merged
*
* @return void
*/
public function testIsMergedTrue()
{
$this->response->code = 204;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/merge')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->isMerged('joomla', 'joomla-platform', 523),
$this->equalTo(true)
);
}
/**
* Tests the isMerged method when the pull request has not been merged
*
* @return void
*/
public function testIsMergedFalse()
{
$this->response->code = 404;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/merge')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->isMerged('joomla', 'joomla-platform', 523),
$this->equalTo(false)
);
}
/**
* Tests the isMerged method when the request fails
*
* @expectedException DomainException
*
* @return void
*/
public function testIsMergedFailure()
{
$this->response->code = 504;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('get')
->with('/repos/joomla/joomla-platform/pulls/523/merge')
->will($this->returnValue($this->response));
$this->object->isMerged('joomla', 'joomla-platform', 523);
}
/**
* Tests the merge method
*
* @return void
*/
public function testMerge()
{
$this->response->code = 200;
$this->response->body = $this->sampleString;
$this->client->expects($this->once())
->method('put')
->with('/repos/joomla/joomla-platform/pulls/523/merge')
->will($this->returnValue($this->response));
$this->assertThat(
$this->object->merge('joomla', 'joomla-platform', 523),
$this->equalTo(json_decode($this->sampleString))
);
}
/**
* Tests the merge method - failure
*
* @expectedException DomainException
*
* @return void
*/
public function testMergeFailure()
{
$this->response->code = 500;
$this->response->body = $this->errorString;
$this->client->expects($this->once())
->method('put')
->with('/repos/joomla/joomla-platform/pulls/523/merge')
->will($this->returnValue($this->response));
$this->object->merge('joomla', 'joomla-platform', 523);
}
}
| {
"pile_set_name": "Github"
} |
using System;
using Raven.Server.Documents.Indexes.Static.Spatial;
namespace Raven.Server.Documents.Queries
{
public class QueryBuilderFactories
{
public Func<string, SpatialField> GetSpatialFieldFactory { get; set; }
public Func<string, System.Text.RegularExpressions.Regex> GetRegexFactory { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
// go generate gen.go
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// Package iana provides protocol number resources managed by the Internet Assigned Numbers Authority (IANA).
package iana // import "golang.org/x/net/internal/iana"
// Differentiated Services Field Codepoints (DSCP), Updated: 2013-06-25
const (
DiffServCS0 = 0x0 // CS0
DiffServCS1 = 0x20 // CS1
DiffServCS2 = 0x40 // CS2
DiffServCS3 = 0x60 // CS3
DiffServCS4 = 0x80 // CS4
DiffServCS5 = 0xa0 // CS5
DiffServCS6 = 0xc0 // CS6
DiffServCS7 = 0xe0 // CS7
DiffServAF11 = 0x28 // AF11
DiffServAF12 = 0x30 // AF12
DiffServAF13 = 0x38 // AF13
DiffServAF21 = 0x48 // AF21
DiffServAF22 = 0x50 // AF22
DiffServAF23 = 0x58 // AF23
DiffServAF31 = 0x68 // AF31
DiffServAF32 = 0x70 // AF32
DiffServAF33 = 0x78 // AF33
DiffServAF41 = 0x88 // AF41
DiffServAF42 = 0x90 // AF42
DiffServAF43 = 0x98 // AF43
DiffServEFPHB = 0xb8 // EF PHB
DiffServVOICEADMIT = 0xb0 // VOICE-ADMIT
)
// IPv4 TOS Byte and IPv6 Traffic Class Octet, Updated: 2001-09-06
const (
NotECNTransport = 0x0 // Not-ECT (Not ECN-Capable Transport)
ECNTransport1 = 0x1 // ECT(1) (ECN-Capable Transport(1))
ECNTransport0 = 0x2 // ECT(0) (ECN-Capable Transport(0))
CongestionExperienced = 0x3 // CE (Congestion Experienced)
)
// Protocol Numbers, Updated: 2015-10-06
const (
ProtocolIP = 0 // IPv4 encapsulation, pseudo protocol number
ProtocolHOPOPT = 0 // IPv6 Hop-by-Hop Option
ProtocolICMP = 1 // Internet Control Message
ProtocolIGMP = 2 // Internet Group Management
ProtocolGGP = 3 // Gateway-to-Gateway
ProtocolIPv4 = 4 // IPv4 encapsulation
ProtocolST = 5 // Stream
ProtocolTCP = 6 // Transmission Control
ProtocolCBT = 7 // CBT
ProtocolEGP = 8 // Exterior Gateway Protocol
ProtocolIGP = 9 // any private interior gateway (used by Cisco for their IGRP)
ProtocolBBNRCCMON = 10 // BBN RCC Monitoring
ProtocolNVPII = 11 // Network Voice Protocol
ProtocolPUP = 12 // PUP
ProtocolEMCON = 14 // EMCON
ProtocolXNET = 15 // Cross Net Debugger
ProtocolCHAOS = 16 // Chaos
ProtocolUDP = 17 // User Datagram
ProtocolMUX = 18 // Multiplexing
ProtocolDCNMEAS = 19 // DCN Measurement Subsystems
ProtocolHMP = 20 // Host Monitoring
ProtocolPRM = 21 // Packet Radio Measurement
ProtocolXNSIDP = 22 // XEROX NS IDP
ProtocolTRUNK1 = 23 // Trunk-1
ProtocolTRUNK2 = 24 // Trunk-2
ProtocolLEAF1 = 25 // Leaf-1
ProtocolLEAF2 = 26 // Leaf-2
ProtocolRDP = 27 // Reliable Data Protocol
ProtocolIRTP = 28 // Internet Reliable Transaction
ProtocolISOTP4 = 29 // ISO Transport Protocol Class 4
ProtocolNETBLT = 30 // Bulk Data Transfer Protocol
ProtocolMFENSP = 31 // MFE Network Services Protocol
ProtocolMERITINP = 32 // MERIT Internodal Protocol
ProtocolDCCP = 33 // Datagram Congestion Control Protocol
Protocol3PC = 34 // Third Party Connect Protocol
ProtocolIDPR = 35 // Inter-Domain Policy Routing Protocol
ProtocolXTP = 36 // XTP
ProtocolDDP = 37 // Datagram Delivery Protocol
ProtocolIDPRCMTP = 38 // IDPR Control Message Transport Proto
ProtocolTPPP = 39 // TP++ Transport Protocol
ProtocolIL = 40 // IL Transport Protocol
ProtocolIPv6 = 41 // IPv6 encapsulation
ProtocolSDRP = 42 // Source Demand Routing Protocol
ProtocolIPv6Route = 43 // Routing Header for IPv6
ProtocolIPv6Frag = 44 // Fragment Header for IPv6
ProtocolIDRP = 45 // Inter-Domain Routing Protocol
ProtocolRSVP = 46 // Reservation Protocol
ProtocolGRE = 47 // Generic Routing Encapsulation
ProtocolDSR = 48 // Dynamic Source Routing Protocol
ProtocolBNA = 49 // BNA
ProtocolESP = 50 // Encap Security Payload
ProtocolAH = 51 // Authentication Header
ProtocolINLSP = 52 // Integrated Net Layer Security TUBA
ProtocolNARP = 54 // NBMA Address Resolution Protocol
ProtocolMOBILE = 55 // IP Mobility
ProtocolTLSP = 56 // Transport Layer Security Protocol using Kryptonet key management
ProtocolSKIP = 57 // SKIP
ProtocolIPv6ICMP = 58 // ICMP for IPv6
ProtocolIPv6NoNxt = 59 // No Next Header for IPv6
ProtocolIPv6Opts = 60 // Destination Options for IPv6
ProtocolCFTP = 62 // CFTP
ProtocolSATEXPAK = 64 // SATNET and Backroom EXPAK
ProtocolKRYPTOLAN = 65 // Kryptolan
ProtocolRVD = 66 // MIT Remote Virtual Disk Protocol
ProtocolIPPC = 67 // Internet Pluribus Packet Core
ProtocolSATMON = 69 // SATNET Monitoring
ProtocolVISA = 70 // VISA Protocol
ProtocolIPCV = 71 // Internet Packet Core Utility
ProtocolCPNX = 72 // Computer Protocol Network Executive
ProtocolCPHB = 73 // Computer Protocol Heart Beat
ProtocolWSN = 74 // Wang Span Network
ProtocolPVP = 75 // Packet Video Protocol
ProtocolBRSATMON = 76 // Backroom SATNET Monitoring
ProtocolSUNND = 77 // SUN ND PROTOCOL-Temporary
ProtocolWBMON = 78 // WIDEBAND Monitoring
ProtocolWBEXPAK = 79 // WIDEBAND EXPAK
ProtocolISOIP = 80 // ISO Internet Protocol
ProtocolVMTP = 81 // VMTP
ProtocolSECUREVMTP = 82 // SECURE-VMTP
ProtocolVINES = 83 // VINES
ProtocolTTP = 84 // Transaction Transport Protocol
ProtocolIPTM = 84 // Internet Protocol Traffic Manager
ProtocolNSFNETIGP = 85 // NSFNET-IGP
ProtocolDGP = 86 // Dissimilar Gateway Protocol
ProtocolTCF = 87 // TCF
ProtocolEIGRP = 88 // EIGRP
ProtocolOSPFIGP = 89 // OSPFIGP
ProtocolSpriteRPC = 90 // Sprite RPC Protocol
ProtocolLARP = 91 // Locus Address Resolution Protocol
ProtocolMTP = 92 // Multicast Transport Protocol
ProtocolAX25 = 93 // AX.25 Frames
ProtocolIPIP = 94 // IP-within-IP Encapsulation Protocol
ProtocolSCCSP = 96 // Semaphore Communications Sec. Pro.
ProtocolETHERIP = 97 // Ethernet-within-IP Encapsulation
ProtocolENCAP = 98 // Encapsulation Header
ProtocolGMTP = 100 // GMTP
ProtocolIFMP = 101 // Ipsilon Flow Management Protocol
ProtocolPNNI = 102 // PNNI over IP
ProtocolPIM = 103 // Protocol Independent Multicast
ProtocolARIS = 104 // ARIS
ProtocolSCPS = 105 // SCPS
ProtocolQNX = 106 // QNX
ProtocolAN = 107 // Active Networks
ProtocolIPComp = 108 // IP Payload Compression Protocol
ProtocolSNP = 109 // Sitara Networks Protocol
ProtocolCompaqPeer = 110 // Compaq Peer Protocol
ProtocolIPXinIP = 111 // IPX in IP
ProtocolVRRP = 112 // Virtual Router Redundancy Protocol
ProtocolPGM = 113 // PGM Reliable Transport Protocol
ProtocolL2TP = 115 // Layer Two Tunneling Protocol
ProtocolDDX = 116 // D-II Data Exchange (DDX)
ProtocolIATP = 117 // Interactive Agent Transfer Protocol
ProtocolSTP = 118 // Schedule Transfer Protocol
ProtocolSRP = 119 // SpectraLink Radio Protocol
ProtocolUTI = 120 // UTI
ProtocolSMP = 121 // Simple Message Protocol
ProtocolPTP = 123 // Performance Transparency Protocol
ProtocolISIS = 124 // ISIS over IPv4
ProtocolFIRE = 125 // FIRE
ProtocolCRTP = 126 // Combat Radio Transport Protocol
ProtocolCRUDP = 127 // Combat Radio User Datagram
ProtocolSSCOPMCE = 128 // SSCOPMCE
ProtocolIPLT = 129 // IPLT
ProtocolSPS = 130 // Secure Packet Shield
ProtocolPIPE = 131 // Private IP Encapsulation within IP
ProtocolSCTP = 132 // Stream Control Transmission Protocol
ProtocolFC = 133 // Fibre Channel
ProtocolRSVPE2EIGNORE = 134 // RSVP-E2E-IGNORE
ProtocolMobilityHeader = 135 // Mobility Header
ProtocolUDPLite = 136 // UDPLite
ProtocolMPLSinIP = 137 // MPLS-in-IP
ProtocolMANET = 138 // MANET Protocols
ProtocolHIP = 139 // Host Identity Protocol
ProtocolShim6 = 140 // Shim6 Protocol
ProtocolWESP = 141 // Wrapped Encapsulating Security Payload
ProtocolROHC = 142 // Robust Header Compression
ProtocolReserved = 255 // Reserved
)
| {
"pile_set_name": "Github"
} |
from __future__ import absolute_import
import six
class Model(dict):
""" for complex type: models
"""
# access dict like object
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
def __init__(self):
""" constructor
"""
super(Model, self).__init__()
def apply_with(self, obj, val, ctx):
""" recursively apply Schema object
:param obj.Model obj: model object to instruct how to create this model
:param dict val: things used to construct this model
"""
for k, v in six.iteritems(val):
if k in obj.properties:
pobj = obj.properties.get(k)
if pobj.readOnly == True and ctx['read'] == False:
raise Exception('read-only property is set in write context.')
self[k] = ctx['factory'].produce(pobj, v)
# TODO: patternProperties here
# TODO: fix bug, everything would not go into additionalProperties, instead of recursive
elif obj.additionalProperties == True:
ctx['addp'] = True
elif obj.additionalProperties not in (None, False):
ctx['addp_schema'] = obj
in_obj = set(six.iterkeys(obj.properties))
in_self = set(six.iterkeys(self))
other_prop = in_obj - in_self
for k in other_prop:
p = obj.properties[k]
if p.is_set("default"):
self[k] = ctx['factory'].produce(p, p.default)
not_found = set(obj.required) - set(six.iterkeys(self))
if len(not_found):
raise ValueError('Model missing required key(s): {0}'.format(', '.join(not_found)))
# remove assigned properties to avoid duplicated
# primitive creation
_val = {}
for k in set(six.iterkeys(val)) - in_obj:
_val[k] = val[k]
if obj.discriminator:
self[obj.discriminator] = ctx['name']
return _val
def cleanup(self, val, ctx):
"""
"""
if ctx['addp'] == True:
for k, v in six.iteritems(val):
self[k] = v
ctx['addp'] = False
elif ctx['addp_schema'] != None:
obj = ctx['addp_schema']
for k, v in six.iteritems(val):
self[k] = ctx['factory'].produce(obj.additionalProperties, v)
ctx['addp_schema'] = None
return {}
def __eq__(self, other):
""" equality operater,
will skip checking when both value are None or no attribute.
:param other: another model
:type other: primitives.Model or dict
"""
if other == None:
return False
for k, v in six.iteritems(self):
if v != other.get(k, None):
return False
residual = set(other.keys()) - set(self.keys())
for k in residual:
if other[k] != None:
return False
return True
def __ne__(self, other):
return not self.__eq__(other)
| {
"pile_set_name": "Github"
} |
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by lib/unicore/mktables from the Unicode
# database, Version 9.0.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by core Perl only. The format and even the
# name or existence of this file are subject to change without notice. Don't
# use it directly. Use Unicode::UCD to access the Unicode character data
# base.
# The name this swash is to be known by, with the format of the mappings in
# the main body of the table, and what all code points missing from this file
# map to.
$utf8::SwashInfo{'ToNt'}{'format'} = 's'; # string
$utf8::SwashInfo{'ToNt'}{'missing'} = 'None';
return <<'END';
30 39 Decimal
B2 B3 Digit
B9 Digit
BC BE Numeric
660 669 Decimal
6F0 6F9 Decimal
7C0 7C9 Decimal
966 96F Decimal
9E6 9EF Decimal
9F4 9F9 Numeric
A66 A6F Decimal
AE6 AEF Decimal
B66 B6F Decimal
B72 B77 Numeric
BE6 BEF Decimal
BF0 BF2 Numeric
C66 C6F Decimal
C78 C7E Numeric
CE6 CEF Decimal
D58 D5E Numeric
D66 D6F Decimal
D70 D78 Numeric
DE6 DEF Decimal
E50 E59 Decimal
ED0 ED9 Decimal
F20 F29 Decimal
F2A F33 Numeric
1040 1049 Decimal
1090 1099 Decimal
1369 1371 Digit
1372 137C Numeric
16EE 16F0 Numeric
17E0 17E9 Decimal
17F0 17F9 Numeric
1810 1819 Decimal
1946 194F Decimal
19D0 19D9 Decimal
19DA Digit
1A80 1A89 Decimal
1A90 1A99 Decimal
1B50 1B59 Decimal
1BB0 1BB9 Decimal
1C40 1C49 Decimal
1C50 1C59 Decimal
2070 Digit
2074 2079 Digit
2080 2089 Digit
2150 2182 Numeric
2185 2189 Numeric
2460 2468 Digit
2469 2473 Numeric
2474 247C Digit
247D 2487 Numeric
2488 2490 Digit
2491 249B Numeric
24EA Digit
24EB 24F4 Numeric
24F5 24FD Digit
24FE Numeric
24FF Digit
2776 277E Digit
277F Numeric
2780 2788 Digit
2789 Numeric
278A 2792 Digit
2793 Numeric
2CFD Numeric
3007 Numeric
3021 3029 Numeric
3038 303A Numeric
3192 3195 Numeric
3220 3229 Numeric
3248 324F Numeric
3251 325F Numeric
3280 3289 Numeric
32B1 32BF Numeric
3405 Numeric
3483 Numeric
382A Numeric
3B4D Numeric
4E00 Numeric
4E03 Numeric
4E07 Numeric
4E09 Numeric
4E5D Numeric
4E8C Numeric
4E94 Numeric
4E96 Numeric
4EBF 4EC0 Numeric
4EDF Numeric
4EE8 Numeric
4F0D Numeric
4F70 Numeric
5104 Numeric
5146 Numeric
5169 Numeric
516B Numeric
516D Numeric
5341 Numeric
5343 5345 Numeric
534C Numeric
53C1 53C4 Numeric
56DB Numeric
58F1 Numeric
58F9 Numeric
5E7A Numeric
5EFE 5EFF Numeric
5F0C 5F0E Numeric
5F10 Numeric
62FE Numeric
634C Numeric
67D2 Numeric
6F06 Numeric
7396 Numeric
767E Numeric
8086 Numeric
842C Numeric
8CAE Numeric
8CB3 Numeric
8D30 Numeric
9621 Numeric
9646 Numeric
964C Numeric
9678 Numeric
96F6 Numeric
A620 A629 Decimal
A6E6 A6EF Numeric
A830 A835 Numeric
A8D0 A8D9 Decimal
A900 A909 Decimal
A9D0 A9D9 Decimal
A9F0 A9F9 Decimal
AA50 AA59 Decimal
ABF0 ABF9 Decimal
F96B Numeric
F973 Numeric
F978 Numeric
F9B2 Numeric
F9D1 Numeric
F9D3 Numeric
F9FD Numeric
FF10 FF19 Decimal
10107 10133 Numeric
10140 10178 Numeric
1018A 1018B Numeric
102E1 102FB Numeric
10320 10323 Numeric
10341 Numeric
1034A Numeric
103D1 103D5 Numeric
104A0 104A9 Decimal
10858 1085F Numeric
10879 1087F Numeric
108A7 108AF Numeric
108FB 108FF Numeric
10916 1091B Numeric
109BC 109BD Numeric
109C0 109CF Numeric
109D2 109FF Numeric
10A40 10A43 Digit
10A44 10A47 Numeric
10A7D 10A7E Numeric
10A9D 10A9F Numeric
10AEB 10AEF Numeric
10B58 10B5F Numeric
10B78 10B7F Numeric
10BA9 10BAF Numeric
10CFA 10CFF Numeric
10E60 10E68 Digit
10E69 10E7E Numeric
11052 1105A Digit
1105B 11065 Numeric
11066 1106F Decimal
110F0 110F9 Decimal
11136 1113F Decimal
111D0 111D9 Decimal
111E1 111F4 Numeric
112F0 112F9 Decimal
11450 11459 Decimal
114D0 114D9 Decimal
11650 11659 Decimal
116C0 116C9 Decimal
11730 11739 Decimal
1173A 1173B Numeric
118E0 118E9 Decimal
118EA 118F2 Numeric
11C50 11C59 Decimal
11C5A 11C6C Numeric
12400 1246E Numeric
16A60 16A69 Decimal
16B50 16B59 Decimal
16B5B 16B61 Numeric
1D360 1D371 Numeric
1D7CE 1D7FF Decimal
1E8C7 1E8CF Numeric
1E950 1E959 Decimal
1F100 1F10A Digit
1F10B 1F10C Numeric
20001 Numeric
20064 Numeric
200E2 Numeric
20121 Numeric
2092A Numeric
20983 Numeric
2098C Numeric
2099C Numeric
20AEA Numeric
20AFD Numeric
20B19 Numeric
22390 Numeric
22998 Numeric
23B1B Numeric
2626D Numeric
2F890 Numeric
END
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0+
/*
* dat.c - NILFS disk address translation.
*
* Copyright (C) 2006-2008 Nippon Telegraph and Telephone Corporation.
*
* Written by Koji Sato.
*/
#include <linux/types.h>
#include <linux/buffer_head.h>
#include <linux/string.h>
#include <linux/errno.h>
#include "nilfs.h"
#include "mdt.h"
#include "alloc.h"
#include "dat.h"
#define NILFS_CNO_MIN ((__u64)1)
#define NILFS_CNO_MAX (~(__u64)0)
/**
* struct nilfs_dat_info - on-memory private data of DAT file
* @mi: on-memory private data of metadata file
* @palloc_cache: persistent object allocator cache of DAT file
* @shadow: shadow map of DAT file
*/
struct nilfs_dat_info {
struct nilfs_mdt_info mi;
struct nilfs_palloc_cache palloc_cache;
struct nilfs_shadow_map shadow;
};
static inline struct nilfs_dat_info *NILFS_DAT_I(struct inode *dat)
{
return (struct nilfs_dat_info *)NILFS_MDT(dat);
}
static int nilfs_dat_prepare_entry(struct inode *dat,
struct nilfs_palloc_req *req, int create)
{
return nilfs_palloc_get_entry_block(dat, req->pr_entry_nr,
create, &req->pr_entry_bh);
}
static void nilfs_dat_commit_entry(struct inode *dat,
struct nilfs_palloc_req *req)
{
mark_buffer_dirty(req->pr_entry_bh);
nilfs_mdt_mark_dirty(dat);
brelse(req->pr_entry_bh);
}
static void nilfs_dat_abort_entry(struct inode *dat,
struct nilfs_palloc_req *req)
{
brelse(req->pr_entry_bh);
}
int nilfs_dat_prepare_alloc(struct inode *dat, struct nilfs_palloc_req *req)
{
int ret;
ret = nilfs_palloc_prepare_alloc_entry(dat, req);
if (ret < 0)
return ret;
ret = nilfs_dat_prepare_entry(dat, req, 1);
if (ret < 0)
nilfs_palloc_abort_alloc_entry(dat, req);
return ret;
}
void nilfs_dat_commit_alloc(struct inode *dat, struct nilfs_palloc_req *req)
{
struct nilfs_dat_entry *entry;
void *kaddr;
kaddr = kmap_atomic(req->pr_entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
entry->de_start = cpu_to_le64(NILFS_CNO_MIN);
entry->de_end = cpu_to_le64(NILFS_CNO_MAX);
entry->de_blocknr = cpu_to_le64(0);
kunmap_atomic(kaddr);
nilfs_palloc_commit_alloc_entry(dat, req);
nilfs_dat_commit_entry(dat, req);
}
void nilfs_dat_abort_alloc(struct inode *dat, struct nilfs_palloc_req *req)
{
nilfs_dat_abort_entry(dat, req);
nilfs_palloc_abort_alloc_entry(dat, req);
}
static void nilfs_dat_commit_free(struct inode *dat,
struct nilfs_palloc_req *req)
{
struct nilfs_dat_entry *entry;
void *kaddr;
kaddr = kmap_atomic(req->pr_entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
entry->de_start = cpu_to_le64(NILFS_CNO_MIN);
entry->de_end = cpu_to_le64(NILFS_CNO_MIN);
entry->de_blocknr = cpu_to_le64(0);
kunmap_atomic(kaddr);
nilfs_dat_commit_entry(dat, req);
nilfs_palloc_commit_free_entry(dat, req);
}
int nilfs_dat_prepare_start(struct inode *dat, struct nilfs_palloc_req *req)
{
int ret;
ret = nilfs_dat_prepare_entry(dat, req, 0);
WARN_ON(ret == -ENOENT);
return ret;
}
void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
sector_t blocknr)
{
struct nilfs_dat_entry *entry;
void *kaddr;
kaddr = kmap_atomic(req->pr_entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat));
entry->de_blocknr = cpu_to_le64(blocknr);
kunmap_atomic(kaddr);
nilfs_dat_commit_entry(dat, req);
}
int nilfs_dat_prepare_end(struct inode *dat, struct nilfs_palloc_req *req)
{
struct nilfs_dat_entry *entry;
sector_t blocknr;
void *kaddr;
int ret;
ret = nilfs_dat_prepare_entry(dat, req, 0);
if (ret < 0) {
WARN_ON(ret == -ENOENT);
return ret;
}
kaddr = kmap_atomic(req->pr_entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
blocknr = le64_to_cpu(entry->de_blocknr);
kunmap_atomic(kaddr);
if (blocknr == 0) {
ret = nilfs_palloc_prepare_free_entry(dat, req);
if (ret < 0) {
nilfs_dat_abort_entry(dat, req);
return ret;
}
}
return 0;
}
void nilfs_dat_commit_end(struct inode *dat, struct nilfs_palloc_req *req,
int dead)
{
struct nilfs_dat_entry *entry;
__u64 start, end;
sector_t blocknr;
void *kaddr;
kaddr = kmap_atomic(req->pr_entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
end = start = le64_to_cpu(entry->de_start);
if (!dead) {
end = nilfs_mdt_cno(dat);
WARN_ON(start > end);
}
entry->de_end = cpu_to_le64(end);
blocknr = le64_to_cpu(entry->de_blocknr);
kunmap_atomic(kaddr);
if (blocknr == 0)
nilfs_dat_commit_free(dat, req);
else
nilfs_dat_commit_entry(dat, req);
}
void nilfs_dat_abort_end(struct inode *dat, struct nilfs_palloc_req *req)
{
struct nilfs_dat_entry *entry;
__u64 start;
sector_t blocknr;
void *kaddr;
kaddr = kmap_atomic(req->pr_entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
start = le64_to_cpu(entry->de_start);
blocknr = le64_to_cpu(entry->de_blocknr);
kunmap_atomic(kaddr);
if (start == nilfs_mdt_cno(dat) && blocknr == 0)
nilfs_palloc_abort_free_entry(dat, req);
nilfs_dat_abort_entry(dat, req);
}
int nilfs_dat_prepare_update(struct inode *dat,
struct nilfs_palloc_req *oldreq,
struct nilfs_palloc_req *newreq)
{
int ret;
ret = nilfs_dat_prepare_end(dat, oldreq);
if (!ret) {
ret = nilfs_dat_prepare_alloc(dat, newreq);
if (ret < 0)
nilfs_dat_abort_end(dat, oldreq);
}
return ret;
}
void nilfs_dat_commit_update(struct inode *dat,
struct nilfs_palloc_req *oldreq,
struct nilfs_palloc_req *newreq, int dead)
{
nilfs_dat_commit_end(dat, oldreq, dead);
nilfs_dat_commit_alloc(dat, newreq);
}
void nilfs_dat_abort_update(struct inode *dat,
struct nilfs_palloc_req *oldreq,
struct nilfs_palloc_req *newreq)
{
nilfs_dat_abort_end(dat, oldreq);
nilfs_dat_abort_alloc(dat, newreq);
}
/**
* nilfs_dat_mark_dirty -
* @dat: DAT file inode
* @vblocknr: virtual block number
*
* Description:
*
* Return Value: On success, 0 is returned. On error, one of the following
* negative error codes is returned.
*
* %-EIO - I/O error.
*
* %-ENOMEM - Insufficient amount of memory available.
*/
int nilfs_dat_mark_dirty(struct inode *dat, __u64 vblocknr)
{
struct nilfs_palloc_req req;
int ret;
req.pr_entry_nr = vblocknr;
ret = nilfs_dat_prepare_entry(dat, &req, 0);
if (ret == 0)
nilfs_dat_commit_entry(dat, &req);
return ret;
}
/**
* nilfs_dat_freev - free virtual block numbers
* @dat: DAT file inode
* @vblocknrs: array of virtual block numbers
* @nitems: number of virtual block numbers
*
* Description: nilfs_dat_freev() frees the virtual block numbers specified by
* @vblocknrs and @nitems.
*
* Return Value: On success, 0 is returned. On error, one of the following
* negative error codes is returned.
*
* %-EIO - I/O error.
*
* %-ENOMEM - Insufficient amount of memory available.
*
* %-ENOENT - The virtual block number have not been allocated.
*/
int nilfs_dat_freev(struct inode *dat, __u64 *vblocknrs, size_t nitems)
{
return nilfs_palloc_freev(dat, vblocknrs, nitems);
}
/**
* nilfs_dat_move - change a block number
* @dat: DAT file inode
* @vblocknr: virtual block number
* @blocknr: block number
*
* Description: nilfs_dat_move() changes the block number associated with
* @vblocknr to @blocknr.
*
* Return Value: On success, 0 is returned. On error, one of the following
* negative error codes is returned.
*
* %-EIO - I/O error.
*
* %-ENOMEM - Insufficient amount of memory available.
*/
int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
{
struct buffer_head *entry_bh;
struct nilfs_dat_entry *entry;
void *kaddr;
int ret;
ret = nilfs_palloc_get_entry_block(dat, vblocknr, 0, &entry_bh);
if (ret < 0)
return ret;
/*
* The given disk block number (blocknr) is not yet written to
* the device at this point.
*
* To prevent nilfs_dat_translate() from returning the
* uncommitted block number, this makes a copy of the entry
* buffer and redirects nilfs_dat_translate() to the copy.
*/
if (!buffer_nilfs_redirected(entry_bh)) {
ret = nilfs_mdt_freeze_buffer(dat, entry_bh);
if (ret) {
brelse(entry_bh);
return ret;
}
}
kaddr = kmap_atomic(entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
if (unlikely(entry->de_blocknr == cpu_to_le64(0))) {
nilfs_msg(dat->i_sb, KERN_CRIT,
"%s: invalid vblocknr = %llu, [%llu, %llu)",
__func__, (unsigned long long)vblocknr,
(unsigned long long)le64_to_cpu(entry->de_start),
(unsigned long long)le64_to_cpu(entry->de_end));
kunmap_atomic(kaddr);
brelse(entry_bh);
return -EINVAL;
}
WARN_ON(blocknr == 0);
entry->de_blocknr = cpu_to_le64(blocknr);
kunmap_atomic(kaddr);
mark_buffer_dirty(entry_bh);
nilfs_mdt_mark_dirty(dat);
brelse(entry_bh);
return 0;
}
/**
* nilfs_dat_translate - translate a virtual block number to a block number
* @dat: DAT file inode
* @vblocknr: virtual block number
* @blocknrp: pointer to a block number
*
* Description: nilfs_dat_translate() maps the virtual block number @vblocknr
* to the corresponding block number.
*
* Return Value: On success, 0 is returned and the block number associated
* with @vblocknr is stored in the place pointed by @blocknrp. On error, one
* of the following negative error codes is returned.
*
* %-EIO - I/O error.
*
* %-ENOMEM - Insufficient amount of memory available.
*
* %-ENOENT - A block number associated with @vblocknr does not exist.
*/
int nilfs_dat_translate(struct inode *dat, __u64 vblocknr, sector_t *blocknrp)
{
struct buffer_head *entry_bh, *bh;
struct nilfs_dat_entry *entry;
sector_t blocknr;
void *kaddr;
int ret;
ret = nilfs_palloc_get_entry_block(dat, vblocknr, 0, &entry_bh);
if (ret < 0)
return ret;
if (!nilfs_doing_gc() && buffer_nilfs_redirected(entry_bh)) {
bh = nilfs_mdt_get_frozen_buffer(dat, entry_bh);
if (bh) {
WARN_ON(!buffer_uptodate(bh));
brelse(entry_bh);
entry_bh = bh;
}
}
kaddr = kmap_atomic(entry_bh->b_page);
entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
blocknr = le64_to_cpu(entry->de_blocknr);
if (blocknr == 0) {
ret = -ENOENT;
goto out;
}
*blocknrp = blocknr;
out:
kunmap_atomic(kaddr);
brelse(entry_bh);
return ret;
}
ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned int visz,
size_t nvi)
{
struct buffer_head *entry_bh;
struct nilfs_dat_entry *entry;
struct nilfs_vinfo *vinfo = buf;
__u64 first, last;
void *kaddr;
unsigned long entries_per_block = NILFS_MDT(dat)->mi_entries_per_block;
int i, j, n, ret;
for (i = 0; i < nvi; i += n) {
ret = nilfs_palloc_get_entry_block(dat, vinfo->vi_vblocknr,
0, &entry_bh);
if (ret < 0)
return ret;
kaddr = kmap_atomic(entry_bh->b_page);
/* last virtual block number in this block */
first = vinfo->vi_vblocknr;
do_div(first, entries_per_block);
first *= entries_per_block;
last = first + entries_per_block - 1;
for (j = i, n = 0;
j < nvi && vinfo->vi_vblocknr >= first &&
vinfo->vi_vblocknr <= last;
j++, n++, vinfo = (void *)vinfo + visz) {
entry = nilfs_palloc_block_get_entry(
dat, vinfo->vi_vblocknr, entry_bh, kaddr);
vinfo->vi_start = le64_to_cpu(entry->de_start);
vinfo->vi_end = le64_to_cpu(entry->de_end);
vinfo->vi_blocknr = le64_to_cpu(entry->de_blocknr);
}
kunmap_atomic(kaddr);
brelse(entry_bh);
}
return nvi;
}
/**
* nilfs_dat_read - read or get dat inode
* @sb: super block instance
* @entry_size: size of a dat entry
* @raw_inode: on-disk dat inode
* @inodep: buffer to store the inode
*/
int nilfs_dat_read(struct super_block *sb, size_t entry_size,
struct nilfs_inode *raw_inode, struct inode **inodep)
{
static struct lock_class_key dat_lock_key;
struct inode *dat;
struct nilfs_dat_info *di;
int err;
if (entry_size > sb->s_blocksize) {
nilfs_msg(sb, KERN_ERR, "too large DAT entry size: %zu bytes",
entry_size);
return -EINVAL;
} else if (entry_size < NILFS_MIN_DAT_ENTRY_SIZE) {
nilfs_msg(sb, KERN_ERR, "too small DAT entry size: %zu bytes",
entry_size);
return -EINVAL;
}
dat = nilfs_iget_locked(sb, NULL, NILFS_DAT_INO);
if (unlikely(!dat))
return -ENOMEM;
if (!(dat->i_state & I_NEW))
goto out;
err = nilfs_mdt_init(dat, NILFS_MDT_GFP, sizeof(*di));
if (err)
goto failed;
err = nilfs_palloc_init_blockgroup(dat, entry_size);
if (err)
goto failed;
di = NILFS_DAT_I(dat);
lockdep_set_class(&di->mi.mi_sem, &dat_lock_key);
nilfs_palloc_setup_cache(dat, &di->palloc_cache);
nilfs_mdt_setup_shadow_map(dat, &di->shadow);
err = nilfs_read_inode_common(dat, raw_inode);
if (err)
goto failed;
unlock_new_inode(dat);
out:
*inodep = dat;
return 0;
failed:
iget_failed(dat);
return err;
}
| {
"pile_set_name": "Github"
} |
/**
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
#ifndef __PATCHWIZ_H__
#define __PATCHWIZ_H__
#include <winapifamily.h>
#include <_mingw_unicode.h>
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
#include <windows.h>
#include <ole2.h>
#include <strsafe.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef _cplusplus
extern "C" {
#endif
UINT WINAPI UiCreatePatchPackageA (LPCSTR szPcpPath, LPCSTR szPatchPath, LPCSTR szLogPath, HWND hwndStatus, LPCSTR szTempFolder, WINBOOL fRemoveTempFolderIfPresent);
UINT WINAPI UiCreatePatchPackageW (LPCWSTR szPcpPath, LPCWSTR szPatchPath, LPCWSTR szLogPath, HWND hwndStatus, LPCWSTR szTempFolder, WINBOOL fRemoveTempFolderIfPresent);
UINT WINAPI UiCreatePatchPackageExA (LPCSTR szPcpPath, LPCSTR szPatchPath, LPCSTR szLogPath, HWND hwndStatus, LPCSTR szTempFolder, WINBOOL fRemoveTempFolderIfPresent, DWORD dwFlags, DWORD dwReserved);
UINT WINAPI UiCreatePatchPackageExW (LPCWSTR szPcpPath, LPCWSTR szPatchPath, LPCWSTR szLogPath, HWND hwndStatus, LPCWSTR szTempFolder, WINBOOL fRemoveTempFolderIfPresent, DWORD dwFlags, DWORD dwReserved);
#ifdef _cplusplus
}
#endif
const int cchMaxInteger = 12;
const UINT LOGNONE = 0x00000000;
const UINT LOGINFO = 0x00000001;
const UINT LOGWARN = 0x00000002;
const UINT LOGERR = 0x00000004;
const UINT LOGPERFMESSAGES = 0x00000008;
const UINT LOGALL = LOGINFO | LOGWARN | LOGERR | LOGPERFMESSAGES;
const UINT UINONE = 0x00000000;
const UINT UILOGBITS = 15;
const UINT UIALL = 1 << UILOGBITS;
const UINT DEFAULT_MINIMUM_REQUIRED_MSI_VERSION = 100;
const UINT DEFAULT_FILE_SEQUENCE_START = 2;
const UINT DEFAULT_DISK_ID = 2;
#define ERROR_PCW_BASE 0xc00e5101
#define ERROR_PCW_PCP_DOESNT_EXIST (ERROR_PCW_BASE + 0x00)
#define ERROR_PCW_PCP_BAD_FORMAT (ERROR_PCW_BASE + 0x01)
#define ERROR_PCW_CANT_CREATE_TEMP_FOLDER (ERROR_PCW_BASE + 0x02)
#define ERROR_PCW_MISSING_PATCH_PATH (ERROR_PCW_BASE + 0x03)
#define ERROR_PCW_CANT_OVERWRITE_PATCH (ERROR_PCW_BASE + 0x04)
#define ERROR_PCW_CANT_CREATE_PATCH_FILE (ERROR_PCW_BASE + 0x05)
#define ERROR_PCW_MISSING_PATCH_GUID (ERROR_PCW_BASE + 0x06)
#define ERROR_PCW_BAD_PATCH_GUID (ERROR_PCW_BASE + 0x07)
#define ERROR_PCW_BAD_GUIDS_TO_REPLACE (ERROR_PCW_BASE + 0x08)
#define ERROR_PCW_BAD_TARGET_PRODUCT_CODE_LIST (ERROR_PCW_BASE + 0x09)
#define ERROR_PCW_NO_UPGRADED_IMAGES_TO_PATCH (ERROR_PCW_BASE + 0x0a)
#define ERROR_PCW_BAD_API_PATCHING_SYMBOL_FLAGS (ERROR_PCW_BASE + 0x0c)
#define ERROR_PCW_OODS_COPYING_MSI (ERROR_PCW_BASE + 0x0d)
#define ERROR_PCW_UPGRADED_IMAGE_NAME_TOO_LONG (ERROR_PCW_BASE + 0x0e)
#define ERROR_PCW_BAD_UPGRADED_IMAGE_NAME (ERROR_PCW_BASE + 0x0f)
#define ERROR_PCW_DUP_UPGRADED_IMAGE_NAME (ERROR_PCW_BASE + 0x10)
#define ERROR_PCW_UPGRADED_IMAGE_PATH_TOO_LONG (ERROR_PCW_BASE + 0x11)
#define ERROR_PCW_UPGRADED_IMAGE_PATH_EMPTY (ERROR_PCW_BASE + 0x12)
#define ERROR_PCW_UPGRADED_IMAGE_PATH_NOT_EXIST (ERROR_PCW_BASE + 0x13)
#define ERROR_PCW_UPGRADED_IMAGE_PATH_NOT_MSI (ERROR_PCW_BASE + 0x14)
#define ERROR_PCW_UPGRADED_IMAGE_COMPRESSED (ERROR_PCW_BASE + 0x15)
#define ERROR_PCW_TARGET_IMAGE_NAME_TOO_LONG (ERROR_PCW_BASE + 0x16)
#define ERROR_PCW_BAD_TARGET_IMAGE_NAME (ERROR_PCW_BASE + 0x17)
#define ERROR_PCW_DUP_TARGET_IMAGE_NAME (ERROR_PCW_BASE + 0x18)
#define ERROR_PCW_TARGET_IMAGE_PATH_TOO_LONG (ERROR_PCW_BASE + 0x19)
#define ERROR_PCW_TARGET_IMAGE_PATH_EMPTY (ERROR_PCW_BASE + 0x1a)
#define ERROR_PCW_TARGET_IMAGE_PATH_NOT_EXIST (ERROR_PCW_BASE + 0x1b)
#define ERROR_PCW_TARGET_IMAGE_PATH_NOT_MSI (ERROR_PCW_BASE + 0x1c)
#define ERROR_PCW_TARGET_IMAGE_COMPRESSED (ERROR_PCW_BASE + 0x1d)
#define ERROR_PCW_TARGET_BAD_PROD_VALIDATE (ERROR_PCW_BASE + 0x1e)
#define ERROR_PCW_TARGET_BAD_PROD_CODE_VAL (ERROR_PCW_BASE + 0x1f)
#define ERROR_PCW_UPGRADED_MISSING_SRC_FILES (ERROR_PCW_BASE + 0x20)
#define ERROR_PCW_TARGET_MISSING_SRC_FILES (ERROR_PCW_BASE + 0x21)
#define ERROR_PCW_IMAGE_FAMILY_NAME_TOO_LONG (ERROR_PCW_BASE + 0x22)
#define ERROR_PCW_BAD_IMAGE_FAMILY_NAME (ERROR_PCW_BASE + 0x23)
#define ERROR_PCW_DUP_IMAGE_FAMILY_NAME (ERROR_PCW_BASE + 0x24)
#define ERROR_PCW_BAD_IMAGE_FAMILY_SRC_PROP (ERROR_PCW_BASE + 0x25)
#define ERROR_PCW_UFILEDATA_LONG_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x26)
#define ERROR_PCW_UFILEDATA_BLANK_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x27)
#define ERROR_PCW_UFILEDATA_MISSING_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x28)
#define ERROR_PCW_EXTFILE_LONG_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x29)
#define ERROR_PCW_EXTFILE_BLANK_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x2a)
#define ERROR_PCW_EXTFILE_BAD_FAMILY_FIELD (ERROR_PCW_BASE + 0x2b)
#define ERROR_PCW_EXTFILE_LONG_PATH_TO_FILE (ERROR_PCW_BASE + 0x2c)
#define ERROR_PCW_EXTFILE_BLANK_PATH_TO_FILE (ERROR_PCW_BASE + 0x2d)
#define ERROR_PCW_EXTFILE_MISSING_FILE (ERROR_PCW_BASE + 0x2e)
#define ERROR_PCW_BAD_FILE_SEQUENCE_START (ERROR_PCW_BASE + 0x39)
#define ERROR_PCW_CANT_COPY_FILE_TO_TEMP_FOLDER (ERROR_PCW_BASE + 0x3a)
#define ERROR_PCW_CANT_CREATE_ONE_PATCH_FILE (ERROR_PCW_BASE + 0x3b)
#define ERROR_PCW_BAD_IMAGE_FAMILY_DISKID (ERROR_PCW_BASE + 0x3c)
#define ERROR_PCW_BAD_IMAGE_FAMILY_FILESEQSTART (ERROR_PCW_BASE + 0x3d)
#define ERROR_PCW_BAD_UPGRADED_IMAGE_FAMILY (ERROR_PCW_BASE + 0x3e)
#define ERROR_PCW_BAD_TARGET_IMAGE_UPGRADED (ERROR_PCW_BASE + 0x3f)
#define ERROR_PCW_DUP_TARGET_IMAGE_PACKCODE (ERROR_PCW_BASE + 0x40)
#define ERROR_PCW_UFILEDATA_BAD_UPGRADED_FIELD (ERROR_PCW_BASE + 0x41)
#define ERROR_PCW_MISMATCHED_PRODUCT_CODES (ERROR_PCW_BASE + 0x42)
#define ERROR_PCW_MISMATCHED_PRODUCT_VERSIONS (ERROR_PCW_BASE + 0x43)
#define ERROR_PCW_CANNOT_WRITE_DDF (ERROR_PCW_BASE + 0x44)
#define ERROR_PCW_CANNOT_RUN_MAKECAB (ERROR_PCW_BASE + 0x45)
#define ERROR_PCW_WRITE_SUMMARY_PROPERTIES (ERROR_PCW_BASE + 0x4a)
#define ERROR_PCW_TFILEDATA_LONG_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x4b)
#define ERROR_PCW_TFILEDATA_BLANK_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x4c)
#define ERROR_PCW_TFILEDATA_MISSING_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x4d)
#define ERROR_PCW_TFILEDATA_BAD_TARGET_FIELD (ERROR_PCW_BASE + 0x4e)
#define ERROR_PCW_UPGRADED_IMAGE_PATCH_PATH_TOO_LONG (ERROR_PCW_BASE + 0x4f)
#define ERROR_PCW_UPGRADED_IMAGE_PATCH_PATH_NOT_EXIST (ERROR_PCW_BASE + 0x50)
#define ERROR_PCW_UPGRADED_IMAGE_PATCH_PATH_NOT_MSI (ERROR_PCW_BASE + 0x51)
#define ERROR_PCW_DUP_UPGRADED_IMAGE_PACKCODE (ERROR_PCW_BASE + 0x52)
#define ERROR_PCW_UFILEIGNORE_BAD_UPGRADED_FIELD (ERROR_PCW_BASE + 0x53)
#define ERROR_PCW_UFILEIGNORE_LONG_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x54)
#define ERROR_PCW_UFILEIGNORE_BLANK_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x55)
#define ERROR_PCW_UFILEIGNORE_BAD_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x56)
#define ERROR_PCW_FAMILY_RANGE_NAME_TOO_LONG (ERROR_PCW_BASE + 0x57)
#define ERROR_PCW_BAD_FAMILY_RANGE_NAME (ERROR_PCW_BASE + 0x58)
#define ERROR_PCW_FAMILY_RANGE_LONG_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x59)
#define ERROR_PCW_FAMILY_RANGE_BLANK_FILE_TABLE_KEY (ERROR_PCW_BASE + 0x5a)
#define ERROR_PCW_FAMILY_RANGE_LONG_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x5b)
#define ERROR_PCW_FAMILY_RANGE_BLANK_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x5c)
#define ERROR_PCW_FAMILY_RANGE_BAD_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x5d)
#define ERROR_PCW_FAMILY_RANGE_LONG_RETAIN_LENGTHS (ERROR_PCW_BASE + 0x5e)
#define ERROR_PCW_FAMILY_RANGE_BLANK_RETAIN_LENGTHS (ERROR_PCW_BASE + 0x5f)
#define ERROR_PCW_FAMILY_RANGE_BAD_RETAIN_LENGTHS (ERROR_PCW_BASE + 0x60)
#define ERROR_PCW_FAMILY_RANGE_COUNT_MISMATCH (ERROR_PCW_BASE + 0x61)
#define ERROR_PCW_EXTFILE_LONG_IGNORE_OFFSETS (ERROR_PCW_BASE + 0x62)
#define ERROR_PCW_EXTFILE_BAD_IGNORE_OFFSETS (ERROR_PCW_BASE + 0x63)
#define ERROR_PCW_EXTFILE_LONG_IGNORE_LENGTHS (ERROR_PCW_BASE + 0x64)
#define ERROR_PCW_EXTFILE_BAD_IGNORE_LENGTHS (ERROR_PCW_BASE + 0x65)
#define ERROR_PCW_EXTFILE_IGNORE_COUNT_MISMATCH (ERROR_PCW_BASE + 0x66)
#define ERROR_PCW_EXTFILE_LONG_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x67)
#define ERROR_PCW_EXTFILE_BAD_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x68)
#define ERROR_PCW_TFILEDATA_LONG_IGNORE_OFFSETS (ERROR_PCW_BASE + 0x6a)
#define ERROR_PCW_TFILEDATA_BAD_IGNORE_OFFSETS (ERROR_PCW_BASE + 0x6b)
#define ERROR_PCW_TFILEDATA_LONG_IGNORE_LENGTHS (ERROR_PCW_BASE + 0x6c)
#define ERROR_PCW_TFILEDATA_BAD_IGNORE_LENGTHS (ERROR_PCW_BASE + 0x6d)
#define ERROR_PCW_TFILEDATA_IGNORE_COUNT_MISMATCH (ERROR_PCW_BASE + 0x6e)
#define ERROR_PCW_TFILEDATA_LONG_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x6f)
#define ERROR_PCW_TFILEDATA_BAD_RETAIN_OFFSETS (ERROR_PCW_BASE + 0x70)
#define ERROR_PCW_CANT_GENERATE_TRANSFORM (ERROR_PCW_BASE + 0x72)
#define ERROR_PCW_CANT_CREATE_SUMMARY_INFO (ERROR_PCW_BASE + 0x73)
#define ERROR_PCW_CANT_GENERATE_TRANSFORM_POUND (ERROR_PCW_BASE + 0x74)
#define ERROR_PCW_CANT_CREATE_SUMMARY_INFO_POUND (ERROR_PCW_BASE + 0x75)
#define ERROR_PCW_BAD_UPGRADED_IMAGE_PRODUCT_CODE (ERROR_PCW_BASE + 0x76)
#define ERROR_PCW_BAD_UPGRADED_IMAGE_PRODUCT_VERSION (ERROR_PCW_BASE + 0x77)
#define ERROR_PCW_BAD_UPGRADED_IMAGE_UPGRADE_CODE (ERROR_PCW_BASE + 0x78)
#define ERROR_PCW_BAD_TARGET_IMAGE_PRODUCT_CODE (ERROR_PCW_BASE + 0x79)
#define ERROR_PCW_BAD_TARGET_IMAGE_PRODUCT_VERSION (ERROR_PCW_BASE + 0x7a)
#define ERROR_PCW_BAD_TARGET_IMAGE_UPGRADE_CODE (ERROR_PCW_BASE + 0x7b)
#define ERROR_PCW_MATCHED_PRODUCT_VERSIONS (ERROR_PCW_BASE + 0x7c)
#define ERROR_PCW_OBSOLETION_WITH_SEQUENCE_DATA (ERROR_PCW_BASE + 0x7d)
#define ERROR_PCW_OBSOLETION_WITH_MSI30 (ERROR_PCW_BASE + 0x7e)
#define ERROR_PCW_OBSOLETION_WITH_PATCHSEQUENCE (ERROR_PCW_BASE + 0x7f)
#define ERROR_PCW_CANNOT_CREATE_TABLE (ERROR_PCW_BASE + 0x80)
#define ERROR_PCW_CANT_GENERATE_SEQUENCEINFO_MAJORUPGD (ERROR_PCW_BASE + 0x81)
#define ERROR_PCW_MAJOR_UPGD_WITHOUT_SEQUENCING (ERROR_PCW_BASE + 0x82)
#define ERROR_PCW_BAD_PRODUCTVERSION_VALIDATION (ERROR_PCW_BASE + 0x83)
#define ERROR_PCW_BAD_TRANSFORMSET (ERROR_PCW_BASE + 0x84)
#define ERROR_PCW_BAD_TGT_UPD_IMAGES (ERROR_PCW_BASE + 0x85)
#define ERROR_PCW_BAD_SUPERCEDENCE (ERROR_PCW_BASE + 0x86)
#define ERROR_PCW_BAD_SEQUENCE (ERROR_PCW_BASE + 0x87)
#define ERROR_PCW_BAD_TARGET (ERROR_PCW_BASE + 0x88)
#define ERROR_PCW_NULL_PATCHFAMILY (ERROR_PCW_BASE + 0x89)
#define ERROR_PCW_NULL_SEQUENCE_NUMBER (ERROR_PCW_BASE + 0x8a)
#define ERROR_PCW_BAD_VERSION_STRING (ERROR_PCW_BASE + 0x8b)
#define ERROR_PCW_BAD_MAJOR_VERSION (ERROR_PCW_BASE + 0x8c)
#define ERROR_PCW_SEQUENCING_BAD_TARGET (ERROR_PCW_BASE + 0x8d)
#define ERROR_PCW_PATCHMETADATA_PROP_NOT_SET (ERROR_PCW_BASE + 0x8e)
#define ERROR_PCW_INVALID_PATCHMETADATA_PROP (ERROR_PCW_BASE + 0x8f)
#define ERROR_PCW_INVALID_SUPERCEDENCE (ERROR_PCW_BASE + 0x90)
#define ERROR_PCW_DUPLICATE_SEQUENCE_RECORD (ERROR_PCW_BASE + 0x91)
#define ERROR_PCW_WRONG_PATCHMETADATA_STRD_PROP (ERROR_PCW_BASE + 0x92)
#define ERROR_PCW_INVALID_PARAMETER (ERROR_PCW_BASE + 0x93)
#define ERROR_PCW_CREATEFILE_LOG_FAILED (ERROR_PCW_BASE + 0x94)
#define ERROR_PCW_INVALID_LOG_LEVEL (ERROR_PCW_BASE + 0x95)
#define ERROR_PCW_INVALID_UI_LEVEL (ERROR_PCW_BASE + 0x96)
#define ERROR_PCW_ERROR_WRITING_TO_LOG (ERROR_PCW_BASE + 0x97)
#define ERROR_PCW_OUT_OF_MEMORY (ERROR_PCW_BASE + 0x98)
#define ERROR_PCW_UNKNOWN_ERROR (ERROR_PCW_BASE + 0x99)
#define ERROR_PCW_UNKNOWN_INFO (ERROR_PCW_BASE + 0x9a)
#define ERROR_PCW_UNKNOWN_WARN (ERROR_PCW_BASE + 0x9b)
#define ERROR_PCW_OPEN_VIEW (ERROR_PCW_BASE + 0x9c)
#define ERROR_PCW_EXECUTE_VIEW (ERROR_PCW_BASE + 0x9d)
#define ERROR_PCW_VIEW_FETCH (ERROR_PCW_BASE + 0x9e)
#define ERROR_PCW_FAILED_EXPAND_PATH (ERROR_PCW_BASE + 0x9f)
#define ERROR_PCW_INTERNAL_ERROR (ERROR_PCW_BASE + 0x100)
#define ERROR_PCW_INVALID_PCP_PROPERTY (ERROR_PCW_BASE + 0x101)
#define ERROR_PCW_INVALID_PCP_TARGETIMAGES (ERROR_PCW_BASE + 0x102)
#define ERROR_PCW_LAX_VALIDATION_FLAGS (ERROR_PCW_BASE + 0x103)
#define ERROR_PCW_FAILED_CREATE_TRANSFORM (ERROR_PCW_BASE + 0x104)
#define ERROR_PCW_CANT_DELETE_TEMP_FOLDER (ERROR_PCW_BASE + 0x105)
#define ERROR_PCW_MISSING_DIRECTORY_TABLE (ERROR_PCW_BASE + 0x106)
#define ERROR_PCW_INVALID_SUPERSEDENCE_VALUE (ERROR_PCW_BASE + 0x107)
#define ERROR_PCW_INVALID_PATCH_TYPE_SEQUENCING (ERROR_PCW_BASE + 0x108)
#define ERROR_PCW_CANT_READ_FILE (ERROR_PCW_BASE + 0x109)
#define ERROR_PCW_TARGET_WRONG_PRODUCT_VERSION_COMP (ERROR_PCW_BASE + 0x10a)
#define ERROR_PCW_INVALID_PCP_UPGRADEDFILESTOIGNORE (ERROR_PCW_BASE + 0x10b)
#define ERROR_PCW_INVALID_PCP_UPGRADEDIMAGES (ERROR_PCW_BASE + 0x10c)
#define ERROR_PCW_INVALID_PCP_EXTERNALFILES (ERROR_PCW_BASE + 0x10d)
#define ERROR_PCW_INVALID_PCP_IMAGEFAMILIES (ERROR_PCW_BASE + 0x10e)
#define ERROR_PCW_INVALID_PCP_PATCHSEQUENCE (ERROR_PCW_BASE + 0x10f)
#define ERROR_PCW_INVALID_PCP_TARGETFILES_OPTIONALDATA (ERROR_PCW_BASE + 0x110)
#define ERROR_PCW_INVALID_PCP_UPGRADEDFILES_OPTIONALDATA (ERROR_PCW_BASE + 0x111)
#define ERROR_PCW_MISSING_PATCHMETADATA (ERROR_PCW_BASE + 0x112)
#define ERROR_PCW_IMAGE_PATH_NOT_EXIST (ERROR_PCW_BASE + 0x113)
#define ERROR_PCW_INVALID_RANGE_ELEMENT (ERROR_PCW_BASE + 0x114)
#define ERROR_PCW_INVALID_MAJOR_VERSION (ERROR_PCW_BASE + 0x115)
#define ERROR_PCW_INVALID_PCP_PROPERTIES (ERROR_PCW_BASE + 0x116)
#define ERROR_PCW_INVALID_PCP_FAMILYFILERANGES (ERROR_PCW_BASE + 0x117)
#define INFO_BASE 0xc00f5101
#define INFO_PASSED_MAIN_CONTROL (INFO_BASE + 0x00)
#define INFO_ENTERING_PHASE_I_VALIDATION (INFO_BASE + 0x01)
#define INFO_ENTERING_PHASE_I (INFO_BASE + 0x02)
#define INFO_PCP_PATH (INFO_BASE + 0x03)
#define INFO_TEMP_DIR (INFO_BASE + 0x04)
#define INFO_SET_OPTIONS (INFO_BASE + 0x05)
#define INFO_PROPERTY (INFO_BASE + 0x06)
#define INFO_ENTERING_PHASE_II (INFO_BASE + 0x07)
#define INFO_ENTERING_PHASE_III (INFO_BASE + 0x08)
#define INFO_ENTERING_PHASE_IV (INFO_BASE + 0x09)
#define INFO_ENTERING_PHASE_V (INFO_BASE + 0x0a)
#define INFO_GENERATING_METADATA (INFO_BASE + 0x10)
#define INFO_TEMP_DIR_CLEANUP (INFO_BASE + 0x11)
#define INFO_PATCHCACHE_FILEINFO_FAILURE (INFO_BASE + 0x12)
#define INFO_PATCHCACHE_PCI_READFAILURE (INFO_BASE + 0x13)
#define INFO_PATCHCACHE_PCI_WRITEFAILURE (INFO_BASE + 0x14)
#define INFO_USING_USER_MSI_FOR_PATCH_TABLES (INFO_BASE + 0x15)
#define INFO_SUCCESSFUL_PATCH_CREATION (INFO_BASE + 0x16)
#define WARN_BASE 0xc0105101
#define WARN_MAJOR_UPGRADE_PATCH (WARN_BASE + 0x00)
#define WARN_SEQUENCE_DATA_GENERATION_DISABLED (WARN_BASE + 0x01)
#define WARN_SEQUENCE_DATA_SUPERSEDENCE_IGNORED (WARN_BASE + 0x02)
#define WARN_IMPROPER_TRANSFORM_VALIDATION (WARN_BASE + 0x03)
#define WARN_PCW_MISMATCHED_PRODUCT_CODES (WARN_BASE + 0x04)
#define WARN_PCW_MISMATCHED_PRODUCT_VERSIONS (WARN_BASE + 0x05)
#define WARN_INVALID_TRANSFORM_VALIDATION (WARN_BASE + 0x06)
#define WARN_BAD_MAJOR_VERSION (WARN_BASE + 0x07)
#define WARN_FILE_VERSION_DOWNREV (WARN_BASE + 0x08)
#define WARN_EQUAL_FILE_VERSION (WARN_BASE + 0x09)
#define WARN_PATCHPROPERTYNOTSET (WARN_BASE + 0x0a)
#define WARN_OBSOLETION_WITH_SEQUENCE_DATA (WARN_BASE + 0x11)
#define WARN_OBSOLETION_WITH_MSI30 (WARN_BASE + 0x10)
#define WARN_OBSOLETION_WITH_PATCHSEQUENCE (WARN_BASE + 0x12)
#define UiCreatePatchPackage __MINGW_NAME_AW(UiCreatePatchPackage)
#define UiCreatePatchPackageEx __MINGW_NAME_AW(UiCreatePatchPackageEx)
#endif
#endif
| {
"pile_set_name": "Github"
} |
import Distribution.Simple
main = defaultMain
| {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: arena01_tower001_crystal_d
m_Shader: {fileID: 10, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Illum:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 060542d2937ed8c449c4d9838c06d258, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _Alpha: 1
- _BumpScale: 1
- _Cutoff: 0.37
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Emission: 1
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Shininess: 0.3
- _Specular: 0.01
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.5019608, g: 0.5019608, b: 0.5019608, a: 0.5019608}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 0.5588235, g: 0.5588235, b: 0.5588235, a: 1}
| {
"pile_set_name": "Github"
} |
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var exists = fs.exists || path.exists;
var test = require('tap').test;
var _0777 = parseInt('0777', 8);
var _0755 = parseInt('0755', 8);
test('implicit mode from umask', function (t) {
t.plan(5);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
var file = '/tmp/' + [x,y,z].join('/');
mkdirp(file, function (err) {
t.ifError(err);
exists(file, function (ex) {
t.ok(ex, 'file created');
fs.stat(file, function (err, stat) {
t.ifError(err);
t.equal(stat.mode & _0777, _0777 & (~process.umask()));
t.ok(stat.isDirectory(), 'target not a directory');
});
})
});
});
| {
"pile_set_name": "Github"
} |
/* eslint-disable import/no-extraneous-dependencies */
import { AppPage } from './app.po';
import 'jasmine';
describe('ng5test App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText() as any).toEqual('Welcome to app!');
});
});
| {
"pile_set_name": "Github"
} |
int32 x = 123
int32 y = 234
int32 z = 345
float32 a= 1.0
float32 b= 2.0
float32 pi = 3.14159
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `ATOMIC_ISIZE_INIT` constant in crate `core`.">
<meta name="keywords" content="rust, rustlang, rust-lang, ATOMIC_ISIZE_INIT">
<title>core::sync::atomic::ATOMIC_ISIZE_INIT - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../../main.css">
<link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<a href='../../../core/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='' width='100'></a>
<p class='location'><a href='../../index.html'>core</a>::<wbr><a href='../index.html'>sync</a>::<wbr><a href='index.html'>atomic</a></p><script>window.sidebarCurrent = {name: 'ATOMIC_ISIZE_INIT', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press ‘S’ to search, ‘?’ for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content constant">
<h1 class='fqn'><span class='in-band'><a href='../../index.html'>core</a>::<wbr><a href='../index.html'>sync</a>::<wbr><a href='index.html'>atomic</a>::<wbr><a class='constant' href=''>ATOMIC_ISIZE_INIT</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-26956' class='srclink' href='../../../src/core/sync/atomic.rs.html#194' title='goto source code'>[src]</a></span></h1>
<pre class='rust const'>pub const ATOMIC_ISIZE_INIT: <a class='struct' href='../../../core/sync/atomic/struct.AtomicIsize.html' title='core::sync::atomic::AtomicIsize'>AtomicIsize</a><code> = </code><code>AtomicIsize::new(0)</code></pre><div class='docblock'><p>An <code>AtomicIsize</code> initialized to <code>0</code>.</p>
</div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../../";
window.currentCrate = "core";
window.playgroundUrl = "https://play.rust-lang.org/";
</script>
<script src="../../../jquery.js"></script>
<script src="../../../main.js"></script>
<script src="../../../playpen.js"></script>
<script defer src="../../../search-index.js"></script>
</body>
</html> | {
"pile_set_name": "Github"
} |
category FileFormat
[[lib:yaml]] のバックエンドライブラリです。libyaml ベースで作成されてお
り、YAML バージョン 1.1 を扱う事ができます。
#@# 上記、libyaml が更新される事があれば、記述の変更をお願いします。
=== 概要
Psych を用いると YAML のパースと出力ができます。
これらの機能は libyaml [[url:http://pyyaml.org/wiki/LibYAML]] を用いて
実装されています。さらに Ruby の大半のオブジェクトと YAML フォーマットの
データの間を相互に変換することができます。
=== 基本的な使いかた
require 'psych'
# YAML のテキストをパースする
Psych.load("--- foo") # => "foo"
# YAML のデータを出力
Psych.dump("foo") # => "--- foo\n...\n"
{ :a => 'b'}.to_yaml # => "---\n:a: b\n"
基本的な使い方はこれだけです。簡単な用事は
[[m:Psych.load]]、[[m:Psych.dump]] で片付きます。
==== YAML のパース
Psych は YAML ドキュメントのパースができます。
ユーザの必要に応じ、高水準な API から低水準な API まで用意されています。
最も低水準なものは、イベントベースな API です。中程度の水準のものとして
YAML の AST(Abstract Syntax Tree)にアクセスする APIがあります。
高水準な API では、YAML のドキュメントを Ruby のオブジェクトに変換する
ことができます。
===== 低水準 パース API
低水準のパース API は利用者が入力となる YAML ドキュメントについて
すでに良く知っていて、AST を構築したり Ruby のオブジェクトに変換する
のが無駄である場合に使います。この API については
[[c:Psych::Parser]] を参照してください。イベントベースの API です。
===== 中水準 パース API
Psych には YAML ドキュメントの AST にアクセスする API があります。
この AST は [[c:Psych::Parser]] と [[c:Psych::TreeBuilder]] で構築します。
[[m:Psych.parse_stream]]、[[c:Psych::Nodes]]、[[c:Psych::Nodes::Node]]
などを経由して AST を解析したり操作したりできます。
===== 高水準 パース API
YAML ドキュメントをパースして Ruby のオブジェクトに変換することができます。
詳しくは [[m:Psych.load]] を見てください。
==== YAML ドキュメントの出力
Psych は YAML ドキュメントを出力する機能があります。
高・中・底の三つの水準の API があります。
低水準 API はイベントベースの API で、中水準のものは AST を構築する API、
高水準の API は Ruby のオブジェクトを直接 YAML ドキュメントに変換する API
です。これはパースの高・中・底水準 API と対応しています。
===== 低水準出力 API
低水準出力 API はイベントベースな仕組みです。
各イベントは [[c:Psych::Emitter]] オブジェクトに送られます。
このオブジェクトには、
各イベントをどのように YAML ドキュメントに変換するかをセットしておきます。
この API は出力フォーマットがあらかじめわかっている場合や性能が重要な
場合に利用します。
詳しくは [[c:Psych::Emitter]] を見てください。
===== 中水準出力 API
中水準 API では、利用者が AST を構築し YAML ドキュメントに変換します。
この AST は YAML ドキュメントをパースして得られるものと同じものです。
詳しくは
[[c:Psych::Nodes]]、[[c:Psych::Nodes::Node]]、[[c:Psych::TreeBuilder]]
を参照してください。
===== 高水準出力 API
高水準 API を使うと Ruby のデータ構造(オブジェクト)を YAML のドキュメントに
変換できます。
詳しくは [[m:Psych.dump]] を参照してください。
= module Psych
[[lib:yaml]] のバックエンドのためのモジュールです。
== Constants
--- VERSION -> String
Psych のバージョン。
--- LIBYAML_VERSION -> String
libyaml のバージョン。
== Class Methods
--- libyaml_version -> [Integer, Integer, Integer]
libyaml のバージョンを返します。
[major, minor patch-level] という 3 つの整数からなる配列を返します。
@see [[m:Psych::LIBYAML_VERSION]]
#@since 2.5.0
--- load(yaml, filename = nil, fallback: false, symbolize_names: false) -> object
#@else
--- load(yaml, filename = nil, fallback = false) -> object
#@end
YAML ドキュメントを Ruby のデータ構造(オブジェクト)に変換します。
入力に複数のドキュメントが含まれている場合は、先頭のものを変換して
返します。
filename はパース中に発生した例外のメッセージに用います。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename [[c:Psych::SyntaxError]] 発生時にファイル名として表示する文字列。
@param fallback 引数 yaml に空のYAMLを指定した場合の戻り値を指定します。デフォルトは false です。
#@since 2.5.0
@param symbolize_names ハッシュ(YAMLの仕様では正確にはマッピング)のキー
を [[c:Symbol]] に変換するかどうかを指定します。
true を指定した場合は変換します。デフォルトでは
文字列に変換されます。
#@end
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
@see [[m:Psych.parse]]
#@samplecode 例
Psych.load("--- a") # => 'a'
Psych.load("---\n - a\n - b") # => ['a', 'b']
begin
Psych.load("--- `", "file.txt")
rescue Psych::SyntaxError => ex
p ex.file # => 'file.txt'
p ex.message # => "(file.txt): found character that cannot start any token while scanning for the next token at line 1 column 5"
end
#@end
キーワード引数 symbolize_names に true を指定した場合はハッシュのキー
を [[c:Symbol]] に変換して返します。
#@since 2.5.0
#@samplecode 例
Psych.load("---\n foo: bar") # => {"foo"=>"bar"}
Psych.load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
#@end
#@end
#@since 2.0
#@since 2.5.0
--- safe_load(yaml, whitelist_classes = [], whitelist_symbols = [], aliases = false, filename = nil, symbolize_names: false) -> object
#@else
--- safe_load(yaml, whitelist_classes = [], whitelist_symbols = [], aliases = false, filename = nil) -> object
#@end
安全に YAML フォーマットの文書を読み込み Ruby のオブジェクトを生成して返します。
デフォルトでは以下のクラスのオブジェクトしか変換しません。
* TrueClass
* FalseClass
* NilClass
* Numeric
* String
* Array
* Hash
再帰的なデータ構造はデフォルトでは許可されていません。
任意のクラスを許可するには whitelist_classes を指定すると、
そのクラスが追加されます。例えば Date クラスを許可するには
以下のように書いてください:
Psych.safe_load(yaml, [Date])
すると上のクラス一覧に加えて Date クラスが読み込まれます。
エイリアスは aliases パラメーターを変更することで明示的に許可できます。
例:
x = []
x << x
yaml = Psych.dump x
Psych.safe_load yaml # => 例外発生
Psych.safe_load yaml, [], [], true # => エイリアスが読み込まれる
yaml にホワイトリストにないクラスが含まれていた場合は、
Psych::DisallowedClass 例外が発生します。
yaml がエイリアスを含んでいて aliases パラメーターが false の時、
Psych::BadAlias 例外が発生します。
filename はパース中に発生した例外のメッセージに用います。
キーワード引数 symbolize_names に true を指定した場合はハッシュのキー
を [[c:Symbol]] に変換して返します。
#@since 2.5.0
#@samplecode 例
Psych.safe_load("---\n foo: bar") # => {"foo"=>"bar"}
Psych.safe_load("---\n foo: bar", symbolize_names: true) # => {:foo=>"bar"}
#@end
#@end
@param io YAMLフォーマットの文書の読み込み先のIOオブジェクト。
@param whitelist_classes 追加で読み込みを許可するクラスの配列。
@param whitelist_symbols 引数 whitelist_classesに [[c:Symbol]] を含む場
合に読み込みを許可する [[c:Symbol]] の配列。
省略した場合は全ての [[c:Symbol]] を許可します。
@param aliases エイリアスの読み込みを許可するかどうか。
@param filename [[c:Psych::SyntaxError]] 発生時にファイル名として表示する文字列。
#@since 2.5.0
@param symbolize_names ハッシュ(YAMLの仕様では正確にはマッピング)のキー
を [[c:Symbol]] に変換するかどうかを指定します。
true を指定した場合は変換します。デフォルトでは
文字列に変換されます。
#@end
#@end
--- parse(yaml, filename = nil) -> Psych::Nodes::Document
YAML ドキュメントをパースし、YAML の AST を返します。
入力に複数のドキュメントが含まれている場合は、先頭のものを AST に変換して
返します。
filename はパース中に発生した例外のメッセージに用います。
AST については [[c:Psych::Nodes]] を参照してください。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename [[c:Psych::SyntaxError]] 発生時にファイル名として表示する文字列。
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
@see [[m:Psych.load]]
=== 例
Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Document:...>
begin
Psych.parse("--- `", "file.txt")
rescue Psych::SyntaxError => ex
p ex.file # => 'file.txt'
p ex.message # => "(file.txt): found character that cannot start any token while scanning for the next token at line 1 column 5"
end
--- parse_file(filename) -> Psych::Nodes::Document
filename で指定したファイルをパースして YAML の AST を返します。
@param filename パースするファイルの名前
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
--- parser -> Psych::Parser
デフォルトで使われるのパーサを返します。
--- parse_stream(yaml) -> Psych::Nodes::Stream
--- parse_stream(yaml){|node| ... } -> ()
YAML ドキュメントをパースします。
yaml が 複数の YAML ドキュメントを含む場合を取り扱うことができます。
ブロックなしの場合は YAML の AST (すべての YAML ドキュメントを
保持した [[c:Psych::Nodes::Stream]] オブジェクト)を返します。
ブロック付きの場合は、そのブロックに最初の YAML ドキュメント
の Psych::Nodes::Document オブジェクトが渡されます。
この場合の返り値には意味がありません。
@see [[c:Psych::Nodes]]
=== 例
Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00>
--- dump(o, options = {}) -> String
--- dump(o, io, options = {}) -> ()
Ruby のオブジェクト o を YAML ドキュメントに変換します。
io に IO オブジェクトを指定した場合は、変換されたドキュメントが
その IO に書き込まれます。
指定しなかった場合は変換されたドキュメントが文字列としてメソッドの返り値と
なります。
options で出力に関するオプションを以下の指定できます。
#@include(psych/dump_options)
@param o 変換するオブジェクト
@param io 出力先
@param options 出力オプション
=== 例
# Dump an array, get back a YAML string
Psych.dump(['a', 'b']) # => "---\n- a\n- b\n"
# Dump an array to an IO object
Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
# Dump an array with indentation set
Psych.dump(['a', ['b']], :indentation => 3) # => "---\n- a\n- - b\n"
# Dump an array to an IO with indentation set
Psych.dump(['a', ['b']], StringIO.new, :indentation => 3)
--- dump_stream(*objects) -> String
オブジェクト列を YAML ドキュメント列に変換します。
@param objects 変換対象のオブジェクト列
=== 例
Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
--- to_json(o) -> String
Ruby のオブジェクト o を JSON の文字列に変換します。
@param o 変換対象となるオブジェクト
--- load_stream(yaml, filename=nil) -> [object]
--- load_stream(yaml, filename=nil){|obj| ... } -> ()
複数の YAML ドキュメントを含むデータを
Ruby のオブジェクトに変換します。
ブロックなしの場合はオブジェクトの配列を返します。
Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']
ブロックありの場合は各オブジェクト引数としてそのブロックを呼び出します。
list = []
Psych.load_stream("--- foo\n...\n--- bar\n...") do |ruby|
list << ruby
end
list # => ['foo', 'bar']
filename はパース中に発生した例外のメッセージに用います。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@param filename [[c:Psych::SyntaxError]] 発生時にファイル名として表示する文字列。
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
--- load_file(filename) -> object
filename で指定したファイルを YAML ドキュメントとして
Ruby のオブジェクトに変換します。
@param filename ファイル名
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
#@until 2.5.0
--- load_documents(yaml) ->[object]
--- load_documents(yaml){|obj| ... } -> ()
複数の YAML ドキュメントを含むデータを
Ruby のオブジェクトに変換します。
このメソッドは deprecated です。[[m:Psych.load_stream]] を代わりに
使ってください。
@param yaml YAML ドキュメント(文字列 or IO オブジェクト)
@raise Psych::SyntaxError YAMLドキュメントに文法エラーが発見されたときに発生します
#@end
#@# Deprecated methods, no documents in psych lib
#@# --- quick_emit
#@# --- detect_implicit
#@# --- add_ruby_type
#@# --- add_private_type
#@# --- tagurize
#@# --- read_type_class
#@# --- object_maker
#@# For internal use, :nodoc:
#@# --- add_domain_type(domain, type_tag, &block)
#@# --- add_builtin_type(type_tag, &block)
#@# --- remove_type(type_tag)
#@# --- add_tag(tag, klass)
#@# --- load_tags
#@# --- load_tags=(val)
#@# --- dump_tags
#@# --- dump_tags=(val)
#@# --- domain_types
#@# --- domain_types=(val)
= class Psych::Exception < RuntimeError
Psych 関連のエラーを表す例外です。
= class Psych::BadAlias < Psych::Exception
YAML の alias が不正である(本体が見つからない)というエラーを表す例外です。
= class Psych::SyntaxError < SyntaxError
YAML の文法エラーを表すクラスです。
== Instance Methods
--- file -> String|nil
エラーが生じたファイルの名前を返します。
[[m:Psych.load_file]] で指定したファイルの名前や
[[m:Psych.load]] の第2引数で指定した名前が返されます。
パース時にファイル名を指定しなかった場合は nil が返されます。
--- line -> Integer
エラーが生じた行番号を返します。
--- column -> Integer
エラーが生じた行内の位置を返します。
--- offset -> Integer
エラーが生じた位置の offset をバイト数で
返します。
offset とは、
[[m:Psych::SyntaxError#line]], [[m:Psych::SyntaxError#column]]
で指示される位置からの相対位置です。
この位置から 0 バイトの位置でエラーが発生することが多いため、
このメソッドはしばしば 0 を返します。
--- problem -> String
生じたエラーの中身を文字列で返します。
--- context -> String
エラーが生じたコンテキストを文字列で返します。
= class Psych::Set < Hash
YAML の unordered set を表すクラスです。
= class Psych::Omap < Hash
YAML の ordered mapping を表すクラスです。
#@include(psych/Psych__Parser)
#@include(psych/Psych__Handler)
#@include(psych/Psych__TreeBuilder)
#@include(psych/Psych__Nodes)
#@include(psych/Psych__Visitors)
#@include(psych/Psych__Stream)
#@include(psych/Psych__ScalarScanner)
#@include(psych/core_ext.rd)
| {
"pile_set_name": "Github"
} |
<?php
/**
* @file classes/notification/NotificationSettingsDAO.inc.php
*
* Copyright (c) 2014-2020 Simon Fraser University
* Copyright (c) 2000-2020 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class NotificationSettingsDAO
* @ingroup notification
* @see Notification
*
* @brief Operations for retrieving and modifying Notification metadata.
*/
import('classes.notification.Notification');
class NotificationSettingsDAO extends DAO {
/**
* Update a notification's metadata
* @param $notificationId int
* @return $params array
*/
function getNotificationSettings($notificationId) {
$result = $this->retrieve(
'SELECT * FROM notification_settings WHERE notification_id = ?',
(int) $notificationId
);
$params = array();
while (!$result->EOF) {
$row = $result->GetRowAssoc(false);
$name = $row['setting_name'];
$value = $this->convertFromDB($row['setting_value'], $row['setting_type']);
$locale = $row['locale'];
if ($locale == '') $params[$name] = $value;
else $params[$name][$locale] = $value;
$result->MoveNext();
}
$result->Close();
return $params;
}
/**
* Store a notification's metadata
* @param $notificationId int
* @param $name string
* @param $value string
* @param $isLocalized boolean optional
* @param $type string optional
* @param $params array
*/
function updateNotificationSetting($notificationId, $name, $value, $isLocalized = false, $type = null) {
$keyFields = array('setting_name', 'locale', 'notification_id');
if (!$isLocalized) {
$value = $this->convertToDB($value, $type);
$this->replace('notification_settings',
array(
'notification_id' => (int) $notificationId,
'setting_name' => $name,
'setting_value' => $value,
'setting_type' => $type,
'locale' => ''
),
$keyFields
);
} else {
if (is_array($value)) foreach ($value as $locale => $localeValue) {
$this->update('DELETE FROM notification_settings WHERE notification_id = ? AND setting_name = ? AND locale = ?', array($notificationId, $name, $locale));
if (empty($localeValue)) continue;
$type = null;
$this->update('INSERT INTO notification_settings
(notification_id, setting_name, setting_value, setting_type, locale)
VALUES (?, ?, ?, ?, ?)',
array(
(int) $notificationId,
$name, $this->convertToDB($localeValue, $type),
$type,
$locale
)
);
}
}
}
/**
* Delete all settings for a notification
* @param $notificationId
*/
function deleteSettingsByNotificationId($notificationId) {
return $this->update('DELETE FROM notification_settings WHERE notification_id = ?', (int) $notificationId);
}
}
| {
"pile_set_name": "Github"
} |
const webpack = require('webpack');
const merge = require('webpack-merge');
const base = require('./base');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const helpers = require('../../helpers');
module.exports = merge(base, {
mode: 'production',
output: {
path: helpers.resolveFromRootPath('dist'),
filename: '[chunkhash].[name].js',
},
module: {
rules: [
{
test: /\.css$/,
include: /node_modules/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: true,
camelCase: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
},
},
{ loader: 'sass-loader' },
],
},
],
},
plugins: [
new webpack.HashedModuleIdsPlugin(),
new MiniCssExtractPlugin({
filename: '[chunkhash].[name].css',
chunkFilename: '[chunkhash].[id].css',
}),
],
});
| {
"pile_set_name": "Github"
} |
/*
* 3D Canvas for GCode Visualizer.
*
* Created on Jan 29, 2013
*/
/*
Copywrite 2013-2016 Will Winder
This file is part of Universal Gcode Sender (UGS).
UGS 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.
UGS 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 UGS. If not, see <http://www.gnu.org/licenses/>.
*/
package com.willwinder.universalgcodesender.visualizer;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opengl.GL;
import static com.jogamp.opengl.GL.GL_DEPTH_TEST;
import static com.jogamp.opengl.GL.GL_LEQUAL;
import static com.jogamp.opengl.GL.GL_LINES;
import static com.jogamp.opengl.GL.GL_NICEST;
import com.jogamp.opengl.GL2;
import static com.jogamp.opengl.GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.awt.GLCanvas;
import static com.jogamp.opengl.fixedfunc.GLLightingFunc.GL_SMOOTH;
import static com.jogamp.opengl.fixedfunc.GLMatrixFunc.GL_MODELVIEW;
import static com.jogamp.opengl.fixedfunc.GLMatrixFunc.GL_PROJECTION;
import com.jogamp.opengl.glu.GLU;
import com.willwinder.universalgcodesender.gcode.util.GcodeParserException;
import com.willwinder.universalgcodesender.i18n.Localization;
import com.willwinder.universalgcodesender.model.Position;
import com.willwinder.universalgcodesender.model.UnitUtils;
import com.willwinder.universalgcodesender.uielements.helpers.FPSCounter;
import com.willwinder.universalgcodesender.uielements.helpers.Overlay;
import com.willwinder.universalgcodesender.utils.GUIHelpers;
import com.willwinder.universalgcodesender.utils.GcodeStreamReader;
import com.willwinder.universalgcodesender.utils.IGcodeStreamReader;
import java.awt.Font;
import java.awt.Point;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.text.DecimalFormat;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;
/**
*
* @author wwinder
*
*/
@SuppressWarnings("serial")
public class VisualizerCanvas extends GLCanvas implements GLEventListener, KeyListener, MouseMotionListener, MouseWheelListener {
private static final Logger logger = Logger.getLogger(VisualizerCanvas.class.getName());
private static boolean ortho = true;
private static double orthoRotation = -45;
private static boolean forceOldStyle = false;
private static boolean debugCoordinates = false; // turn on coordinate debug output
final static private DecimalFormat format = new DecimalFormat("####.00");
// Machine data
private final Point3d machineCoord;
private final Point3d workCoord;
// Gcode file data
private String gcodeFile = null;
private boolean processedGcodeFile = false; // True if the file should be loaded with a GcodeStreamReader
private boolean isDrawable = false; //True if a file is loaded; false if not
private List<LineSegment> gcodeLineList; //An ArrayList of linesegments composing the model
private int currentCommandNumber = 0;
private int lastCommandNumber = 0;
// GL Utility
private GLU glu;
// Projection variables
private Point3d center, eye;
private Point3d objectMin, objectMax;
private double maxSide;
private double aspectRatio;
private int xSize, ySize;
private double minArcLength;
private double arcLength;
// Scaling
private double scaleFactor;
private double scaleFactorBase;
private double zoomMultiplier = 1;
private final boolean invertZoom = false; // TODO: Make configurable
// const values until added to settings
private final double minZoomMultiplier = 1;
private final double maxZoomMultiplier = 30;
private final double zoomIncrement = 0.2;
// Movement
private final int panMouseButton = InputEvent.BUTTON2_MASK; // TODO: Make configurable
private double panMultiplierX = 1;
private double panMultiplierY = 1;
private Vector3d translationVectorH;
private Vector3d translationVectorV;
// Mouse rotation data
private Point last;
private Point current;
private Point3d rotation;
// OpenGL Object Buffer Variables
private int numberOfVertices = -1;
private float[] lineVertexData = null;
private byte[] lineColorData = null;
private FloatBuffer lineVertexBuffer = null;
private ByteBuffer lineColorBuffer = null;
// Track when arrays need to be updated due to changing data.
private boolean colorArrayDirty = false;
private boolean vertexArrayDirty = false;
private FPSCounter fpsCounter;
private Overlay overlay;
private String dimensionsLabel;
/**
* Constructor.
*/
public VisualizerCanvas() {
this.addGLEventListener(this);
this.addKeyListener(this);
this.addMouseMotionListener(this);
this.addMouseWheelListener(this);
this.eye = new Point3d(0, 0, 1.5);
this.center = new Point3d(0, 0, 0);
this.workCoord = new Point3d(0, 0, 0);
this.machineCoord = new Point3d(0, 0, 0);
this.rotation = new Point3d(0.0, -30.0, 0.0);
if (ortho) {
setVerticalTranslationVector();
setHorizontalTranslationVector();
}
}
/**
* This is used to gray out completed commands.
*/
public void setCurrentCommandNumber(int num) {
this.currentCommandNumber = num;
this.createVertexBuffers();
this.colorArrayDirty = true;
}
/**
* Returns the last command number used for generating the gcode object.
*/
public int getLastCommandNumber() {
return this.lastCommandNumber;
}
public void setProcessedGcodeFile(String file) {
this.processedGcodeFile = true;
setFile(file);
}
/**
* Assign a gcode file to drawing.
*/
public void setGcodeFile(String file) {
this.processedGcodeFile = false;
setFile(file);
}
private void setFile(String file) {
this.gcodeFile = file;
this.isDrawable = false;
this.currentCommandNumber = 0;
this.lastCommandNumber = 0;
generateObject();
}
public void setWorkCoordinate(Position p) {
this.workCoord.set(p.getPositionIn(UnitUtils.Units.MM));
}
public void setMachineCoordinate(Position p) {
this.machineCoord.set(p.getPositionIn(UnitUtils.Units.MM));
}
// ------ Implement methods declared in GLEventListener ------
/**
* Called back immediately after the OpenGL context is initialized. Can be used
* to perform one-time initialization. Run only once.
* GLEventListener method.
*/
@Override
public void init(GLAutoDrawable drawable) {
logger.log(Level.INFO, "Initializing OpenGL context.");
generateObject();
this.fpsCounter = new FPSCounter(drawable, new Font("SansSerif", Font.BOLD, 12));
this.overlay = new Overlay(drawable, new Font("SansSerif", Font.BOLD, 12));
this.overlay.setColor(127, 127, 127, 100);
this.overlay.setTextLocation(Overlay.LOWER_LEFT);
// Parse random gcode file and generate something to draw.
GL2 gl = drawable.getGL().getGL2(); // get the OpenGL graphics context
glu = new GLU(); // get GL Utilities
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // set background (clear) color
gl.glClearDepth(1.0f); // set clear depth value to farthest
gl.glEnable(GL_DEPTH_TEST); // enables depth testing
gl.glDepthFunc(GL_LEQUAL); // the type of depth test to do
gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // best perspective correction
gl.glShadeModel(GL_SMOOTH); // blends colors nicely, and smoothes out lighting
}
/**
* Call-back handler for window re-size event. Also called when the drawable is
* first set to visible.
* GLEventListener method.
*/
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
logger.log(Level.INFO, "Reshaping OpenGL context.");
if (!isDrawable) return;
this.xSize = width;
this.ySize = height;
GL2 gl = drawable.getGL().getGL2(); // get the OpenGL 2 graphics context
if (height == 0){ height = 1; } // prevent divide by zero
this.aspectRatio = (float)width / height;
this.scaleFactorBase = VisualizerUtils.findScaleFactor(this.xSize, this.ySize, this.objectMin, this.objectMax, 0.9);
this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier;
this.panMultiplierX = VisualizerUtils.getRelativeMovementMultiplier(this.objectMin.x, this.objectMax.x, this.xSize);
this.panMultiplierY = VisualizerUtils.getRelativeMovementMultiplier(this.objectMin.y, this.objectMax.y, this.ySize);
// Set the view port (display area) to cover the entire window
gl.glViewport(0, 0, width, height);
}
/**
* Called back by the animator to perform rendering.
* GLEventListener method.
*/
@Override
public void display(GLAutoDrawable drawable) {
if (!isDrawable) return;
this.setupPerpective(this.xSize, this.ySize, drawable, ortho);
final GL2 gl = drawable.getGL().getGL2();
// Scale the model so that it will fit on the window.
gl.glScaled(this.scaleFactor, this.scaleFactor, this.scaleFactor);
// Rotate prior to translating so that rotation happens from middle of
// object.
if (ortho) {
// Manual rotation
gl.glRotated(this.rotation.x, 0.0, 1.0, 0.0);
gl.glRotated(this.rotation.y, 1.0, 0.0, 0.0);
gl.glTranslated(-this.eye.x - this.center.x, -this.eye.y - this.center.y, -this.eye.z - this.center.z);
} else {
// Shift model to center of window.
gl.glTranslated(-this.center.x, -this.center.y, 0);
}
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
// Draw model
if (isDrawable) {
//renderAxes(drawable);
renderModel(drawable);
renderTool(drawable);
}
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glPopMatrix();
if (isDrawable) {
this.fpsCounter.draw();
this.overlay.draw(this.dimensionsLabel);
//this(drawable, new Font("SansSerif", Font.BOLD, 12));
}
update();
}
private void renderAxes(GLAutoDrawable drawable) {
final GL2 gl = drawable.getGL().getGL2();
gl.glBegin(GL_LINES);
// X-Axis
gl.glColor3f( 1, 0, 0 );
gl.glVertex3f( 0, 0, 0 );
gl.glVertex3f( 50, 0, 0 );
// Y-Axis
gl.glColor3f( 0, 1, 0 );
gl.glVertex3f( 0, 0, 0 );
gl.glVertex3f( 0, 50, 0 );
// Z-Axis
gl.glColor3f( 0, 0, 1 );
gl.glVertex3f( 0, 0, 0 );
gl.glVertex3f( 0, 0, 50 );
gl.glEnd();
//# Draw number 50 on x/y-axis line.
//glRasterPos2f(50,-5)
//glutInit()
//A = 53
//glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, A)
//glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, 48)
//glRasterPos2f(-5,50)
//glutInit()
//A = 53
//glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, A)
//glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, 48)
}
/**
* Draws a tool at the current work coordinates.
*/
private void renderTool(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glLineWidth(8.0f);
byte []color;
color = VisualizerUtils.Color.YELLOW.getBytes();
int verts = 0;
int colors = 0;
gl.glBegin(GL_LINES);
gl.glColor3ub(color[0], color[1], color[2]);
gl.glVertex3d(this.workCoord.x, this.workCoord.y, this.workCoord.z);
gl.glColor3ub(color[0], color[1], color[2]);
gl.glVertex3d(this.workCoord.x, this.workCoord.y, this.workCoord.z+(1.0/this.scaleFactor));
gl.glEnd();
}
/**
* Render the GCode object.
*/
private void renderModel(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
// Batch mode if available
if(!forceOldStyle
&& gl.isFunctionAvailable( "glGenBuffers" )
&& gl.isFunctionAvailable( "glBindBuffer" )
&& gl.isFunctionAvailable( "glBufferData" )
&& gl.isFunctionAvailable( "glDeleteBuffers" ) ) {
// Initialize OpenGL arrays if required.
if (this.colorArrayDirty) {
this.updateGLColorArray(drawable);
this.colorArrayDirty = false;
}
if (this.vertexArrayDirty) {
this.updateGLGeometryArray(drawable);
this.vertexArrayDirty = false;
}
gl.glLineWidth(1.0f);
gl.glEnableClientState(GL2.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL2.GL_COLOR_ARRAY);
gl.glDrawArrays( GL.GL_LINES, 0, numberOfVertices);
gl.glDisableClientState(GL2.GL_COLOR_ARRAY);
gl.glDisableClientState(GL2.GL_VERTEX_ARRAY);
}
// Traditional OpenGL
else {
// TODO: By using a GL_LINE_STRIP I can easily use half the number of
// verticies. May lose some control over line colors though.
//gl.glEnable(GL2.GL_LINE_SMOOTH);
gl.glBegin(GL_LINES);
gl.glLineWidth(1.0f);
int verts = 0;
int colors = 0;
for(LineSegment ls : gcodeLineList)
{
gl.glColor3ub(lineColorData[colors++],lineColorData[colors++],lineColorData[colors++]);
gl.glVertex3d(lineVertexData[verts++], lineVertexData[verts++], lineVertexData[verts++]);
gl.glColor3ub(lineColorData[colors++],lineColorData[colors++],lineColorData[colors++]);
gl.glVertex3d(lineVertexData[verts++], lineVertexData[verts++], lineVertexData[verts++]);
}
gl.glEnd();
}
// makes the gui stay on top of elements
// drawn before.
}
/**
* Setup the perspective matrix.
*/
private void setupPerpective(int x, int y, GLAutoDrawable drawable, boolean ortho) {
final GL2 gl = drawable.getGL().getGL2();
if (ortho) {
gl.glDisable(GL_DEPTH_TEST);
//gl.glDisable(GL_LIGHTING);
gl.glMatrixMode(GL_PROJECTION);
gl.glLoadIdentity();
// Object's longest dimension is 1, make window slightly larger.
gl.glOrtho(-0.51*this.aspectRatio,0.51*this.aspectRatio,-0.51,0.51,-10,10);
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity();
} else {
gl.glEnable(GL.GL_DEPTH_TEST);
// Setup perspective projection, with aspect ratio matches viewport
gl.glMatrixMode(GL_PROJECTION); // choose projection matrix
gl.glLoadIdentity(); // reset projection matrix
glu.gluPerspective(45.0, this.aspectRatio, 0.1, 100.0); // fovy, aspect, zNear, zFar
// Move camera out and point it at the origin
glu.gluLookAt(this.eye.x, this.eye.y, this.eye.z,
0, 0, 0,
0, 1, 0);
// Enable the model-view transform
gl.glMatrixMode(GL_MODELVIEW);
gl.glLoadIdentity(); // reset
}
}
/**
* Parse the gcodeFile and store the resulting geometry and data about it.
*/
private void generateObject()
{
if (this.gcodeFile == null){ return; }
try {
GcodeViewParse gcvp = new GcodeViewParse();
// Load from stream
if (this.processedGcodeFile) {
IGcodeStreamReader gsr = new GcodeStreamReader(new File(this.gcodeFile));
gcodeLineList = gcvp.toObjFromReader(gsr, 0.3);
}
// Load raw file
else {
List<String> linesInFile;
linesInFile = VisualizerUtils.readFiletoArrayList(this.gcodeFile);
gcodeLineList = gcvp.toObjRedux(linesInFile, 0.3);
}
this.objectMin = gcvp.getMinimumExtremes();
this.objectMax = gcvp.getMaximumExtremes();
if (gcodeLineList.size() == 0) {
return;
}
// Grab the line number off the last line.
this.lastCommandNumber = gcodeLineList.get(gcodeLineList.size() - 1).getLineNumber();
System.out.println("Object bounds: X ("+objectMin.x+", "+objectMax.x+")");
System.out.println(" Y ("+objectMin.y+", "+objectMax.y+")");
System.out.println(" Z ("+objectMin.z+", "+objectMax.z+")");
this.center = VisualizerUtils.findCenter(objectMin, objectMax);
System.out.println("Center = " + center.toString());
System.out.println("Num Line Segments :" + gcodeLineList.size());
this.maxSide = VisualizerUtils.findMaxSide(objectMin, objectMax);
this.scaleFactorBase = 1.0/this.maxSide;
this.scaleFactorBase = VisualizerUtils.findScaleFactor(this.xSize, this.ySize, this.objectMin, this.objectMax, 0.9);
this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier;
this.isDrawable = true;
double objectWidth = this.objectMax.x-this.objectMin.x;
double objectHeight = this.objectMax.y-this.objectMin.y;
this.dimensionsLabel = Localization.getString("VisualizerCanvas.dimensions") + ": "
+ Localization.getString("VisualizerCanvas.width") + "=" + format.format(objectWidth) + " "
+ Localization.getString("VisualizerCanvas.height") + "=" + format.format(objectHeight);
// Now that the object is known, fill the buffers.
this.createVertexBuffers();
this.colorArrayDirty = true;
this.vertexArrayDirty = true;
} catch (GcodeParserException | IOException | GcodeStreamReader.NotGcodeStreamFile e) {
String error = Localization.getString("mainWindow.error.openingFile") + " : " + e.getLocalizedMessage();
System.out.println(error);
GUIHelpers.displayErrorDialog(error);
}
}
/**
* Convert the gcodeLineList into vertex and color arrays.
*/
private void createVertexBuffers() {
if (this.isDrawable) {
this.numberOfVertices = gcodeLineList.size() * 2;
this.lineVertexData = new float[numberOfVertices * 3];
this.lineColorData = new byte[numberOfVertices * 3];
VisualizerUtils.Color color;
int vertIndex = 0;
int colorIndex = 0;
for(LineSegment ls : gcodeLineList) {
// Find the lines color.
if (ls.isArc()) {
color = VisualizerUtils.Color.RED;
} else if (ls.isFastTraverse()) {
color = VisualizerUtils.Color.BLUE;
} else if (ls.isZMovement()) {
color = VisualizerUtils.Color.GREEN;
} else {
color = VisualizerUtils.Color.WHITE;
}
// Override color if it is cutoff
if (ls.getLineNumber() <= this.currentCommandNumber) {
color = VisualizerUtils.Color.GRAY;
}
// Draw it.
{
Point3d p1 = ls.getStart();
Point3d p2 = ls.getEnd();
byte[] c = color.getBytes();
// colors
//p1
lineColorData[colorIndex++] = c[0];
lineColorData[colorIndex++] = c[1];
lineColorData[colorIndex++] = c[2];
//p2
lineColorData[colorIndex++] = c[0];
lineColorData[colorIndex++] = c[1];
lineColorData[colorIndex++] = c[2];
// p1 location
lineVertexData[vertIndex++] = (float)p1.x;
lineVertexData[vertIndex++] = (float)p1.y;
lineVertexData[vertIndex++] = (float)p1.z;
//p2
lineVertexData[vertIndex++] = (float)p2.x;
lineVertexData[vertIndex++] = (float)p2.y;
lineVertexData[vertIndex++] = (float)p2.z;
}
}
}
}
/**
* Initialize or update open gl geometry array in native buffer objects.
*/
private void updateGLGeometryArray(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
// Reset buffer and set to null of new geometry doesn't fit.
if (lineVertexBuffer != null) {
lineVertexBuffer.clear();
if (lineVertexBuffer.remaining() < lineVertexData.length) {
lineVertexBuffer = null;
}
}
if (lineVertexBuffer == null) {
lineVertexBuffer = Buffers.newDirectFloatBuffer(lineVertexData.length);
}
lineVertexBuffer.put(lineVertexData);
lineVertexBuffer.flip();
gl.glVertexPointer( 3, GL.GL_FLOAT, 0, lineVertexBuffer );
}
/**
* Initialize or update open gl color array in native buffer objects.
*/
private void updateGLColorArray(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
// Reset buffer and set to null of new colors don't fit.
if (lineColorBuffer != null) {
lineColorBuffer.clear();
if (lineColorBuffer.remaining() < lineColorData.length) {
lineColorBuffer = null;
}
}
if (lineColorBuffer == null) {
lineColorBuffer = Buffers.newDirectByteBuffer(this.lineColorData.length);
}
lineColorBuffer.put(lineColorData);
lineColorBuffer.flip();
gl.glColorPointer( 3, GL.GL_UNSIGNED_BYTE, 0, lineColorBuffer );
}
// For seeing the tool path.
//private int count = 0;
//private boolean increasing = true;
/**
* Called after each render.
*/
private void update() {
if (debugCoordinates) {
System.out.println("Machine coordinates: " + this.machineCoord.toString());
System.out.println("Work coordinates: " + this.workCoord.toString());
System.out.println("-----------------");
}
/*
// Increases the cutoff number each frame to show the tool path.
count++;
if (increasing) currentCommandNumber+=10;
else currentCommandNumber-=10;
if (this.currentCommandNumber > this.lastCommandNumber) increasing = false;
else if (this.currentCommandNumber <= 0) increasing = true;
*/
}
/**
* Called back before the OpenGL context is destroyed.
* Release resource such as buffers.
* GLEventListener method.
*/
@Override
public void dispose(GLAutoDrawable drawable) {
logger.log(Level.INFO, "Disposing OpenGL context.");
this.lineColorBuffer = null;
this.lineVertexBuffer = null;
this.gcodeLineList = null;
this.isDrawable = false;
this.numberOfVertices = 0;
}
/**
* KeyListener method.
*/
@Override
public void keyTyped(KeyEvent ke) {
//System.out.println ("key typed");
}
/**
* KeyListener method.
*/
@Override
public void keyPressed(KeyEvent ke) {
double DELTA_SIZE = 0.1;
switch(ke.getKeyCode()) {
case KeyEvent.VK_UP:
this.eye.y+=DELTA_SIZE;
break;
case KeyEvent.VK_DOWN:
this.eye.y-=DELTA_SIZE;
break;
case KeyEvent.VK_LEFT:
this.eye.x-=DELTA_SIZE;
break;
case KeyEvent.VK_RIGHT:
this.eye.x+=DELTA_SIZE;
break;
case KeyEvent.VK_MINUS:
if (ke.isControlDown())
this.zoomOut(1);
break;
case KeyEvent.VK_0:
if (ke.isControlDown()) {
this.zoomMultiplier = 1;
this.scaleFactor = this.scaleFactorBase;
}
break;
case KeyEvent.VK_ESCAPE:
this.zoomMultiplier = 1;
this.scaleFactor = this.scaleFactorBase;
this.eye.x = 0;
this.eye.y = 0;
this.eye.z = 1.5;
this.rotation.x = 0;
this.rotation.y = -30;
this.rotation.z = 0;
default:
break;
}
switch(ke.getKeyChar()) {
case 'p':
this.eye.z+=DELTA_SIZE;
break;
case ';':
this.eye.z-=DELTA_SIZE;
break;
case 'w':
this.center.y+=DELTA_SIZE;
break;
case 's':
this.center.y-=DELTA_SIZE;
break;
case 'a':
this.center.x-=DELTA_SIZE;
break;
case 'd':
this.center.x+=DELTA_SIZE;
break;
case 'r':
this.center.z+=DELTA_SIZE;
break;
case 'f':
this.center.z-=DELTA_SIZE;
break;
case '+':
if (ke.isControlDown())
this.zoomIn(1);
break;
default:
break;
}
//System.out.println("Eye: " + eye.toString()+"\nCent: "+cent.toString());
}
/**
* KeyListener method.
*/
@Override
public void keyReleased(KeyEvent ke) {
//System.out.println ("key released");
}
/** Mouse Motion Listener Events **/
@Override
public void mouseDragged(MouseEvent me) {
this.current = me.getPoint();
int dx = this.current.x - this.last.x;
int dy = this.current.y - this.last.y;
if (me.isShiftDown() || me.getModifiers() == this.panMouseButton) {
if (ortho) {
// Treat dx and dy as vectors relative to the rotation angle.
this.eye.x -= ((dx * this.translationVectorH.x * this.panMultiplierX) + (dy * this.translationVectorV.x * panMultiplierY));
this.eye.y += ((dy * this.translationVectorV.y * panMultiplierY) - (dx * this.translationVectorH.y * this.panMultiplierX));
this.eye.z -= ((dx * this.translationVectorH.z * this.panMultiplierX) + (dy * this.translationVectorV.z * panMultiplierY));
} else {
this.eye.x += dx;
this.eye.y += dy;
}
} else {
this.rotation.x += dx / 2.0;
this.rotation.y -= dy / 2.0;
if (ortho) {
setHorizontalTranslationVector();
setVerticalTranslationVector();
}
}
// Now that the motion has been accumulated, reset last.
this.last = this.current;
}
private void setHorizontalTranslationVector() {
double x = Math.cos(Math.toRadians(this.rotation.x));
double xz = Math.sin(Math.toRadians(this.rotation.x));
double y = xz * Math.sin(Math.toRadians(this.rotation.y));
double yz = xz * Math.cos(Math.toRadians(this.rotation.y));
translationVectorH = new Vector3d(x, y, yz);
translationVectorH.normalize();
}
private void setVerticalTranslationVector(){
double y = Math.cos(Math.toRadians(this.rotation.y));
double yz = Math.sin(Math.toRadians(this.rotation.y));
translationVectorV = new Vector3d(0, y, yz);
translationVectorV.normalize();
}
@Override
public void mouseMoved(MouseEvent me) {
// Keep last location up to date so that we're ready to start dragging.
last = me.getPoint();
}
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int delta = e.getWheelRotation();
if (delta == 0)
return;
if (delta > 0) {
if (this.invertZoom)
zoomOut(delta);
else
zoomIn(delta);
} else if (delta < 0) {
if (this.invertZoom)
zoomIn(delta * -1);
else
zoomOut(delta * -1);
}
}
private void zoomOut(int increments) {
if (ortho) {
if (this.zoomMultiplier <= this.minZoomMultiplier)
return;
this.zoomMultiplier -= increments * zoomIncrement;
if (this.zoomMultiplier < this.minZoomMultiplier)
this.zoomMultiplier = this.minZoomMultiplier;
this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier;
} else {
this.eye.z += increments;
}
}
private void zoomIn(int increments) {
if (ortho) {
if (this.zoomMultiplier >= this.maxZoomMultiplier)
return;
this.zoomMultiplier += increments * zoomIncrement;
if (this.zoomMultiplier > this.maxZoomMultiplier)
this.zoomMultiplier = this.maxZoomMultiplier;
this.scaleFactor = this.scaleFactorBase * this.zoomMultiplier;
} else {
this.eye.z -= increments;
}
}
public double getMinArcLength() {
return minArcLength;
}
public void setMinArcLength(double minArcLength) {
if (this.minArcLength != minArcLength) {
this.minArcLength = minArcLength;
if (this.gcodeFile != null) {
this.setGcodeFile(this.gcodeFile);
}
}
}
public double getArcLength() {
return arcLength;
}
public void setArcLength(double arcLength) {
if (this.arcLength != arcLength) {
this.arcLength = arcLength;
if (this.gcodeFile != null) {
this.setGcodeFile(this.gcodeFile);
}
}
}
} | {
"pile_set_name": "Github"
} |
en_text= '''
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.s
Complex is better than complicated. 9 Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambxiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do
it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
'''
cn_text = '''
愚公移山 How The Foolish Old Man Moved Mountains
太行,王屋二山的北面,住了一個九十歲的老翁,名叫愚公。二山佔地廣闊,擋住去路,使他和家人往來極為不便。
一天,愚公召集家人說:「讓我們各盡其力,剷平二山,開條道路,直通豫州,你們認為怎樣?」
大家都異口同聲贊成,只有他的妻子表示懷疑,並說:「你連開鑿一個小丘的力量都沒有,怎可能剷平太行、王屋二山呢?況且,鑿出的土石又丟到哪裏去呢?」
大家都熱烈地說:「把土石丟進渤海裏。」
於是愚公就和兒孫,一起開挖土,把土石搬運到渤海去。
愚公的鄰居是個寡婦,有個兒子八歲也興致勃勃地走來幫忙。
寒來暑往,他們要一年才能往返渤海一次。
住在黃河河畔的智叟,看見他們這樣辛苦,取笑愚公說:「你不是很愚蠢嗎?你已一把年紀了,就是用盡你的氣力,也不能挖去山的一角呢?」
愚公歎息道:「你有這樣的成見,是不會明白的。你比那寡婦的小兒子還不如呢!就算我死了,還有我的兒子,我的孫子,我的曾孫子,他們一直傳下去。而這二山是不會加大的,總有一天,我們會把它們剷平。」
智叟聽了,無話可說:
二山的守護神被愚公的堅毅精神嚇倒,便把此事奏知天帝。天帝佩服愚公的精神,就命兩位大力神揹走二山。
'''
from collections import Counter
def stats_text_en(text, count):
# 2. 实现该函数的功能(同day5任务2):统计参数中每个英⽂文单词出现的次数,最后返回⼀个按词频 降序 排列列的 数组
if type(text) != str:
raise ValueError('非字符串类型')
elements = text.split() # list。构成函数体的语句从下一行开始,并且必须缩进。
words = []
'''
for x in text:
for x in ',','.','?','"','!',',','。','?','!',':','「','」':
text=text.replace(x,"")
'''
symbols = ',*!*.-:?",。、!「」?:'
for element in elements:
for symbol in symbols:
element = element.replace(symbol,'')
if len(element) and element.isascii(): # 看单词长度是否大于0,大于0则为真正的单词。用str类型的siascii判断是否为英文单词
words.append(element)
return Counter(words).most_common(count)
def stats_text_cn(text,count):
if type(text) != str:
raise ValueError('非字符串类型')
cn_characters = []
for character in text:
if '\u4e00' <= character <= '\u9fff': # unicode中文字符的范围
# 计算机中所有的字符都是有数字来表示的。汉字也是有数字表示的,
# Unicdoe4E00~9FFF表示中文
# if u'a' <= ch <= u'z' or u'A' <= ch <= u'Z':提取英文
cn_characters.append(character)
return Counter(cn_characters).most_common(count)
def stats_text(text,count):
if type(text) != str:
raise ValueError('非字符串类型')
print(stats_text_en(text,count))
print(stats_text_cn(text,count))
| {
"pile_set_name": "Github"
} |
!gaf-version: 2.1
database prot0 prot0 GO:0000001 GO_REF:0000001 IDA C protein taxon:9606 20190917 user set([])
database prot1 prot1 GO:0000001 GO_REF:0000001 IDA C protein taxon:9606 20190917 user set([])
database prot2 prot2 GO:0000003 GO_REF:0000001 IDA C protein taxon:9606 20190917 user set([])
database prot3 prot3 GO:0000002 GO_REF:0000001 IDA C protein taxon:9606 20190917 user set([])
database prot4 prot4 GO:0000005 GO_REF:0000001 IDA C protein taxon:9606 20190917 user set([])
database prot5 prot5 GO:0000004 GO_REF:0000001 IDA C protein taxon:9606 20190917 user set([])
| {
"pile_set_name": "Github"
} |
glabel func_80B3487C
/* 00BCC 80B3487C 44802000 */ mtc1 $zero, $f4 ## $f4 = 0.00
/* 00BD0 80B34880 27BDFFA0 */ addiu $sp, $sp, 0xFFA0 ## $sp = FFFFFFA0
/* 00BD4 80B34884 AFB00030 */ sw $s0, 0x0030($sp)
/* 00BD8 80B34888 AFBF0034 */ sw $ra, 0x0034($sp)
/* 00BDC 80B3488C E7A40050 */ swc1 $f4, 0x0050($sp)
/* 00BE0 80B34890 8CAE1C44 */ lw $t6, 0x1C44($a1) ## 00001C44
/* 00BE4 80B34894 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000
/* 00BE8 80B34898 00A03025 */ or $a2, $a1, $zero ## $a2 = 00000000
/* 00BEC 80B3489C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 00BF0 80B348A0 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 00BF4 80B348A4 AFA60064 */ sw $a2, 0x0064($sp)
/* 00BF8 80B348A8 0C2CDE0C */ jal func_80B37830
/* 00BFC 80B348AC AFAE0048 */ sw $t6, 0x0048($sp)
/* 00C00 80B348B0 1440010D */ bne $v0, $zero, .L80B34CE8
/* 00C04 80B348B4 260400B6 */ addiu $a0, $s0, 0x00B6 ## $a0 = 000000B6
/* 00C08 80B348B8 8605008A */ lh $a1, 0x008A($s0) ## 0000008A
/* 00C0C 80B348BC AFA00010 */ sw $zero, 0x0010($sp)
/* 00C10 80B348C0 24060001 */ addiu $a2, $zero, 0x0001 ## $a2 = 00000001
/* 00C14 80B348C4 0C01E1A7 */ jal Math_SmoothScaleMaxMinS
/* 00C18 80B348C8 240702EE */ addiu $a3, $zero, 0x02EE ## $a3 = 000002EE
/* 00C1C 80B348CC 860F00B6 */ lh $t7, 0x00B6($s0) ## 000000B6
/* 00C20 80B348D0 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 00C24 80B348D4 A60F0032 */ sh $t7, 0x0032($s0) ## 00000032
/* 00C28 80B348D8 0C00CEAE */ jal func_80033AB8
/* 00C2C 80B348DC 8FA40064 */ lw $a0, 0x0064($sp)
/* 00C30 80B348E0 44801000 */ mtc1 $zero, $f2 ## $f2 = 0.00
/* 00C34 80B348E4 10400004 */ beq $v0, $zero, .L80B348F8
/* 00C38 80B348E8 3C014316 */ lui $at, 0x4316 ## $at = 43160000
/* 00C3C 80B348EC 44813000 */ mtc1 $at, $f6 ## $f6 = 150.00
/* 00C40 80B348F0 00000000 */ nop
/* 00C44 80B348F4 E7A60050 */ swc1 $f6, 0x0050($sp)
.L80B348F8:
/* 00C48 80B348F8 3C014248 */ lui $at, 0x4248 ## $at = 42480000
/* 00C4C 80B348FC 44814000 */ mtc1 $at, $f8 ## $f8 = 50.00
/* 00C50 80B34900 C7AA0050 */ lwc1 $f10, 0x0050($sp)
/* 00C54 80B34904 C6000090 */ lwc1 $f0, 0x0090($s0) ## 00000090
/* 00C58 80B34908 26040068 */ addiu $a0, $s0, 0x0068 ## $a0 = 00000068
/* 00C5C 80B3490C 460A4400 */ add.s $f16, $f8, $f10
/* 00C60 80B34910 3C05C100 */ lui $a1, 0xC100 ## $a1 = C1000000
/* 00C64 80B34914 3C063F80 */ lui $a2, 0x3F80 ## $a2 = 3F800000
/* 00C68 80B34918 3C073FC0 */ lui $a3, 0x3FC0 ## $a3 = 3FC00000
/* 00C6C 80B3491C 4610003E */ c.le.s $f0, $f16
/* 00C70 80B34920 3C014282 */ lui $at, 0x4282 ## $at = 42820000
/* 00C74 80B34924 C7A40050 */ lwc1 $f4, 0x0050($sp)
/* 00C78 80B34928 45020006 */ bc1fl .L80B34944
/* 00C7C 80B3492C 44819000 */ mtc1 $at, $f18 ## $f18 = 65.00
/* 00C80 80B34930 0C01E0C4 */ jal Math_SmoothScaleMaxMinF
/* 00C84 80B34934 E7A20010 */ swc1 $f2, 0x0010($sp)
/* 00C88 80B34938 10000016 */ beq $zero, $zero, .L80B34994
/* 00C8C 80B3493C 00000000 */ nop
/* 00C90 80B34940 44819000 */ mtc1 $at, $f18 ## $f18 = 0.00
.L80B34944:
/* 00C94 80B34944 3C0740D4 */ lui $a3, 0x40D4 ## $a3 = 40D40000
/* 00C98 80B34948 3C054100 */ lui $a1, 0x4100 ## $a1 = 41000000
/* 00C9C 80B3494C 46049180 */ add.s $f6, $f18, $f4
/* 00CA0 80B34950 34E7CCCD */ ori $a3, $a3, 0xCCCD ## $a3 = 40D4CCCD
/* 00CA4 80B34954 26040068 */ addiu $a0, $s0, 0x0068 ## $a0 = 00000068
/* 00CA8 80B34958 3C063F80 */ lui $a2, 0x3F80 ## $a2 = 3F800000
/* 00CAC 80B3495C 4600303C */ c.lt.s $f6, $f0
/* 00CB0 80B34960 00000000 */ nop
/* 00CB4 80B34964 45020009 */ bc1fl .L80B3498C
/* 00CB8 80B34968 44051000 */ mfc1 $a1, $f2
/* 00CBC 80B3496C 26040068 */ addiu $a0, $s0, 0x0068 ## $a0 = 00000068
/* 00CC0 80B34970 3C063F80 */ lui $a2, 0x3F80 ## $a2 = 3F800000
/* 00CC4 80B34974 3C073FC0 */ lui $a3, 0x3FC0 ## $a3 = 3FC00000
/* 00CC8 80B34978 0C01E0C4 */ jal Math_SmoothScaleMaxMinF
/* 00CCC 80B3497C E7A20010 */ swc1 $f2, 0x0010($sp)
/* 00CD0 80B34980 10000004 */ beq $zero, $zero, .L80B34994
/* 00CD4 80B34984 00000000 */ nop
/* 00CD8 80B34988 44051000 */ mfc1 $a1, $f2
.L80B3498C:
/* 00CDC 80B3498C 0C01E0C4 */ jal Math_SmoothScaleMaxMinF
/* 00CE0 80B34990 E7A20010 */ swc1 $f2, 0x0010($sp)
.L80B34994:
/* 00CE4 80B34994 3C0180B3 */ lui $at, %hi(D_80B37B7C) ## $at = 80B30000
/* 00CE8 80B34998 C42A7B7C */ lwc1 $f10, %lo(D_80B37B7C)($at)
/* 00CEC 80B3499C C6080068 */ lwc1 $f8, 0x0068($s0) ## 00000068
/* 00CF0 80B349A0 860800B6 */ lh $t0, 0x00B6($s0) ## 000000B6
/* 00CF4 80B349A4 3C014316 */ lui $at, 0x4316 ## $at = 43160000
/* 00CF8 80B349A8 460A4402 */ mul.s $f16, $f8, $f10
/* 00CFC 80B349AC 44812000 */ mtc1 $at, $f4 ## $f4 = 150.00
/* 00D00 80B349B0 E61001A4 */ swc1 $f16, 0x01A4($s0) ## 000001A4
/* 00D04 80B349B4 8FB80048 */ lw $t8, 0x0048($sp)
/* 00D08 80B349B8 C7A60050 */ lwc1 $f6, 0x0050($sp)
/* 00D0C 80B349BC 8FA90048 */ lw $t1, 0x0048($sp)
/* 00D10 80B349C0 871900B6 */ lh $t9, 0x00B6($t8) ## 000000B6
/* 00D14 80B349C4 46062200 */ add.s $f8, $f4, $f6
/* 00D18 80B349C8 03281023 */ subu $v0, $t9, $t0
/* 00D1C 80B349CC 00021400 */ sll $v0, $v0, 16
/* 00D20 80B349D0 00021403 */ sra $v0, $v0, 16
/* 00D24 80B349D4 04430005 */ bgezl $v0, .L80B349EC
/* 00D28 80B349D8 C6120090 */ lwc1 $f18, 0x0090($s0) ## 00000090
/* 00D2C 80B349DC 00021023 */ subu $v0, $zero, $v0
/* 00D30 80B349E0 00021400 */ sll $v0, $v0, 16
/* 00D34 80B349E4 00021403 */ sra $v0, $v0, 16
/* 00D38 80B349E8 C6120090 */ lwc1 $f18, 0x0090($s0) ## 00000090
.L80B349EC:
/* 00D3C 80B349EC 4608903C */ c.lt.s $f18, $f8
/* 00D40 80B349F0 00000000 */ nop
/* 00D44 80B349F4 45020016 */ bc1fl .L80B34A50
/* 00D48 80B349F8 C61001A0 */ lwc1 $f16, 0x01A0($s0) ## 000001A0
/* 00D4C 80B349FC 812A0843 */ lb $t2, 0x0843($t1) ## 00000843
/* 00D50 80B34A00 28411F40 */ slti $at, $v0, 0x1F40
/* 00D54 80B34A04 51400012 */ beql $t2, $zero, .L80B34A50
/* 00D58 80B34A08 C61001A0 */ lwc1 $f16, 0x01A0($s0) ## 000001A0
/* 00D5C 80B34A0C 54200010 */ bnel $at, $zero, .L80B34A50
/* 00D60 80B34A10 C61001A0 */ lwc1 $f16, 0x01A0($s0) ## 000001A0
/* 00D64 80B34A14 8602008A */ lh $v0, 0x008A($s0) ## 0000008A
/* 00D68 80B34A18 A6020032 */ sh $v0, 0x0032($s0) ## 00000032
/* 00D6C 80B34A1C 0C03F66B */ jal Math_Rand_ZeroOne
## Rand.Next() float
/* 00D70 80B34A20 A60200B6 */ sh $v0, 0x00B6($s0) ## 000000B6
/* 00D74 80B34A24 3C0180B3 */ lui $at, %hi(D_80B37B80) ## $at = 80B30000
/* 00D78 80B34A28 C42A7B80 */ lwc1 $f10, %lo(D_80B37B80)($at)
/* 00D7C 80B34A2C 4600503C */ c.lt.s $f10, $f0
/* 00D80 80B34A30 00000000 */ nop
/* 00D84 80B34A34 45020006 */ bc1fl .L80B34A50
/* 00D88 80B34A38 C61001A0 */ lwc1 $f16, 0x01A0($s0) ## 000001A0
/* 00D8C 80B34A3C 0C2CD3CA */ jal func_80B34F28
/* 00D90 80B34A40 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00D94 80B34A44 100000A9 */ beq $zero, $zero, .L80B34CEC
/* 00D98 80B34A48 8FBF0034 */ lw $ra, 0x0034($sp)
/* 00D9C 80B34A4C C61001A0 */ lwc1 $f16, 0x01A0($s0) ## 000001A0
.L80B34A50:
/* 00DA0 80B34A50 26040188 */ addiu $a0, $s0, 0x0188 ## $a0 = 00000188
/* 00DA4 80B34A54 4600810D */ trunc.w.s $f4, $f16
/* 00DA8 80B34A58 440C2000 */ mfc1 $t4, $f4
/* 00DAC 80B34A5C 0C02927F */ jal SkelAnime_FrameUpdateMatrix
/* 00DB0 80B34A60 AFAC005C */ sw $t4, 0x005C($sp)
/* 00DB4 80B34A64 44801000 */ mtc1 $zero, $f2 ## $f2 = 0.00
/* 00DB8 80B34A68 C60001A4 */ lwc1 $f0, 0x01A4($s0) ## 000001A4
/* 00DBC 80B34A6C 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00DC0 80B34A70 4600103E */ c.le.s $f2, $f0
/* 00DC4 80B34A74 00000000 */ nop
/* 00DC8 80B34A78 45020004 */ bc1fl .L80B34A8C
/* 00DCC 80B34A7C 46000187 */ neg.s $f6, $f0
/* 00DD0 80B34A80 10000003 */ beq $zero, $zero, .L80B34A90
/* 00DD4 80B34A84 E7A0003C */ swc1 $f0, 0x003C($sp)
/* 00DD8 80B34A88 46000187 */ neg.s $f6, $f0
.L80B34A8C:
/* 00DDC 80B34A8C E7A6003C */ swc1 $f6, 0x003C($sp)
.L80B34A90:
/* 00DE0 80B34A90 C61201A0 */ lwc1 $f18, 0x01A0($s0) ## 000001A0
/* 00DE4 80B34A94 C7A8003C */ lwc1 $f8, 0x003C($sp)
/* 00DE8 80B34A98 4600103E */ c.le.s $f2, $f0
/* 00DEC 80B34A9C 46089281 */ sub.s $f10, $f18, $f8
/* 00DF0 80B34AA0 4600540D */ trunc.w.s $f16, $f10
/* 00DF4 80B34AA4 440E8000 */ mfc1 $t6, $f16
/* 00DF8 80B34AA8 45000003 */ bc1f .L80B34AB8
/* 00DFC 80B34AAC AFAE0058 */ sw $t6, 0x0058($sp)
/* 00E00 80B34AB0 10000003 */ beq $zero, $zero, .L80B34AC0
/* 00E04 80B34AB4 E7A0003C */ swc1 $f0, 0x003C($sp)
.L80B34AB8:
/* 00E08 80B34AB8 46000107 */ neg.s $f4, $f0
/* 00E0C 80B34ABC E7A4003C */ swc1 $f4, 0x003C($sp)
.L80B34AC0:
/* 00E10 80B34AC0 0C00B821 */ jal func_8002E084
/* 00E14 80B34AC4 240511C7 */ addiu $a1, $zero, 0x11C7 ## $a1 = 000011C7
/* 00E18 80B34AC8 14400012 */ bne $v0, $zero, .L80B34B14
/* 00E1C 80B34ACC 3C0142B4 */ lui $at, 0x42B4 ## $at = 42B40000
/* 00E20 80B34AD0 0C03F66B */ jal Math_Rand_ZeroOne
## Rand.Next() float
/* 00E24 80B34AD4 00000000 */ nop
/* 00E28 80B34AD8 3C013F00 */ lui $at, 0x3F00 ## $at = 3F000000
/* 00E2C 80B34ADC 44813000 */ mtc1 $at, $f6 ## $f6 = 0.50
/* 00E30 80B34AE0 00000000 */ nop
/* 00E34 80B34AE4 4600303C */ c.lt.s $f6, $f0
/* 00E38 80B34AE8 00000000 */ nop
/* 00E3C 80B34AEC 45000005 */ bc1f .L80B34B04
/* 00E40 80B34AF0 00000000 */ nop
/* 00E44 80B34AF4 0C2CD3CA */ jal func_80B34F28
/* 00E48 80B34AF8 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00E4C 80B34AFC 10000049 */ beq $zero, $zero, .L80B34C24
/* 00E50 80B34B00 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34B04:
/* 00E54 80B34B04 0C2CD157 */ jal func_80B3455C
/* 00E58 80B34B08 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00E5C 80B34B0C 10000045 */ beq $zero, $zero, .L80B34C24
/* 00E60 80B34B10 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34B14:
/* 00E64 80B34B14 44814000 */ mtc1 $at, $f8 ## $f8 = 0.00
/* 00E68 80B34B18 C7AA0050 */ lwc1 $f10, 0x0050($sp)
/* 00E6C 80B34B1C C6120090 */ lwc1 $f18, 0x0090($s0) ## 00000090
/* 00E70 80B34B20 8FAF0048 */ lw $t7, 0x0048($sp)
/* 00E74 80B34B24 460A4400 */ add.s $f16, $f8, $f10
/* 00E78 80B34B28 4610903C */ c.lt.s $f18, $f16
/* 00E7C 80B34B2C 00000000 */ nop
/* 00E80 80B34B30 4502003C */ bc1fl .L80B34C24
/* 00E84 80B34B34 8FA40064 */ lw $a0, 0x0064($sp)
/* 00E88 80B34B38 85F800B6 */ lh $t8, 0x00B6($t7) ## 000000B6
/* 00E8C 80B34B3C 861900B6 */ lh $t9, 0x00B6($s0) ## 000000B6
/* 00E90 80B34B40 8FA40064 */ lw $a0, 0x0064($sp)
/* 00E94 80B34B44 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 00E98 80B34B48 03191823 */ subu $v1, $t8, $t9
/* 00E9C 80B34B4C 00031C00 */ sll $v1, $v1, 16
/* 00EA0 80B34B50 00031C03 */ sra $v1, $v1, 16
/* 00EA4 80B34B54 0C00CEAE */ jal func_80033AB8
/* 00EA8 80B34B58 A7A30042 */ sh $v1, 0x0042($sp)
/* 00EAC 80B34B5C 1440001C */ bne $v0, $zero, .L80B34BD0
/* 00EB0 80B34B60 87A30042 */ lh $v1, 0x0042($sp)
/* 00EB4 80B34B64 0C03F66B */ jal Math_Rand_ZeroOne
## Rand.Next() float
/* 00EB8 80B34B68 A7A30042 */ sh $v1, 0x0042($sp)
/* 00EBC 80B34B6C 3C0180B3 */ lui $at, %hi(D_80B37B84) ## $at = 80B30000
/* 00EC0 80B34B70 C4247B84 */ lwc1 $f4, %lo(D_80B37B84)($at)
/* 00EC4 80B34B74 3C0142A0 */ lui $at, 0x42A0 ## $at = 42A00000
/* 00EC8 80B34B78 87A30042 */ lh $v1, 0x0042($sp)
/* 00ECC 80B34B7C 4600203C */ c.lt.s $f4, $f0
/* 00ED0 80B34B80 00000000 */ nop
/* 00ED4 80B34B84 4501000E */ bc1t .L80B34BC0
/* 00ED8 80B34B88 00000000 */ nop
/* 00EDC 80B34B8C 44813000 */ mtc1 $at, $f6 ## $f6 = 80.00
/* 00EE0 80B34B90 C6080090 */ lwc1 $f8, 0x0090($s0) ## 00000090
/* 00EE4 80B34B94 4606403E */ c.le.s $f8, $f6
/* 00EE8 80B34B98 00000000 */ nop
/* 00EEC 80B34B9C 4502000D */ bc1fl .L80B34BD4
/* 00EF0 80B34BA0 8FA40064 */ lw $a0, 0x0064($sp)
/* 00EF4 80B34BA4 04600003 */ bltz $v1, .L80B34BB4
/* 00EF8 80B34BA8 00031023 */ subu $v0, $zero, $v1
/* 00EFC 80B34BAC 10000001 */ beq $zero, $zero, .L80B34BB4
/* 00F00 80B34BB0 00601025 */ or $v0, $v1, $zero ## $v0 = 00000000
.L80B34BB4:
/* 00F04 80B34BB4 284138E0 */ slti $at, $v0, 0x38E0
/* 00F08 80B34BB8 50200006 */ beql $at, $zero, .L80B34BD4
/* 00F0C 80B34BBC 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34BC0:
/* 00F10 80B34BC0 0C2CD550 */ jal func_80B35540
/* 00F14 80B34BC4 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00F18 80B34BC8 10000016 */ beq $zero, $zero, .L80B34C24
/* 00F1C 80B34BCC 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34BD0:
/* 00F20 80B34BD0 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34BD4:
/* 00F24 80B34BD4 0C00CEAE */ jal func_80033AB8
/* 00F28 80B34BD8 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 00F2C 80B34BDC 1040000E */ beq $v0, $zero, .L80B34C18
/* 00F30 80B34BE0 00000000 */ nop
/* 00F34 80B34BE4 0C03F66B */ jal Math_Rand_ZeroOne
## Rand.Next() float
/* 00F38 80B34BE8 00000000 */ nop
/* 00F3C 80B34BEC 3C013F00 */ lui $at, 0x3F00 ## $at = 3F000000
/* 00F40 80B34BF0 44815000 */ mtc1 $at, $f10 ## $f10 = 0.50
/* 00F44 80B34BF4 00000000 */ nop
/* 00F48 80B34BF8 4600503C */ c.lt.s $f10, $f0
/* 00F4C 80B34BFC 00000000 */ nop
/* 00F50 80B34C00 45000005 */ bc1f .L80B34C18
/* 00F54 80B34C04 00000000 */ nop
/* 00F58 80B34C08 0C2CD6E5 */ jal func_80B35B94
/* 00F5C 80B34C0C 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00F60 80B34C10 10000004 */ beq $zero, $zero, .L80B34C24
/* 00F64 80B34C14 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34C18:
/* 00F68 80B34C18 0C2CD3CA */ jal func_80B34F28
/* 00F6C 80B34C1C 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00F70 80B34C20 8FA40064 */ lw $a0, 0x0064($sp)
.L80B34C24:
/* 00F74 80B34C24 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 00F78 80B34C28 0C2CCFEC */ jal func_80B33FB0
/* 00F7C 80B34C2C 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000
/* 00F80 80B34C30 1440002D */ bne $v0, $zero, .L80B34CE8
/* 00F84 80B34C34 8FA80064 */ lw $t0, 0x0064($sp)
/* 00F88 80B34C38 3C090001 */ lui $t1, 0x0001 ## $t1 = 00010000
/* 00F8C 80B34C3C 01284821 */ addu $t1, $t1, $t0
/* 00F90 80B34C40 8D291DE4 */ lw $t1, 0x1DE4($t1) ## 00011DE4
/* 00F94 80B34C44 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00F98 80B34C48 312A005F */ andi $t2, $t1, 0x005F ## $t2 = 00000000
/* 00F9C 80B34C4C 55400004 */ bnel $t2, $zero, .L80B34C60
/* 00FA0 80B34C50 C61201A0 */ lwc1 $f18, 0x01A0($s0) ## 000001A0
/* 00FA4 80B34C54 0C00BE0A */ jal Audio_PlayActorSound2
/* 00FA8 80B34C58 2405383E */ addiu $a1, $zero, 0x383E ## $a1 = 0000383E
/* 00FAC 80B34C5C C61201A0 */ lwc1 $f18, 0x01A0($s0) ## 000001A0
.L80B34C60:
/* 00FB0 80B34C60 8FA2005C */ lw $v0, 0x005C($sp)
/* 00FB4 80B34C64 8FAD0058 */ lw $t5, 0x0058($sp)
/* 00FB8 80B34C68 4600940D */ trunc.w.s $f16, $f18
/* 00FBC 80B34C6C 440C8000 */ mfc1 $t4, $f16
/* 00FC0 80B34C70 00000000 */ nop
/* 00FC4 80B34C74 504C001D */ beql $v0, $t4, .L80B34CEC
/* 00FC8 80B34C78 8FBF0034 */ lw $ra, 0x0034($sp)
/* 00FCC 80B34C7C 1DA0001A */ bgtz $t5, .L80B34CE8
/* 00FD0 80B34C80 C7A4003C */ lwc1 $f4, 0x003C($sp)
/* 00FD4 80B34C84 4600218D */ trunc.w.s $f6, $f4
/* 00FD8 80B34C88 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00FDC 80B34C8C 440F3000 */ mfc1 $t7, $f6
/* 00FE0 80B34C90 00000000 */ nop
/* 00FE4 80B34C94 01E2C021 */ addu $t8, $t7, $v0
/* 00FE8 80B34C98 5B000014 */ blezl $t8, .L80B34CEC
/* 00FEC 80B34C9C 8FBF0034 */ lw $ra, 0x0034($sp)
/* 00FF0 80B34CA0 0C00BE0A */ jal Audio_PlayActorSound2
/* 00FF4 80B34CA4 2405385A */ addiu $a1, $zero, 0x385A ## $a1 = 0000385A
/* 00FF8 80B34CA8 3C014040 */ lui $at, 0x4040 ## $at = 40400000
/* 00FFC 80B34CAC 44814000 */ mtc1 $at, $f8 ## $f8 = 3.00
/* 01000 80B34CB0 24190003 */ addiu $t9, $zero, 0x0003 ## $t9 = 00000003
/* 01004 80B34CB4 24080032 */ addiu $t0, $zero, 0x0032 ## $t0 = 00000032
/* 01008 80B34CB8 24090032 */ addiu $t1, $zero, 0x0032 ## $t1 = 00000032
/* 0100C 80B34CBC 240A0001 */ addiu $t2, $zero, 0x0001 ## $t2 = 00000001
/* 01010 80B34CC0 AFAA0020 */ sw $t2, 0x0020($sp)
/* 01014 80B34CC4 AFA9001C */ sw $t1, 0x001C($sp)
/* 01018 80B34CC8 AFA80018 */ sw $t0, 0x0018($sp)
/* 0101C 80B34CCC AFB90010 */ sw $t9, 0x0010($sp)
/* 01020 80B34CD0 8FA40064 */ lw $a0, 0x0064($sp)
/* 01024 80B34CD4 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 01028 80B34CD8 26060024 */ addiu $a2, $s0, 0x0024 ## $a2 = 00000024
/* 0102C 80B34CDC 3C0741A0 */ lui $a3, 0x41A0 ## $a3 = 41A00000
/* 01030 80B34CE0 0C00CC98 */ jal func_80033260
/* 01034 80B34CE4 E7A80014 */ swc1 $f8, 0x0014($sp)
.L80B34CE8:
/* 01038 80B34CE8 8FBF0034 */ lw $ra, 0x0034($sp)
.L80B34CEC:
/* 0103C 80B34CEC 8FB00030 */ lw $s0, 0x0030($sp)
/* 01040 80B34CF0 27BD0060 */ addiu $sp, $sp, 0x0060 ## $sp = 00000000
/* 01044 80B34CF4 03E00008 */ jr $ra
/* 01048 80B34CF8 00000000 */ nop
| {
"pile_set_name": "Github"
} |
//
// ASAsciiArtBoxCreator.mm
// Texture
//
// Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
// Changes after 4/13/2017 are: Copyright (c) Pinterest, Inc. All rights reserved.
// Licensed under Apache 2.0: http://www.apache.org/licenses/LICENSE-2.0
//
#import <AsyncDisplayKit/ASAsciiArtBoxCreator.h>
#import <CoreGraphics/CoreGraphics.h>
static const NSUInteger kDebugBoxPadding = 2;
typedef NS_ENUM(NSUInteger, PIDebugBoxPaddingLocation)
{
PIDebugBoxPaddingLocationFront,
PIDebugBoxPaddingLocationEnd,
PIDebugBoxPaddingLocationBoth
};
@interface NSString(PIDebugBox)
@end
@implementation NSString(PIDebugBox)
+ (instancetype)debugbox_stringWithString:(NSString *)stringToRepeat repeatedCount:(NSUInteger)repeatCount NS_RETURNS_RETAINED
{
NSMutableString *string = [[NSMutableString alloc] initWithCapacity:[stringToRepeat length] * repeatCount];
for (NSUInteger index = 0; index < repeatCount; index++) {
[string appendString:stringToRepeat];
}
return [string copy];
}
- (NSString *)debugbox_stringByAddingPadding:(NSString *)padding count:(NSUInteger)count location:(PIDebugBoxPaddingLocation)location
{
NSString *paddingString = [NSString debugbox_stringWithString:padding repeatedCount:count];
switch (location) {
case PIDebugBoxPaddingLocationFront:
return [NSString stringWithFormat:@"%@%@", paddingString, self];
case PIDebugBoxPaddingLocationEnd:
return [NSString stringWithFormat:@"%@%@", self, paddingString];
case PIDebugBoxPaddingLocationBoth:
return [NSString stringWithFormat:@"%@%@%@", paddingString, self, paddingString];
}
return [self copy];
}
@end
@implementation ASAsciiArtBoxCreator
+ (NSString *)horizontalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent
{
if ([children count] == 0) {
return parent;
}
NSMutableArray *childrenLines = [NSMutableArray array];
// split the children into lines
NSUInteger lineCountPerChild = 0;
for (NSString *child in children) {
NSArray *lines = [child componentsSeparatedByString:@"\n"];
lineCountPerChild = MAX(lineCountPerChild, [lines count]);
}
for (NSString *child in children) {
NSMutableArray *lines = [[child componentsSeparatedByString:@"\n"] mutableCopy];
NSUInteger topPadding = ceil((CGFloat)(lineCountPerChild - [lines count])/2.0);
NSUInteger bottomPadding = (lineCountPerChild - [lines count])/2.0;
NSUInteger lineLength = [lines[0] length];
for (NSUInteger index = 0; index < topPadding; index++) {
[lines insertObject:[NSString debugbox_stringWithString:@" " repeatedCount:lineLength] atIndex:0];
}
for (NSUInteger index = 0; index < bottomPadding; index++) {
[lines addObject:[NSString debugbox_stringWithString:@" " repeatedCount:lineLength]];
}
[childrenLines addObject:lines];
}
NSMutableArray *concatenatedLines = [NSMutableArray array];
NSString *padding = [NSString debugbox_stringWithString:@" " repeatedCount:kDebugBoxPadding];
for (NSUInteger index = 0; index < lineCountPerChild; index++) {
NSMutableString *line = [[NSMutableString alloc] init];
[line appendFormat:@"|%@",padding];
for (NSArray *childLines in childrenLines) {
[line appendFormat:@"%@%@", childLines[index], padding];
}
[line appendString:@"|"];
[concatenatedLines addObject:line];
}
// surround the lines in a box
NSUInteger totalLineLength = [concatenatedLines[0] length];
if (totalLineLength < [parent length]) {
NSUInteger difference = [parent length] + (2 * kDebugBoxPadding) - totalLineLength;
NSUInteger leftPadding = ceil((CGFloat)difference/2.0);
NSUInteger rightPadding = difference/2;
NSString *leftString = [@"|" debugbox_stringByAddingPadding:@" " count:leftPadding location:PIDebugBoxPaddingLocationEnd];
NSString *rightString = [@"|" debugbox_stringByAddingPadding:@" " count:rightPadding location:PIDebugBoxPaddingLocationFront];
NSMutableArray *paddedLines = [NSMutableArray array];
for (NSString *line in concatenatedLines) {
NSString *paddedLine = [line stringByReplacingOccurrencesOfString:@"|" withString:leftString options:NSCaseInsensitiveSearch range:NSMakeRange(0, 1)];
paddedLine = [paddedLine stringByReplacingOccurrencesOfString:@"|" withString:rightString options:NSCaseInsensitiveSearch range:NSMakeRange([paddedLine length] - 1, 1)];
[paddedLines addObject:paddedLine];
}
concatenatedLines = paddedLines;
// totalLineLength += difference;
}
concatenatedLines = [self appendTopAndBottomToBoxString:concatenatedLines parent:parent];
return [concatenatedLines componentsJoinedByString:@"\n"];
}
+ (NSString *)verticalBoxStringForChildren:(NSArray *)children parent:(NSString *)parent
{
if ([children count] == 0) {
return parent;
}
NSMutableArray *childrenLines = [NSMutableArray array];
NSUInteger maxChildLength = 0;
for (NSString *child in children) {
NSArray *lines = [child componentsSeparatedByString:@"\n"];
maxChildLength = MAX(maxChildLength, [lines[0] length]);
}
NSUInteger rightPadding = 0;
NSUInteger leftPadding = 0;
if (maxChildLength < [parent length]) {
NSUInteger difference = [parent length] + (2 * kDebugBoxPadding) - maxChildLength;
leftPadding = ceil((CGFloat)difference/2.0);
rightPadding = difference/2;
}
NSString *rightPaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:rightPadding + kDebugBoxPadding];
NSString *leftPaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:leftPadding + kDebugBoxPadding];
for (NSString *child in children) {
NSMutableArray *lines = [[child componentsSeparatedByString:@"\n"] mutableCopy];
NSUInteger leftLinePadding = ceil((CGFloat)(maxChildLength - [lines[0] length])/2.0);
NSUInteger rightLinePadding = (maxChildLength - [lines[0] length])/2.0;
for (NSString *line in lines) {
NSString *rightLinePaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:rightLinePadding];
rightLinePaddingString = [NSString stringWithFormat:@"%@%@|", rightLinePaddingString, rightPaddingString];
NSString *leftLinePaddingString = [NSString debugbox_stringWithString:@" " repeatedCount:leftLinePadding];
leftLinePaddingString = [NSString stringWithFormat:@"|%@%@", leftLinePaddingString, leftPaddingString];
NSString *paddingLine = [NSString stringWithFormat:@"%@%@%@", leftLinePaddingString, line, rightLinePaddingString];
[childrenLines addObject:paddingLine];
}
}
childrenLines = [self appendTopAndBottomToBoxString:childrenLines parent:parent];
return [childrenLines componentsJoinedByString:@"\n"];
}
+ (NSMutableArray *)appendTopAndBottomToBoxString:(NSMutableArray *)boxStrings parent:(NSString *)parent
{
NSUInteger totalLineLength = [boxStrings[0] length];
[boxStrings addObject:[NSString debugbox_stringWithString:@"-" repeatedCount:totalLineLength]];
NSUInteger leftPadding = ceil(((CGFloat)(totalLineLength - [parent length]))/2.0);
NSUInteger rightPadding = (totalLineLength - [parent length])/2;
NSString *topLine = [parent debugbox_stringByAddingPadding:@"-" count:leftPadding location:PIDebugBoxPaddingLocationFront];
topLine = [topLine debugbox_stringByAddingPadding:@"-" count:rightPadding location:PIDebugBoxPaddingLocationEnd];
[boxStrings insertObject:topLine atIndex:0];
return boxStrings;
}
@end
| {
"pile_set_name": "Github"
} |
/* Generated by RuntimeBrowser.
*/
@protocol _UISearchControllerPresenting <NSObject>
@required
- (UIPresentationController<_UISearchControllerPresenting> *)adaptivePresentationController;
- (bool)animatorShouldLayoutPresentationViews;
- (unsigned long long)edgeForHidingNavigationBar;
- (struct CGRect { struct CGPoint { double x_1_1_1; double x_1_1_2; } x1; struct CGSize { double x_2_1_1; double x_2_1_2; } x2; })finalFrameForContainerView;
- (bool)forceObeyNavigationBarInsets;
- (double)resultsControllerContentOffset;
- (bool)resultsUnderlapsSearchBar;
- (bool)searchBarCanContainScopeBar;
- (UIView *)searchBarContainerView;
- (bool)searchBarShouldClipToBounds;
- (bool)searchBarToBecomeTopAttached;
- (void)setContentVisible:(bool)arg1;
- (bool)shouldAccountForStatusBar;
- (double)statusBarAdjustment;
@end
| {
"pile_set_name": "Github"
} |
// Distributed under the terms of the MIT license
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
// Test case found by fuzzing
if true{}}protocol A{
enum a:a
typealias e:a
class a<T:a func a
| {
"pile_set_name": "Github"
} |
on:
push:
tags:
- "v*"
name: Test and Release
jobs:
npm-test:
name: JavaScript Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v1
- name: Install depdencies
run: yarn
- name: Run Tests
run: yarn test
go-test:
name: Go Tests
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v1
with:
go-version: 1.15.x
- name: Checkout code
uses: actions/checkout@v2
- name: Run Go Tests with Coverage
run: go test -cover ./...
int-test:
needs: [go-test, npm-test]
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build images
run: docker-compose -f integration/docker-compose.test.yml build
- name: Run tests
run: docker-compose -f integration/docker-compose.test.yml run integration
buildx:
needs: [int-test]
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
qemu-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker Login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Run Buildx
run: make publish
| {
"pile_set_name": "Github"
} |
# 對話框
對話框是在告知使用者緊急的訊息,要求使用者做出決定,或者在一個分散的過程中包裝成多個任務。由於對話框是一種中斷性突然顯示並且停止使用者當前的任務和需要關注對話框裏的內容。並非每個選擇、設定或者細節都是像中途中斷或是明顯的方式。
可替代對話框的元件包含簡易的菜單或者當前內容區域內擴展內容。這兩種方法提供訊息或者同時保持當前內文與比較少破壞性的選擇。
## 內容
對話框的內容可以有廣泛的變化,不過典型的做法是通常包含內文或者 UI 控制元件在特定的任務或程序,就像確認項目的刪除或是選擇一種設定。
使用對話框的內容區域可揭露更多的訊息或者更進階的內容。避免從對話框裡面又打開對話框。
全螢幕的對話框可能會打開更多的對話框,比如顏色選取器,因為它們所設計的材料必須做為附加層,且不增加感知的 z 深度的應用或是增加視覺聲音。
避免產生有滾動式內容的對話框,特別是提示視窗。相反的,須考慮正在閱讀或者具有交互資料的大量內容,必要時使用替代性的容器或者佈局。


## 行為
對話框是獨立在基礎本體上並且不會與本體造成滾動。
某些類型的對話內容,自然需要一些滾動,比如較長的鈴聲。在這樣的情況下,將預設顯示滾動條明顯顯示資料內容。
對話框不應該被其他元素或是只出現部分在螢幕上所掩蓋。對話框總是保持明顯的關注,直到它們被確認或是反向的選擇行為。比如選擇設定。

## 警告
警告是用來通知使用者需要在繼續前進之前的一種確認或是確認狀況的行為。它們是基於在一個嚴重性與傳遞訊息且有外觀會有稍微不同。
警告是一種干擾性質與緊急迫切的,並且在做出決定之前防止使用者繼續進行下個階段。
**澄清:**相對於警告訊息,[Snackbars](components-snackbars-and-toasts.html) 目前是可選的,但是重要的訊息或者動作,通常會出現在一個操作之後。例如,使用警告確認刪除草稿。使用 Snackbars 呈現一個取消動作,因為操作是可以選的,使用者可以在無需採取動作下繼續的使用它們主要的任務。
**警告不包含標題欄位**
大部份的警告不需要使用標題欄位。通常的狀況下,決定不具有嚴重的影響,它是可以在一兩個句子簡潔的方式描述。內容區域可以詢問問題(例如:“刪除” 的對話)或者做出一個明確的描述,其操作的按鈕是容易明顯的。

> 建議的做法。
>
> 刪除的操作文本很清楚地表明決策的結果。

> 不建議的做法。
>
> 在否定動作文字 No 答案,不建議後面會發生什麼事。更好的操作是需要將取消以及刪除的按鈕一併做出明顯的顯示。
**警告包含標題欄位**
使用警告包含標題欄位時需謹慎使用。它們只用在高風險的情況下使用,例如資料有潛在的遺失或是資料連接或者有額外費用的訊息。
如果標題是必填的,那麼在內容區域的地方使用清楚的問題或是補充說明的陳述。例如,“是否刪除 USB 儲存?”
避免道歉狀況,以及模糊的陳述或者問題。例如。“警告!” 或者 “您是否確定?”
使用者應該能夠完全跳過內容,並且仍然根據標題及操作按鈕上的文字呈現一個清楚的概念提供使用者的選擇。

> 建議的做法。
>
> 這個對話筐提出了一個具體的問題,扼要的闡述影響並且提供一個明確的動作。

> 不建議的做法。
>
> 這個對話框構成了一個模稜兩可的問題以及不清楚的影響範圍。
## 簡易選單
簡易選單都使用在平板、行動裝置上的列表圖示,用來顯示特定的列表選項。簡易選單選擇後會立即提交選擇。可參考 [元件 > 選單 > 簡易選單](components-menus.html) 有更多細節關於簡易選單。
**澄清:**相對於簡易選單,簡易對話框能夠呈現選項的附加細節,或者是提供導航在主要流程中的相關選擇。雖然他們能夠顯示相同的內容,簡易選單更優於簡易對話框,因為簡易選單對於目前使用者的畫面破壞性較少。

## 簡易對話框
簡易對話框能夠提供附加的細節以及用於列表的選項,或是提供導航等其他相關的主要任務。舉例來說,簡易對話框能夠顯示頭像、圖示、相關的內文,或者是他們能夠讓使用者增加非目前列表上的一個帳戶。
選擇一個選項將立即被提交並且關閉選單。
點擊對話框的外部,或是倒退、取消將會關閉對話框。
簡易對話框比簡易選單更具有干擾性,應該謹慎使用。


簡易對話框沒有明確的接受及取消按鈕。
簡易對話框顯示在屏幕的垂直及水平中央。
對話框在距離邊緣的距離,左右最小為40dp,上下最小為24dp。
對話框的邊緣與內容之間的距離是24dp。

> 別這麼做

> 別這麼做
## 確認對話框
確認對話框,需要使用者明確確認他們的選擇在提交之前。舉例來說,使用者可以聽到許多的鈴聲,但只有點擊"OK"這個選擇才會被提交。
在確認對話框終點取消、倒退、取消動作、放棄修改並關閉視窗。
點擊確認對話框的外部將不會有任何動作;使用者必須明確的確認或是取消以關閉確認對話框。

> 在使用者在確認對話框選擇OK之前,鈴聲的選則是不會被設置的。

確認對話框能夠使用其他佈局,舉例來說一個日期的選取器,但他們仍然集中在一個特定的值(選個日期,但不包含時間)。


確認對話框提供一個明確的確認按鈕及一個明確的取消按鈕。明確的取消按鈕會表明離開確認對話框將會放棄所有變更,舉例來說,點擊取消或是按下倒退。
確認對話框應該避免彈出額外的簡易對話框或是選單。Material的額外圖層會增加應用程式Z軸深度,以及不必要的視覺複雜化。
如果需要額外的簡易對話框或是選單來完成任務或是進度,考慮使用全屏對話框取代確認對話框。

> 好的做法
>
> 提供一個明確的確認按鈕及明確的取消按鈕。

> 別這麼做
>
> 一個單獨的對話框按鈕在系統倒退功能造成模糊不清:這是倒退取消還是確認功能?
## 全屏對話框
**只有行動版**: 因為行動裝置的限制,對話框的顯示還有許多其他形式(平板、桌機等),可能有更適合的方式來取代全屏對話框。
全屏對話框可以用來將複雜操作的任務群組化,這需要一個明確的指示,像是存擋或是創建、在變更前的提交或是放棄,舉例來說,創建立日期的輸入。
全屏對話框能夠將複雜的編排最小化顯示,以material方式層疊
(對話框上的對話框),他增加了應用程式的Z軸深度。它們能夠獨立每個單獨的任務並彈出簡易的選單,或者是複雜操作的一部分。
當內容或是進度符合以下任何的條件,考慮使用全屏對話框。
- 對話框的內容包含元件,像是選取器(日曆)或是表單需要IME輸入。
- 當變更不會被即時儲存。
- 當應用程式沒有草稿的功能時。
- 當操作排程需要被依序改變提交時。
在這範例中,全屏的對話框提供一個簡易的對話框用來選取日期。全屏對話框沒有修改以及選擇,而是當被點擊時儲存。點擊"X"金會取消所有變更,並且離開全屏對話框。

> 全屏對話框

> 從全屏對話框打開日曆選取器
全屏對話框中,確認及取消動作在畫面的頂部。
確認動作是在螢幕的右上角,並使用正確的描述用語,像是"存檔"、"送出"、"增加"、"分享"、"更新"、"建立"*(原文:“save”, “send”, “add”, “share”, “update”, or “create”)*。
別使用模糊的詞像是"完成"、"好"、"關閉"*(原文: “done” or “ok” or “close” )*來表示確認動作。這些都與"X"的語意太相近了,且結果沒什麼不同。
在對話框中所有強制性的條件被滿足之前,確認功能是無效的。
放棄動作的功能,一個"X"在屏幕的左上方,關閉全屏對話框以及放棄所有更動。倒退按鈕相等於放棄的動作。
如果使用者有做任何的更動,他們會提示放棄更動的動作。
如果沒有任何更動,點擊"X"或是倒退會立即關閉對話框,也不會有放棄確認的需求。

> 別這麼做
>
> 別用模糊的用詞像是關閉在確認動作上。
"X"不同於向上的箭頭,它是使用在畫面狀態不斷的被儲存,或者是應用程式有儲存草稿或有自動儲存的功能。舉例來說,向上箭頭用在被應用在設定上,因為所有的改變都會立即的被提交。在這些情況下,倒退按鈕的導航及行為將會配合向上箭頭的功能,且沒有明確的確認或是取消的行為。

> 向上的箭頭在這例子中說明,任何的改變將會被立即儲存。

> 點擊"X"在這設定的範例將會取消所有改變,只有在點擊"儲存"時才會被存檔。
## 規範
對話框包含了一個標題、內文、及互動元件。
這個標題簡單描述了需要選則的類型。標題應該總是顯示在整體之中,並應該在需要時使用。標題可以用來描述在正做出的決定。舉例來說:標題可以用來說明目前在對話框中的進度,這進度可能是在設置中的將受到的決定。
對話框的內容相當的廣泛,但一般來說內文或UI控制元素是集中在一個特定的任務或是進度,如確認項目的缺失或是選擇一個設置。
當需要時,動作被執行核定、駁回特定選擇、或是由對話框內容呈現進度。

#### 親和性的注意事項
為了確保對殘疾人們的可用性,請確保你的按鈕有36dp的最低高度,但可觸摸的的目標有48的最低高度
所有對話框的操作文字預設顏色是應用程式的主題強調色。總是確保操作文字顏色有[足夠的對比度](usability-accessibility.html),且滿足親和性的規範。改變預設文字色彩當需要足夠的的對比。

對話框呈現一個集中和受到限制的一套動作,通常來說包含核定及取消。
核定的動作放置在右方,並且繼續流程。核定動作也可能是具破壞性的,像是刪除或是移除。
取消動作放置在核定動作的左方,並且返回使用原本的畫面或是到特定的流程中。
取消及核定動作文字可以是"Cancel/OK"或者是更具體的主動詞或片語,能夠表示決定的結果。

> 不好的做法
>
> 取消動作總是放置在核定動作的左方
### 按鈕寬度及內距指南



### 並排按鈕
在使用並排按鈕時,建議每個按鈕的文字不要超過按鈕的最大寬度,如常用的確認/取消按鈕。
用下面公式來計算對話框的按鈕最大寬度。
對話框按鈕的最大寬度 = **(Dialog width - 16dp - 16dp - 8dp) / 2**
舉例來說
寬度280dp對話框的按鈕最大寬度 = (280dp - 16dp - 16dp - 8dp) / 2 = 120dp

### 堆疊式全寬按鈕
當文字標籤超過了最大寬度,使用堆疊式按鈕容納本文。核定的按鈕會堆疊在取消的上方。

> *翻譯:[Weiju Tu](https://www.facebook.com/weiju516)* | {
"pile_set_name": "Github"
} |
# frozen_string_literal: true
module Stupidedi
module Versions
module ThirtyFifty
module SegmentDefs
s = Schema
e = ElementDefs
r = ElementReqs
PLD = s::SegmentDef.build(:PLD, "Pallet Information",
"To specify pallet information including quantity, exchange, and
weight",
e::E406 .simple_use(r::Mandatory, s::RepeatCount.bounded(1)),
e::E399 .simple_use(r::Optional, s::RepeatCount.bounded(1)),
e::E188 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
e::E81 .simple_use(r::Relational, s::RepeatCount.bounded(1)),
SyntaxNotes::P.build(3, 4))
end
end
end
end
| {
"pile_set_name": "Github"
} |
[Desktop Entry]
Encoding=UTF-8
Type=Directory
Name=Arcade
Icon=applications-games-arcade
#TRANSLATIONS_DIR=translations
# Translations
Name[ms]=Arked
| {
"pile_set_name": "Github"
} |
<!-- Converted by db4-upgrade version 1.1 -->
<article xmlns="http://docbook.org/ns/docbook" version="5.0">
<info>
<abstract>
<para><emphasis role="strong">Note:</emphasis> This
document lists changes only since the 1.78.1 release.
If you instead want a record of the complete list of
changes for the codebase over its entire history, you
can obtain one by running the following commands:
<screen> <code>svn checkout svn://svn.code.sf.net/p/docbook/code/trunk/xsl</code>
<code>svn log --xml --verbose xsl > ChangeHistory.xml</code></screen></para>
</abstract>
</info><title>Changes since the 1.78.1 release</title>
<section xml:id="V1.79.1">
<title>Release Notes: 1.79.1</title>
<para>The following is a list of changes that have been made
since the 1.78.1 release.</para>
<section xml:id="V1.79.1_Gentext">
<title>Gentext</title>
<para>The following changes have been made to the
<filename>gentext</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: locale/hu.xml</literal></para><screen><phrase role="commit-message">Check in <tag>PubDate</tag> fixes from bug #1372</phrase></screen>
</listitem>
<listitem>
<para><literal>Dongsheng Song: locale/zh.xml; locale/zh_cn.xml</literal></para><screen><phrase role="commit-message">Fix Auditlocale.pl warning.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/en.xml</literal></para><screen><phrase role="commit-message">Add elements dialogue, drama, and poetry from DocBook Publishers.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/pt.xml</literal></para><screen><phrase role="commit-message">updates from DocBook user.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/en.xml</literal></para><screen><phrase role="commit-message">Fix wording.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/en.xml</literal></para><screen><phrase role="commit-message">Fix line breaks.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/en.xml</literal></para><screen><phrase role="commit-message">Add text message for unsupported video and audio.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: xsl/xsl-primary-is-locale.xsl</literal></para><screen><phrase role="commit-message">Initial work on Ant build, common (L10N) directory handled so far</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/ur.xml</literal></para><screen><phrase role="commit-message">Add <tag>email</tag> <tag>address</tag> for contributor.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/ur.xml</literal></para><screen><phrase role="commit-message">Check in contributed locale file from Wasif Hasan Baig,
contributed through SourceForge Patch # 187.</phrase></screen>
</listitem>
<listitem>
<para><literal>kasunbg: locale/nl.xml</literal></para><screen><phrase role="commit-message">Committing Dutch translations of DocBook WebHelp. Patch provided by Marja van Waes.</phrase></screen>
</listitem>
<listitem>
<para><literal>kasunbg: locale/ru.xml</literal></para><screen><phrase role="commit-message">Committing patch for Russian translations of webhelp. Patch provided by Alex Loginov and Yuri Chornoivan. Patch #1325</phrase></screen>
</listitem>
<listitem>
<para><literal>kasunbg: locale/uk.xml</literal></para><screen><phrase role="commit-message">Committing Ukrainian translations for Webhelp. Patch by Yuri Chornoivan. Patch #1324</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: locale/ca.xml; locale/da.xml; locale/cs.xml; locale/es.xml; locale/fr.xml; local⋯</literal></para><screen><phrase role="commit-message">Added missing <tag>keycap</tag> context for ca, cs, da, es, et, eu, and fr</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: locale/en.xml; locale/de.xml</literal></para><screen><phrase role="commit-message">Added option key for <tag>keycap</tag> context</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: locale/de.xml</literal></para><screen><phrase role="commit-message">Added key="optional-step" as done in r9745</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: locale/en.xml</literal></para><screen><phrase role="commit-message">Add key="optional-step".</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Gentext changes for 1.79.1-->
<section xml:id="V1.79.1_Common">
<title>Common</title>
<para>The following changes have been made to the
<filename>common</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>tom_schr: common.xsl</literal></para><screen><phrase role="commit-message">Added quotes around linkend to make spaces visible</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added ant build for HTML stylesheets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Initial work on Ant build, common (L10N) directory handled so far</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titles.xsl</literal></para><screen><phrase role="commit-message">Replace hardcoded English text for <tag>question</tag> and <tag>answer</tag> elements
in mode="title.markup" with localized templates.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: addns.xsl</literal></para><screen><phrase role="commit-message">Move addns.xsl module from releasetools to common in preparation
for switching to ns as the base stylesheets.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: l10n.xml; Makefile</literal></para><screen><phrase role="commit-message">Add new locale file ur.xml for Urdu.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titles.xsl</literal></para><screen><phrase role="commit-message">Add missing template with match="<tag>toc</tag>" mode="title.markup".</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: titles.xsl</literal></para><screen><phrase role="commit-message">Fixed problem when referencing empty ulinks; use @url instead</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: olink.xsl</literal></para><screen><phrase role="commit-message">Make <tag>olink</tag> errors/warnings overridable in customizations.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: labels.xsl</literal></para><screen><phrase role="commit-message">Pass the object referenced as a parameter to mode="intralabel.punctuation"
template.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: olink.xsl</literal></para><screen><phrase role="commit-message">1. Make page citations on <<tag>xref</tag>/> to paragraphs conditional on a new parameter,
$insert.xref.page.number.para, default to 'yes' (before, page citations were
added unconditionally). Remove similar special-casing for <<tag>link</tag>/>.
2. Disable page citations for @xrefstyle="template:..." (if needed, they
can be added with %p in the template - but they can't be disabled).</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: olink.xsl; titles.xsl; common.xsl</literal></para><screen><phrase role="commit-message">Pass referrer and target params to mode="xrefstyle" to allow customizations
to be more specific.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: olink.xsl; titles.xsl; common.xsl</literal></para><screen><phrase role="commit-message">Add mode="xrefstyle" to replace many instances of redundant
code determining the xrefstyle with xsl:apply-templates
select="." mode="xrefstyle". Also allows stylesheet
customization to specify an xrefstyle per element type.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: gentext.xsl; labels.xsl</literal></para><screen><phrase role="commit-message">Add support for <tag>procedure</tag> <tag>title</tag> contained in <tag>info</tag> or blockinfo.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: common.xsl</literal></para><screen><phrase role="commit-message">In person.name template, change 'style' variable to a param
so the name style can be selected by passing a param.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: gentext.xsl</literal></para><screen><phrase role="commit-message">Fix bug in <parameter>collect.xref.targets</parameter> that failed when $referrer template
param not set by <tag>olink</tag>'s xref-to. Fixed using submitted patch.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Common changes for 1.79.1-->
<section xml:id="V1.79.1_FO">
<title>FO</title>
<para>The following changes have been made to the
<filename>fo</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: lists.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1368 "<tag>link</tag> to <tag>term</tag> with id does not work"</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: block.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1367 double <tag>attribution</tag> in <tag>epigraph</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.xweb; param.ent</literal></para><screen><phrase role="commit-message">Add missing <parameter>profile.outputformat</parameter> param.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: publishers.xsl</literal></para><screen><phrase role="commit-message">Fix namespace declarations.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Add default attribute-sets for new Publishers elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.ent</literal></para><screen><phrase role="commit-message">Fix typo</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.templates.xml</literal></para><screen><phrase role="commit-message">Add new DocBook Publishers elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Add inclusion of new publishers.xsl module.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: publishers.xsl</literal></para><screen><phrase role="commit-message">Stylesheet module added to support new elements in DocBook Publishers.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.xweb; param.ent</literal></para><screen><phrase role="commit-message">Add the 9 new attribute sets for DocBook Publishers.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1355 <tag>glossseealso</tag> generates duplicate id in certain cases.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">fix bug #1360 <tag>indexterm</tag> in <tag>varlistentry</tag>/<tag>term</tag> generates an error when <tag>xref</tag> to that <tag>term</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix bug #13598 inline.monoseq and other inline.*seq handle links incorrectly.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: pi.xsl</literal></para><screen><phrase role="commit-message">Fix bug in dbfo-need for admonitions, and get dbfo-need
working properly in FOP1.1.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: pagesetup.xsl</literal></para><screen><phrase role="commit-message">Remove obsolete hardcoded margin-left="0pt" for the block
containing header or footer.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: graphics.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1336 to add support for recognizing
file:/ image URLs as absolute paths.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autotoc.xsl</literal></para><screen><phrase role="commit-message">Add support in <tag>TOC</tag> for <tag>article</tag> as child of set.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1337 Elements with <tag>olink</tag> role do not behave as <tag>olink</tag>
elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added ant build for FO</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: inline.xsl</literal></para><screen><phrase role="commit-message">Only count regular <<tag>emphasis</tag>> elements (without @role="bold", etc) when determining
whether nested <tag>emphasis</tag> needs to be displayed in italics or in regular; otherwise,
the order of nesting in <<tag>emphasis</tag> role="bold"> and <<tag>emphasis</tag>> affects the font
used.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: fop1.xsl; ptc.xsl</literal></para><screen><phrase role="commit-message">Apply patch #190 to include refsections in bookmarks for fop1 and
ptc.xsl.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: block.xsl</literal></para><screen><phrase role="commit-message">Change the <tag>epigraph</tag> template to support schema extensions
by processing all of its children instead of specific elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: pagesetup.xsl</literal></para><screen><phrase role="commit-message">Added "user.declarations" hook to implemented [#1330]
Added empty "user.declarations" template to make it easier for adding
custom fo:declaration elements. The template is empty by default.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix test for nested links.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: biblio.xsl</literal></para><screen><phrase role="commit-message">Now <tag>biblioset</tag> outputs its id if it has one.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">pass xrefstyle param from <tag>link</tag> element to gentext.template so
optional page number can be formatted to a style.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Streamline handling of namespace fixup in preparation for making
the namespaced version the source base.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: fo.xsl</literal></para><screen><phrase role="commit-message">FOP 1.1 now supports writing-mode="rl-tb", so add that change to the
$direction.mode parameter.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autoidx.xsl</literal></para><screen><phrase role="commit-message">Add missing xlink namespace declaration to the root element.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.xweb; param.ent; autoidx.xsl</literal></para><screen><phrase role="commit-message">Add support for $autolink.index.see to automatically form links
between see and <tag>seealso</tag> <tag>index</tag> elements and <tag>primary</tag> elements
in the <tag>index</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Add element name to warning message for nested links.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1306: warn of nested links.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: component.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1320 so template page.sequence tests $content to make
sure it is not empty.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autotoc.xsl; refentry.xsl; param.xweb; docbook.xsl; param.ent; component.x⋯</literal></para><screen><phrase role="commit-message">Add support for $show.bookmarks param to turn bookmarks on or
off.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Add missing variable bookmarks.state.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Add missing $document.element variable to new generate.bookmarks
template.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autotoc.xsl; refentry.xsl; param.xweb; docbook.xsl; param.ent; component.x⋯</literal></para><screen><phrase role="commit-message">Add support for standard XSL 1.1 bookmarks and parameter
$xsl1.1.bookmarks to turn them on or off.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: xref.xsl</literal></para><screen><phrase role="commit-message">Fix invalid href generated if $insert.olink.pdf.frag=0 and $fop1.extensions=1.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: autotoc.xsl; param.xweb; param.ent; toc.xsl</literal></para><screen><phrase role="commit-message">Replace <tag>literal</tag> space inserted next to fo:leader in <tag>ToC</tag> with a padding. This
works around a bug in FOP (see FOP-1444).
Make <tag>ToC</tag> fo:leader properties configurable via attribute set.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: titlepage.templates.xml</literal></para><screen><phrase role="commit-message">Remove autoguessing of the namespace for wrapper elements; determine namespace by prefix, if any.</phrase></screen>
</listitem>
<listitem>
<para><literal>Mauritz Jeanson: table.xsl</literal></para><screen><phrase role="commit-message">Bug #1246: added missing with-param.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: xref.xsl</literal></para><screen><phrase role="commit-message">Make <tag>olink</tag> errors/warnings overridable in customizations.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: param.xweb; param.ent; xref.xsl</literal></para><screen><phrase role="commit-message">1. Make page citations on <<tag>xref</tag>/> to paragraphs conditional on a new parameter,
$insert.xref.page.number.para, default to 'yes' (before, page citations were
added unconditionally). Remove similar special-casing for <<tag>link</tag>/>.
2. Disable page citations for @xrefstyle="template:..." (if needed, they
can be added with %p in the template - but they can't be disabled).</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: fop1.xsl</literal></para><screen><phrase role="commit-message">Skip generating fox:destination on a <tag>footnote</tag> - id attribute on footnotes is not
passed to generated FO, so FOP complains about unresolved ID in destination.</phrase></screen>
</listitem>
<listitem>
<para><literal>Mauritz Jeanson: lists.xsl</literal></para><screen><phrase role="commit-message">Fixed typo.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: lists.xsl</literal></para><screen><phrase role="commit-message">Fixed bug#1311 and added missing <parameter>para.properties</parameter></phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Pass referrer and target params to mode="xrefstyle" to allow customizations
to be more specific.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Add mode="xrefstyle" to replace many instances of redundant
code determining the xrefstyle with xsl:apply-templates
select="." mode="xrefstyle". Also allows stylesheet
customization to specify an xrefstyle per element type.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: xref.xsl</literal></para><screen><phrase role="commit-message">Pass referrer and xrefstyle to "xref-to-suffix" and "xref-to-prefix"
modes (to use the same signature than "xref-to" mode) as discussed with
Bob on the mailinglist (2013-09-12)</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: pi.xsl; verbatim.xsl</literal></para><screen><phrase role="commit-message">Fix for enhancement/bug#1312: Support font size in verbatim elements</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: fop1.xsl</literal></para><screen><phrase role="commit-message">Unchanged, testing snapshot builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">No change, testing snapshot builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: block.xsl</literal></para><screen><phrase role="commit-message">No change, testing snapshot builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: block.xsl</literal></para><screen><phrase role="commit-message">No change, just checking snapshot build process.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: toc.xsl</literal></para><screen><phrase role="commit-message">Add missing template for <tag>tocdiv</tag>/<tag>title</tag> elements to fix bug #1310.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Fix process.root template so document <tag>title</tag> can come from <tag>info</tag> as well.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: lists.xsl</literal></para><screen><phrase role="commit-message">Add support for <tag>procedure</tag> <tag>title</tag> when contained in blockinfo or <tag>info</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: fop1.xsl</literal></para><screen><phrase role="commit-message">Fix mode="fop1.foxdest" so only elements with id attribute get
a fox:destination in the output.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: fop1.xsl</literal></para><screen><phrase role="commit-message">Remove extraneous call from fop1.foxdest mode per patch submission.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autotoc.xsl</literal></para><screen><phrase role="commit-message">Add <parameter>toc.margin.properties</parameter> attribute-set to list.of.titles so
it matches the <tag>TOC</tag> list.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Adjust exception for fop for <tag>menuchoice</tag> separator to
use the $symbol.font.family if it is set.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: division.xsl</literal></para><screen><phrase role="commit-message">Fix comment.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.ent</literal></para><screen><phrase role="commit-message">Fix typo that prevents param.xsl update.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: lists.xsl; param.xweb; param.ent</literal></para><screen><phrase role="commit-message">Add <parameter>mark.optional.procedure.steps</parameter> param.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: qandaset.xsl</literal></para><screen><phrase role="commit-message">Fix bug in <tag>question</tag> template that output empty list-item-label when
defaultlabel = 'none'.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of FO changes for 1.79.1-->
<section xml:id="V1.79.1_HTML">
<title>HTML</title>
<para>The following changes have been made to the
<filename>html</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: block.xsl</literal></para><screen><phrase role="commit-message">Fix Bug #1367 <tag>epigraph</tag> <tag>attribution</tag> appears twice in html output.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.xweb; param.ent</literal></para><screen><phrase role="commit-message">Add missing <parameter>profile.outputformat</parameter> param.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl; docbook.xsl; titlepage.templates.xml</literal></para><screen><phrase role="commit-message">Add support for DocBook Publishers elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: publishers.xsl</literal></para><screen><phrase role="commit-message">New module to support new elements in DocBook Publishers schema.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: table.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1348 where class of output <tag>table</tag> not being set correctly.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: table.xsl</literal></para><screen><phrase role="commit-message">A <tag>table</tag> emitted by <tag>tgroup</tag> template now calls "common.html.attributes"
to get the class attribute handled correctly.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix bug #13598 inline.monoseq and other inline.*seq handle links incorrectly.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: refentry.xsl</literal></para><screen><phrase role="commit-message">Add template for <tag>refpurpose</tag> in no.anchor.mode to generate
the dash separator in <tag>TOC</tag> line for the <tag>refentry</tag> when
the <tag>refpurpose</tag> contains a <tag>link</tag> or <tag>indexterm</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Add missing call to id.attribute template for <tag>orgdiv</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">If a <tag>link</tag> or <tag>xref</tag> has an @id or @xml:id, then add a span to
include the id because simple.xlink no longer generates the
id attribute.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Remove call to id.attribute template in simple.xlink
because it produces duplicate ids in the output because
the element template calling simple.xlink generates the
id attribute.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: graphics.xsl</literal></para><screen><phrase role="commit-message">Check in fix for bug #1336 to support absolute file URLs
that start with file:/. Also consolidate code that determines
whether an image file path is relative into a new template
variable $is.relative.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: chunk-code.xsl</literal></para><screen><phrase role="commit-message">Add support for set nested inside set to recursive-chunk-filename.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autotoc.xsl</literal></para><screen><phrase role="commit-message">Add support for set <tag>TOC</tag> to contain nested set or <tag>article</tag>
elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added ant build for HTML stylesheets</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: glossary.xsl</literal></para><screen><phrase role="commit-message">Move any indexterms in <tag>glossentry</tag> to be inside dt, instead of
after dt which is invalid.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: htmltbl.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1334 to copy through HTML <tag>table</tag> attributes @scope and @id.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: block.xsl</literal></para><screen><phrase role="commit-message">Change the <tag>epigraph</tag> template to support schema extensions
by processing all of its children instead of specific elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Fix bug in handling of multiple editors and "edited by" <tag>label</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.templates.xml</literal></para><screen><phrase role="commit-message">Fix misnamed attribute in <tag>sidebar</tag> template.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix check for nested links.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: chunk-common.xsl; chunktoc.xsl; chunk-code.xsl</literal></para><screen><phrase role="commit-message">Adjust handling of namespace fixup to streamline distro builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Adjust handling of namespace conversion to streamline distro
build.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: table.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1298 where @rowheader = 'firstcol' incorrectly assigns
<<tag>th</tag>> to cell that is first in a <tag>row</tag> but not the first column due
to <tag>row</tag> span above.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.xweb; param.ent; autoidx.xsl</literal></para><screen><phrase role="commit-message">Add support for <parameter>autolink.index.see</parameter> param to <tag>link</tag> from see and
<tag>seealso</tag> element to <tag>primary</tag> element in <tag>index</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1306 warn of nested links, since not supported in the output.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: pi.xsl</literal></para><screen><phrase role="commit-message">Fixes bug #1323 where <?dbhtml-include?> paths were not being
interpreted relative to the XML.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: param.xweb</literal></para><screen><phrase role="commit-message">Add missing frag for new linke.to.self.for.mediaobject param.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: table.xsl</literal></para><screen><phrase role="commit-message">Fix bug in <tag>entry</tag> template where rowsep was incorrectly set to zero
for cell with @morerows in <tag>thead</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: synop.xsl</literal></para><screen><phrase role="commit-message">Restore conditional named <tag>anchor</tag> in output if dbcmdlist PI is not used.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: graphics.xsl</literal></para><screen><phrase role="commit-message">Fixed [#1317]: process <tag>alt</tag> in <tag>inlinemediaobject</tag></phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: param.xweb; graphics.xsl; param.ent</literal></para><screen><phrase role="commit-message">Fixed ticket [#1315]: Add possibility to add a <tag>link</tag> to mediaobjects</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: titlepage.templates.xml</literal></para><screen><phrase role="commit-message">Remove autoguessing of the namespace for wrapper elements; determine namespace by prefix, if any.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: chunk-common.xsl; xref.xsl</literal></para><screen><phrase role="commit-message">Make <tag>olink</tag> errors/warnings overridable in customizations.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: param.xweb; param.ent</literal></para><screen><phrase role="commit-message">1. Make page citations on <<tag>xref</tag>/> to paragraphs conditional on a new parameter,
$insert.xref.page.number.para, default to 'yes' (before, page citations were
added unconditionally). Remove similar special-casing for <<tag>link</tag>/>.
2. Disable page citations for @xrefstyle="template:..." (if needed, they
can be added with %p in the template - but they can't be disabled).</phrase></screen>
</listitem>
<listitem>
<para><literal>Mauritz Jeanson: index.xsl</literal></para><screen><phrase role="commit-message">Bug #1309: Added missing template for <tag>indexdiv</tag>/<tag>subtitle</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Pass referrer and target params to mode="xrefstyle" to allow customizations
to be more specific.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Add mode="xrefstyle" to replace many instances of redundant
code determining the xrefstyle with xsl:apply-templates
select="." mode="xrefstyle". Also allows stylesheet
customization to specify an xrefstyle per element type.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: xref.xsl</literal></para><screen><phrase role="commit-message">Pass referrer and xrefstyle to "xref-to-suffix" and "xref-to-prefix"
modes (to use the same signature than "xref-to" mode) as discussed with
Bob on the mailinglist (2013-09-12)</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: chunk.xsl</literal></para><screen><phrase role="commit-message">No change, testing snapshot builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: toc.xsl</literal></para><screen><phrase role="commit-message">Add missing template for <tag>tocdiv</tag>/<tag>title</tag> elements to fix bug #1310.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Remove a comment to test checkins and snapshot builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: lists.xsl</literal></para><screen><phrase role="commit-message">Add support for <tag>procedure</tag> <tag>title</tag> when contained in <tag>info</tag> or blockinfo.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: chunk-code.xsl</literal></para><screen><phrase role="commit-message">Enumarete separate file for <tag>revhistory</tag> if <parameter>generate.revhistory.link</parameter>=1</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Update the inline.charseq template to also call 'common.html.attributes'
instead of using local-name for class value.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: docbook.xsl; html.xsl</literal></para><screen><phrase role="commit-message">Enabling ITS processing again</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: its.xsl</literal></para><screen><phrase role="commit-message">Change syntax for selecting @its:* attributes so it works
in xsltproc (which should work with the original, but doesn't).</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl; html.xsl</literal></para><screen><phrase role="commit-message">Turn off its.xsl update which is generating attribute insertion errors.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: its.xsl; docbook.xsl; html.xsl</literal></para><screen><phrase role="commit-message">Added basic support for ITS 2.0 markup. It gets propagated into HTML
For more <tag>info</tag> about ITS see http://www.w3.org/<tag>TR</tag>/its20/</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Added a comment line to test checkin process.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xref.xsl</literal></para><screen><phrase role="commit-message">Fix bug in mode=remove-ids that put <tag>link</tag> content outside the <a> element.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: chunktoc.xsl</literal></para><screen><phrase role="commit-message">Fixed SF ticket#3611689: added missing DocBook namespace declarations</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: chunker.xsl</literal></para><screen><phrase role="commit-message">Change the internal chunk.base.dir from a param to a variable.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Turn off id attribute on <tag>glossterm</tag> <tag>anchor</tag>, because it is on the element itself.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of HTML changes for 1.79.1-->
<section xml:id="V1.79.1_Manpages">
<title>Manpages</title>
<para>The following changes have been made to the
<filename>manpages</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: block.xsl; lists.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1363 <tag>synopsis</tag> in <tag>variablelist</tag> <tag>term</tag> mangles line breaks.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: other.xsl</literal></para><screen><phrase role="commit-message">Remove redundant and out-of-date xsl:strip-space element.
This is imported from common/common.xsl for all stylesheets.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added ant build for manpages</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: inline.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1340 by omitting <tag>indexterm</tag> and <tag>remark</tag> elements from the
output. Trying to include them as nroff comments resulted in extra
whitespace in certain instances, so they are omitted.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: table.xsl; docbook.xsl; tbl.xsl</literal></para><screen><phrase role="commit-message">Adjust man stylesheet to better handle namespace fixup during
distro builds.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: lists.xsl</literal></para><screen><phrase role="commit-message">Resolve ambiguous template match for <tag>remark</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: endnotes.xsl</literal></para><screen><phrase role="commit-message">Put internally generated earmark elements into own namespace to
avoid complications with namespace stylesheet builds. No change
of <tag>function</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: other.xsl</literal></para><screen><phrase role="commit-message">Fixed bug #1313 where write.stubs template mistakenly includes
$man.output.base.dir in the .so <tag>address</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: other.xsl</literal></para><screen><phrase role="commit-message">Escape text() nodes while also in no.anchor.mode for links.
Fixes bug #1322.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: utility.xsl</literal></para><screen><phrase role="commit-message">Fixed bug #1321, also taking into account fixing bug #1281.</phrase></screen>
</listitem>
<listitem>
<para><literal>dleidert: info.xsl</literal></para><screen><phrase role="commit-message">Fix a typo (http://bugs.debian.org/698962).</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Manpages changes for 1.79.1-->
<section xml:id="V1.79.1_Epub">
<title>Epub</title>
<para>The following changes have been made to the
<filename>epub</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1341 Incorrect generation of content.opf for multiple
names in $html.stylesheet param. Backported the template
named css.item from the epub3 stylesheet.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Fix handling of <parameter>base.dir</parameter>, chunk.base.dir, and epub.oebps.dir
combinations.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Improve the handling of $chunk.base.dir when $base.dir contains
the OEBPS directory in its value.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Fix the namespace fixup step to match the other stylesheets.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">Extended <tag>date</tag> template in mode opf.metadata
If a PI dbtimestamp is available, call datetime.format(<tag>date</tag>, 'Y-m-d'),
otherwise use the normalized string content</phrase></screen>
</listitem>
<listitem>
<para><literal>dleidert: bin/spec/files</literal></para><screen><phrase role="commit-message">Fix svn:externals defintion.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">Introduced variable in opf.guide</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">Improved modularization in opf.spine and created new spine.cover template</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">Improved opf.spine with <tag>info</tag> variable</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">Bugfix in opf.spine: removed double <tag>refentry</tag> entries</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">* Template package-identifier: introduced $info variable to simplify
code (similar to the EPUB3 stylesheets)
* Template opf.calloutlist: only call opf.reference.callout if
<parameter>callout.graphics</parameter> is set</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: docbook.xsl</literal></para><screen><phrase role="commit-message">Backported Bob's EPUB3 changes to EPUB2 from r9740 -> r9742 -> r9743:
* Implement <parameter>base.dir</parameter>/OEBPS using internal chunk.base.dir instead of
new param epub.base.dir.
* Additional changes, specific to this stylesheet:
- Construct parameter epub.metainf.dir from <parameter>base.dir</parameter> + 'META-INF/'
- Changed parameter epub.cover.filename epub.oebps.dir to
chunk.base.dir
- Template opf: concat <parameter>base.dir</parameter> with epub.opf.filename
- Replaced two subsequent xsl:value-of's with concat()</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docbook.xsl</literal></para><screen><phrase role="commit-message">Fix bug in <tag>author</tag> template generating a span element inside an attribute value.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Epub changes for 1.79.1-->
<section xml:id="V1.79.1_HTMLHelp">
<title>HTMLHelp</title>
<para>The following changes have been made to the
<filename>htmlhelp</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Extensions and other builds ported to Ant</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: htmlhelp-common.xsl</literal></para><screen><phrase role="commit-message">Adjust namespace fixup to conform to the namespace source
conversion.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of HTMLHelp changes for 1.79.1-->
<section xml:id="V1.79.1_Eclipse">
<title>Eclipse</title>
<para>The following changes have been made to the
<filename>eclipse</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Extensions and other builds ported to Ant</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: eclipse.xsl</literal></para><screen><phrase role="commit-message">Adjust namespace fixup to conform to other conversions to
namespaced source.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Eclipse changes for 1.79.1-->
<section xml:id="V1.79.1_JavaHelp">
<title>JavaHelp</title>
<para>The following changes have been made to the
<filename>javahelp</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Extensions and other builds ported to Ant</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: javahelp.xsl</literal></para><screen><phrase role="commit-message">Adjust the namespace fixup to conform to the other namespaced source
conversions.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of JavaHelp changes for 1.79.1-->
<section xml:id="V1.79.1_Slides">
<title>Slides</title>
<para>The following changes have been made to the
<filename>slides</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: schema/relaxng/slides.rnc</literal></para><screen><phrase role="commit-message">Make speakernotes/handoutnotes optional as many presentations do not use them</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xhtml/plain.xsl; common/common.xsl; xhtml/slidy.xsl; xhtml/s5.xsl; fo/plai⋯</literal></para><screen><phrase role="commit-message">Rename the docbook prefix in the declaration too.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xhtml/plain.xsl; common/common.xsl; xhtml/slidy.xsl; xhtml/s5.xsl; fo/plai⋯</literal></para><screen><phrase role="commit-message">Change the docbook db: prefix to d: prefix in preparation of svn update to namespaced
stylesheets.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: xhtml/plain-titlepage.xml; fo/plain-titlepage.xml</literal></para><screen><phrase role="commit-message">Remove autoguessing of the namespace for wrapper elements; determine namespace by prefix, if any.</phrase></screen>
</listitem>
<listitem>
<para><literal>dleidert: images/callouts/gen.sh</literal></para><screen><phrase role="commit-message">Leave executable permissions for script.</phrase></screen>
</listitem>
<listitem>
<para><literal>dleidert: s5/ui/default/pretty.css; slidy/graphics/w3c-logo-blue.gif; s5/ui/default/notes.⋯</literal></para><screen><phrase role="commit-message">Drop executable permissions from files.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: doc/Makefile</literal></para><screen><phrase role="commit-message">Corrected path</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Slides changes for 1.79.1-->
<section xml:id="V1.79.1_Website">
<title>Website</title>
<para>The following changes have been made to the
<filename>website</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Extensions and other builds ported to Ant</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: olink.xsl</literal></para><screen><phrase role="commit-message">Make <tag>olink</tag> errors/warnings overridable in customizations.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Website changes for 1.79.1-->
<section xml:id="V1.79.1_Webhelp">
<title>Webhelp</title>
<para>The following changes have been made to the
<filename>webhelp</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: xsl/titlepage.templates.xsl</literal></para><screen><phrase role="commit-message">Fix typo.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl/titlepage.templates.xsl</literal></para><screen><phrase role="commit-message">Add XHTML missing default namespace.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl/webhelp-common.xsl</literal></para><screen><phrase role="commit-message">Fix bug 1357 to avoid creating l10n.js file if only collecting <tag>olink</tag> data.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: docsrc/xinclude-test.xml; docsrc/readme.xml</literal></para><screen><phrase role="commit-message">Convert XML doc to DB5.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl/webhelp-common.xsl</literal></para><screen><phrase role="commit-message">Fix error message for namespace fixup.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl/webhelp-common.xsl</literal></para><screen><phrase role="commit-message">fix bug in namespace fixup syntax.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl/webhelp-common.xsl</literal></para><screen><phrase role="commit-message">Adjust namespace fixup for namespace build process.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: xsl/titlepage.templates.xml</literal></para><screen><phrase role="commit-message">Remove autoguessing of the namespace for wrapper elements; determine namespace by prefix, if any.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: template/common/main.js</literal></para><screen><phrase role="commit-message">Fix for bug #1301</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Webhelp changes for 1.79.1-->
<section xml:id="V1.79.1_Params">
<title>Params</title>
<para>The following changes have been made to the
<filename>params</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: autolink.index.see.xml</literal></para><screen><phrase role="commit-message">Improve the description for linking in <tag>index</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: prefer.internal.olink.xml</literal></para><screen><phrase role="commit-message">Fix bug in description</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: dialogue.properties.xml</literal></para><screen><phrase role="commit-message">Fix typo.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: publishers.properties.xml</literal></para><screen><phrase role="commit-message">Fix typo.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: speaker.properties.xml; publishers.properties.xml; inlinestagedir.properti⋯</literal></para><screen><phrase role="commit-message">New property sets for DocBook Publishers elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: table.frame.border.thickness.xml; table.cell.border.thickness.xml</literal></para><screen><phrase role="commit-message">Fix bug #1291, make default values different for HTML and FO.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: profile.outputformat.xml</literal></para><screen><phrase role="commit-message">Added missing support for outputformat attribute
* Added missing parameter <parameter>profile.outputformat</parameter> in
params/profile.outputformat.xml
* Added missing lines to check for outputformat attribute in
profiling/profile-mode.xsl</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: table.frame.border.thickness.xml; table.cell.border.thickness.xml</literal></para><screen><phrase role="commit-message">Changed default border thickness from 0.5pt to 1px. The reason is that Chrome rounds 0.5pt to 0px making borders invisible.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: list.block.spacing.xml</literal></para><screen><phrase role="commit-message">Fix typo in element name.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: autolink.index.see.xml</literal></para><screen><phrase role="commit-message">New param to control automatic links in <tag>index</tag> from see and
<tag>seealso</tag> to <tag>indexterm</tag> <tag>primary</tag>.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: show.bookmarks.xml</literal></para><screen><phrase role="commit-message">New param to turn off PDF bookmarks.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl1.1.bookmarks.xml</literal></para><screen><phrase role="commit-message">Param to use standard XSL 1.1 bookmark elements.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: link.to.self.for.mediaobject.xml</literal></para><screen><phrase role="commit-message">Fixed ticket [#1315]: Add possibility to add a <tag>link</tag> to mediaobjects</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: toc.leader.properties.xml</literal></para><screen><phrase role="commit-message">Replace <tag>literal</tag> space inserted next to fo:leader in <tag>ToC</tag> with a padding. This
works around a bug in FOP (see FOP-1444).
Make <tag>ToC</tag> fo:leader properties configurable via attribute set.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: list.block.spacing.xml; list.item.spacing.xml</literal></para><screen><phrase role="commit-message">Clarify that <parameter>list.block.spacing</parameter> is not used in nested lists.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: insert.xref.page.number.para.xml</literal></para><screen><phrase role="commit-message">Missed new file in previous checkin.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: mark.optional.procedure.steps.xml</literal></para><screen><phrase role="commit-message">New param to turn off Optional text for optional steps.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Params changes for 1.79.1-->
<section xml:id="V1.79.1_Profiling">
<title>Profiling</title>
<para>The following changes have been made to the
<filename>profiling</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: profile.xsl</literal></para><screen><phrase role="commit-message">Add missing <parameter>profile.outputformat</parameter> param declaration.</phrase></screen>
</listitem>
<listitem>
<para><literal>tom_schr: profile-mode.xsl</literal></para><screen><phrase role="commit-message">Added missing support for outputformat attribute
* Added missing parameter <parameter>profile.outputformat</parameter> in
params/profile.outputformat.xml
* Added missing lines to check for outputformat attribute in
profiling/profile-mode.xsl</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl2profile.xsl</literal></para><screen><phrase role="commit-message">Fix bug #1335 where profile-chunk.xsl was xsl:including
chunk-code.xsl instead of profile-chunk-code.xsl.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl2profile.xsl</literal></para><screen><phrase role="commit-message">Fixed bug in handling of namespace fixup.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: xsl2profile.xsl</literal></para><screen><phrase role="commit-message">Adjust namespace fixup to match other templates.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Profiling changes for 1.79.1-->
<section xml:id="V1.79.1_Lib">
<title>Lib</title>
<para>The following changes have been made to the
<filename>lib</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added lib ant build support</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Lib changes for 1.79.1-->
<section xml:id="V1.79.1_Tools">
<title>Tools</title>
<para>The following changes have been made to the
<filename>tools</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build-shared.xml</literal></para><screen><phrase role="commit-message">Added lib ant build support</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build-shared.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: lib/xml-apis.jar; lib/xercesImpl.jar; build-shared.xml; lib/xalan.jar</literal></para><screen><phrase role="commit-message">Extensions and other builds ported to Ant</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build-shared.xml</literal></para><screen><phrase role="commit-message">Added ant build for HTML stylesheets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: licenses/saxon/JAMESCLARK.txt; lib/jython.jar; lib/xercesImpl.jar; licenses/j⋯</literal></para><screen><phrase role="commit-message">Initial work on Ant build, common (L10N) directory handled so far</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Tools changes for 1.79.1-->
<section xml:id="V1.79.1_Template">
<title>Template</title>
<para>The following changes have been made to the
<filename>template</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Remove the d: namespace declaration because it is
automatically added by the ns build process.</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: titlepage.xsl</literal></para><screen><phrase role="commit-message">Added missing namespace declaration</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Remove d: namespace declaration from non namespaced version since
it is automatically added to build the namespaced version.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Set the db.prefix to blank until convert to ns build.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Fix handling of namespace declaration for conversion to NS sourcebase.</phrase></screen>
</listitem>
<listitem>
<para><literal>Robert Stayton: titlepage.xsl</literal></para><screen><phrase role="commit-message">Modified to support roundtrip conversion between namespaced
version and non-namespaced version.</phrase></screen>
</listitem>
<listitem>
<para><literal>stilor: titlepage.xsl</literal></para><screen><phrase role="commit-message">Remove autoguessing of the namespace for wrapper elements; determine namespace by prefix, if any.</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Template changes for 1.79.1-->
<section xml:id="V1.79.1_Extensions">
<title>Extensions</title>
<para>The following changes have been made to the
<filename>extensions</filename> code
since the 1.78.1 release.</para>
<itemizedlist>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Added clean targets</phrase></screen>
</listitem>
<listitem>
<para><literal>Jirka Kosek: build.xml</literal></para><screen><phrase role="commit-message">Extensions and other builds ported to Ant</phrase></screen>
</listitem>
</itemizedlist>
</section><!--end of Extensions changes for 1.79.1-->
</section>
</article>
| {
"pile_set_name": "Github"
} |
/** @file
The header <errno.h> defines several macros, all relating to the reporting of
error conditions.
The ISO/IEC 9899 specification requires that these be macros.
The macros expand to integral constant expressions
with distinct nonzero values, suitable for use in #if preprocessing
directives; the variable errno which expands to a modifiable lvalue that has type int,
the value of which is set to a positive error number by several library
functions; and the variable EFIerrno which is an extension allowing the return status
of the underlying UEFI functions to be returned.
The value of errno and EFIerrno is zero at program startup. On program startup, errno
is initialized to zero but is never set to zero by
any library function. The value of errno may be set to a non-zero value by
a library function call whether or not there is an error, provided the use
of errno is not documented in the description of the function in
the governing standard: ISO/IEC 9899:1990 with Amendment 1 or ISO/IEC 9899:199409.
EFIerrno, like errno, should only be checked if it is known that the preceeding function call
called a UEFI function. Functions in which UEFI functions are called dependent upon context
or parameter values should guarantee that EFIerrno is set to zero by default, or to the status
value returned by any UEFI functions which are called.
All macro definitions in this list must begin with the letter 'E'
and be followed by a digit or an uppercase letter.
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _ERRNO_H
#define _ERRNO_H
#include <sys/EfiCdefs.h>
#include <sys/errno.h>
extern int errno;
extern RETURN_STATUS EFIerrno;
// Define error number in terms of the ENUM in <sys/errno.h>
#define ERESTART -1 /* restart syscall */
#define ESUCCESS __ESUCCESS /* No Problems */
#define EMINERRORVAL __EMINERRORVAL /* 1 The lowest valid error value */
#define EPERM __EPERM /* 1 Operation not permitted */
#define ENOENT __ENOENT /* 2 No such file or directory */
#define ESRCH __ESRCH /* 3 No such process */
#define EINTR __EINTR /* 4 Interrupted system call */
#define EIO __EIO /* 5 Input/output error */
#define ENXIO __ENXIO /* 6 Device not configured */
#define E2BIG __E2BIG /* 7 Argument list too long */
#define ENOEXEC __ENOEXEC /* 8 Exec format error */
#define EBADF __EBADF /* 9 Bad file descriptor */
#define ECHILD __ECHILD /* 10 No child processes */
#define EDEADLK __EDEADLK /* 11 Resource deadlock avoided */
#define ENOMEM __ENOMEM /* 12 Cannot allocate memory */
#define EACCES __EACCES /* 13 Permission denied */
#define EFAULT __EFAULT /* 14 Bad address */
#define ENOTBLK __ENOTBLK /* 15 Block device required */
#define EBUSY __EBUSY /* 16 Device busy */
#define EEXIST __EEXIST /* 17 File exists */
#define EXDEV __EXDEV /* 18 Cross-device link */
#define ENODEV __ENODEV /* 19 Operation not supported by device */
#define ENOTDIR __ENOTDIR /* 20 Not a directory */
#define EISDIR __EISDIR /* 21 Is a directory */
#define EINVAL __EINVAL /* 22 Invalid argument */
#define ENFILE __ENFILE /* 23 Too many open files in system */
#define EMFILE __EMFILE /* 24 Too many open file descriptors */
#define ENOTTY __ENOTTY /* 25 Inappropriate ioctl for device */
#define ETXTBSY __ETXTBSY /* 26 Text file busy */
#define EFBIG __EFBIG /* 27 File too large */
#define ENOSPC __ENOSPC /* 28 No space left on device */
#define ESPIPE __ESPIPE /* 29 Illegal seek */
#define EROFS __EROFS /* 30 Read-only filesystem */
#define EMLINK __EMLINK /* 31 Too many links */
#define EPIPE __EPIPE /* 32 Broken pipe */
/* math software -- these are the only two values required by the C Standard */
#define EDOM __EDOM /* 33 Numerical argument out of domain */
#define ERANGE __ERANGE /* 34 Result too large */
/* non-blocking and interrupt i/o */
#define EAGAIN __EAGAIN /* 35 Resource temporarily unavailable */
#define EWOULDBLOCK __EWOULDBLOCK /* 35 Operation would block */
#define EINPROGRESS __EINPROGRESS /* 36 Operation now in progress */
#define EALREADY __EALREADY /* 37 Operation already in progress */
/* ipc/network software -- argument errors */
#define ENOTSOCK __ENOTSOCK /* 38 Socket operation on non-socket */
#define EDESTADDRREQ __EDESTADDRREQ /* 39 Destination address required */
#define EMSGSIZE __EMSGSIZE /* 40 Message too long */
#define EPROTOTYPE __EPROTOTYPE /* 41 Protocol wrong type for socket */
#define ENOPROTOOPT __ENOPROTOOPT /* 42 Protocol not available */
#define EPROTONOSUPPORT __EPROTONOSUPPORT /* 43 Protocol not supported */
#define ESOCKTNOSUPPORT __ESOCKTNOSUPPORT /* 44 Socket type not supported */
#define EOPNOTSUPP __EOPNOTSUPP /* 45 Operation not supported */
#define ENOTSUP __ENOTSUP /* 45 Operation not supported */
#define EPFNOSUPPORT __EPFNOSUPPORT /* 46 Protocol family not supported */
#define EAFNOSUPPORT __EAFNOSUPPORT /* 47 Address family not supported by protocol family */
#define EADDRINUSE __EADDRINUSE /* 48 Address already in use */
#define EADDRNOTAVAIL __EADDRNOTAVAIL /* 49 Can't assign requested address */
/* ipc/network software -- operational errors */
#define ENETDOWN __ENETDOWN /* 50 Network is down */
#define ENETUNREACH __ENETUNREACH /* 51 Network is unreachable */
#define ENETRESET __ENETRESET /* 52 Network dropped connection on reset */
#define ECONNABORTED __ECONNABORTED /* 53 Software caused connection abort */
#define ECONNRESET __ECONNRESET /* 54 Connection reset by peer */
#define ENOBUFS __ENOBUFS /* 55 No buffer space available */
#define EISCONN __EISCONN /* 56 Socket is already connected */
#define ENOTCONN __ENOTCONN /* 57 Socket is not connected */
#define ESHUTDOWN __ESHUTDOWN /* 58 Can't send after socket shutdown */
#define ETOOMANYREFS __ETOOMANYREFS /* 59 Too many references: can't splice */
#define ETIMEDOUT __ETIMEDOUT /* 60 Operation timed out */
#define ECONNREFUSED __ECONNREFUSED /* 61 Connection refused */
#define ELOOP __ELOOP /* 62 Too many levels of symbolic links */
#define ENAMETOOLONG __ENAMETOOLONG /* 63 File name too long */
#define EHOSTDOWN __EHOSTDOWN /* 64 Host is down */
#define EHOSTUNREACH __EHOSTUNREACH /* 65 No route to host */
#define ENOTEMPTY __ENOTEMPTY /* 66 Directory not empty */
/* quotas, etc. */
#define EPROCLIM __EPROCLIM /* 67 Too many processes */
#define EUSERS __EUSERS /* 68 Too many users */
#define EDQUOT __EDQUOT /* 69 Disc quota exceeded */
/* Network File System */
#define ESTALE __ESTALE /* 70 Stale NFS file handle */
#define EREMOTE __EREMOTE /* 71 Too many levels of remote in path */
#define EBADRPC __EBADRPC /* 72 RPC struct is bad */
#define ERPCMISMATCH __ERPCMISMATCH /* 73 RPC version wrong */
#define EPROGUNAVAIL __EPROGUNAVAIL /* 74 RPC prog. not avail */
#define EPROGMISMATCH __EPROGMISMATCH /* 75 Program version wrong */
#define EPROCUNAVAIL __EPROCUNAVAIL /* 76 Bad procedure for program */
#define ENOLCK __ENOLCK /* 77 No locks available */
#define ENOSYS __ENOSYS /* 78 Function not implemented */
#define EFTYPE __EFTYPE /* 79 Inappropriate file type or format */
#define EAUTH __EAUTH /* 80 Authentication error */
#define ENEEDAUTH __ENEEDAUTH /* 81 Need authenticator */
#define EIDRM __EIDRM /* 82 Identifier removed */
#define ENOMSG __ENOMSG /* 83 No message of desired type */
#define EOVERFLOW __EOVERFLOW /* 84 Value too large to be stored in data type */
#define EILSEQ __EILSEQ /* 85 Illegal byte sequence */
#define ENOTHING_1 __ENOTHING_1 /* 86 Place Holder */
#define ECANCELED __ECANCELED /* 87 Operation canceled */
#define EBADMSG __EBADMSG /* 88 Bad message */
#define ENODATA __ENODATA /* 89 No message available */
#define ENOSR __ENOSR /* 90 No STREAM resources */
#define ENOSTR __ENOSTR /* 91 Not a STREAM */
#define ETIME __ETIME /* 92 STREAM ioctl timeout */
#define ENOATTR __ENOATTR /* 93 Attribute not found */
#define EDOOFUS __EDOOFUS /* 94 Programming error */
#define EMULTIHOP __EMULTIHOP /* 95 Multihop attempted */
#define ENOLINK __ENOLINK /* 96 Link has been severed */
#define EPROTO __EPROTO /* 97 Protocol error */
#define EBUFSIZE __EBUFSIZE /* 98 Buffer too small to hold result */
#define EMAXERRORVAL __EMAXERRORVAL /* One more than the highest defined error value. */
#endif /* _ERRNO_H */
| {
"pile_set_name": "Github"
} |
.status {
width: 10px;
height: 10px;
background: #c0392b;
display: block;
margin: 8px 10px 0 0;
float: left;
border-radius: 50%;
&.checked-in {
background: #2ecc71;
}
} | {
"pile_set_name": "Github"
} |
#include <vector>
#include "caffe/sgd_solvers.hpp"
namespace caffe {
#ifndef CPU_ONLY
template <typename Dtype>
void adagrad_update_gpu(int N, Dtype* g, Dtype* h, Dtype delta,
Dtype local_rate);
#endif
template <typename Dtype>
void AdaGradSolver<Dtype>::ComputeUpdateValue(int param_id, Dtype rate) {
CHECK(Caffe::root_solver());
const vector<Blob<Dtype>*>& net_params = this->net_->learnable_params();
const vector<float>& net_params_lr = this->net_->params_lr();
Dtype delta = this->param_.delta();
Dtype local_rate = rate * net_params_lr[param_id];
switch (Caffe::mode()) {
case Caffe::CPU: {
// compute square of gradient in update
caffe_powx(net_params[param_id]->count(),
net_params[param_id]->cpu_diff(), Dtype(2),
this->update_[param_id]->mutable_cpu_data());
// update history
caffe_add(net_params[param_id]->count(),
this->update_[param_id]->cpu_data(),
this->history_[param_id]->cpu_data(),
this->history_[param_id]->mutable_cpu_data());
// prepare update
caffe_powx(net_params[param_id]->count(),
this->history_[param_id]->cpu_data(), Dtype(0.5),
this->update_[param_id]->mutable_cpu_data());
caffe_add_scalar(net_params[param_id]->count(),
delta, this->update_[param_id]->mutable_cpu_data());
caffe_div(net_params[param_id]->count(),
net_params[param_id]->cpu_diff(),
this->update_[param_id]->cpu_data(),
this->update_[param_id]->mutable_cpu_data());
// scale and copy
caffe_cpu_axpby(net_params[param_id]->count(), local_rate,
this->update_[param_id]->cpu_data(), Dtype(0),
net_params[param_id]->mutable_cpu_diff());
break;
}
case Caffe::GPU: {
#ifndef CPU_ONLY
adagrad_update_gpu(net_params[param_id]->count(),
net_params[param_id]->mutable_gpu_diff(),
this->history_[param_id]->mutable_gpu_data(), delta, local_rate);
#else
NO_GPU;
#endif
break;
}
default:
LOG(FATAL) << "Unknown caffe mode: " << Caffe::mode();
}
}
INSTANTIATE_CLASS(AdaGradSolver);
REGISTER_SOLVER_CLASS(AdaGrad);
} // namespace caffe
| {
"pile_set_name": "Github"
} |
Dear Sirs,
Please take into consideration our below DMCA claim to cease and desist from hosting the below infringing repositories in their entirety with all their files, content and materials listed under URLs:
https://github.com/ipenn/PyMT4ManagerAPI
https://github.com/ipenn/MT4-Manager-API-1
https://github.com/ipenn/demo_mt4
https://github.com/ipenn/MT4Manager
https://github.com/ipenn/copy_trade_system
https://github.com/ipenn/PlatformWrapper.Examples
https://github.com/ipenn/MT4Proxy.NET
https://github.com/ipenn/MetaTrader4.Manager.Wrapper
https://github.com/ipenn/traderWebservice
https://github.com/ipenn/MT4Wrapper
https://github.com/ipenn/Test_order_close
https://github.com/ipenn/DepositUpdater
https://github.com/ipenn/MetaTrader4-OffQuotes-Server-Plugin
https://github.com/strawren/MT4Wrapper
https://github.com/henryL1N/MT4-Manager-API
https://github.com/nixjoe/GoForex
https://github.com/zhmn-hub/MT4Manager
https://github.com/gaoxiang9457/mt4_manager_test
https://github.com/tarikhagustia/mt4-report-server-docker
https://github.com/roma-guru/mt5webapi
https://github.com/ScottWei007/mt5webapi
https://github.com/feifanyajun/MT5API
https://github.com/aemaddin/mt5webapi
https://github.com/sysem85/MetaTrader4.Manager.Wrapper
DMCA CLAIM TO CEASE AND DESIST FROM HOSTING INFRINGING URLS VIOLATING METAQUOTES SOFTWARE CORP.'S TRADEMARKS AND COPYRIGHTS HOSTED BY GITHUB, INC.
1. I have read and understand GitHub's Guide to Filing a DMCA Notice.
2. Identification of the copyrighted work claimed to have been infringed, or, if multiple copyrighted works at a single online site are covered by a single notification, a representative list of such works on that site.
MetaQuotes Software Corp. is the developer of the MetaTrader 4/5 online trading platforms and MQL4/MQL5 software languages legal owner and/or exclusive and rightful user of all listed below intellectual property rights:
"MetaTrader". WIPO Certificate of Registration No 957372, with registration date January 31st 2008;
"MetaTrader" (MetaTrader). ROSPATENT Certificate of official registration of computer programs №2003611699, with registration date July 17th 2003;
"MT4" WIPO Certificate of Registration No. 1316074, with registration date August 1st 2016
"MQL4". WIPO Certificate of registration N 986555, with registration date October 7th 2008;
"MQL5". WIPO Certificate of registration N 1023842, with registration date November 10th 2009
"MetaTrader 5" WIPO Certificate of Registration No. 1045019, with registration date May 6th 2010 with subsequent designation of protection in China
"MetaTrader 5" Federal Service for Intellectual Property (ROSPATENT) Certificate of Registration No. 2010612840, with registration date April 27th 2010
"MetaTrader 5" WIPO Certificate of Registration No. 1308336, with registration date June 20th 2016
"MT5" Federal Service for Intellectual Property (ROSPATENT) Certificate of Registration No. 581780, with registration date July 22nd 2016
"MT5" WIPO Certificate of Registration No. 1315264, with registration date August 1st 2016
MetaQuotes Software Corp. is the exclusive owner of the following websites: https://www.metaquotes.net, https://www.metaquotes.ru, https://www.mql4.com, https://www.mql4.ru, https://www.metatrader4.com, https://www.mql5.com. All materials published on these sites are copyrighted and all rights are reserved by MetaQuotes Software Corp. therefore copying or reprinting of these materials including logos in whole or in part is strictly prohibited without the written permit of MetaQuotes Software Corp..
All the software products, materials, logos and documentation developed by MetaQuotes Software Corp. are subject to international copyright law. Information about the products of MetaQuotes Software Corp. is available on the company's official website at https://www.metaquotes.net.
URLs of the original copyrighted work in our search results:
https://www.metaquotes.net/en/metatrader4
https://www.metatrader4.com
https://www.mql4.com
https://www.metaquotes.net/en/metatrader5
https://www.metatrader5.com
https://www.mql5.com
3. Identification of the material that is claimed to be infringing or to be the subject of infringing activity and that is to be removed or access to which is to be disabled, and information reasonably sufficient to permit GitHub, Inc to locate the material.
On the below listed URLs hosted by GitHub, Inc the intellectual property of MetaQuotes Software Corp. are being used without any authorization or permission. From the below listed URLs of repositories and all their files it is evident that the copyrights of our organization in the Metatrader 4 (MT4) and Metatrader 5 (MT5) platforms are being used and MetaQuotes Software Corp. objects to such unauthorized use. The infringing repositories offer and/or make use of the MetaTrader 4/5 Manager APIs. Please be advised that the Manager APIs are private and confidential APIs and are provided under license agreement contracts for commercial purposes. The Manager is a component of the software back office and this software in only avaiable to MetaQuotes clients/ licensees via license agreements pls see https://www.metatrader5.com/en/brokers, https://www.metatrader4.com/en/brokers/api. MetaQuotes Software Corp objects to any unauthorized disclosure of the Manager APIs or access to the Manager APIs and such disclosure or access constitutes violation of copyrights under the applicable laws.
https://github.com/ipenn/PyMT4ManagerAPI
https://github.com/ipenn/MT4-Manager-API-1
https://github.com/ipenn/demo_mt4
https://github.com/ipenn/MT4Manager
https://github.com/ipenn/copy_trade_system
https://github.com/ipenn/PlatformWrapper.Examples
https://github.com/ipenn/MT4Proxy.NET
https://github.com/ipenn/MetaTrader4.Manager.Wrapper
https://github.com/ipenn/traderWebservice
https://github.com/ipenn/MT4Wrapper
https://github.com/ipenn/Test_order_close
https://github.com/ipenn/DepositUpdater
https://github.com/ipenn/MetaTrader4-OffQuotes-Server-Plugin
https://github.com/strawren/MT4Wrapper
https://github.com/henryL1N/MT4-Manager-API
https://github.com/nixjoe/GoForex
https://github.com/zhmn-hub/MT4Manager
https://github.com/gaoxiang9457/mt4_manager_test
https://github.com/tarikhagustia/mt4-report-server-docker
https://github.com/roma-guru/mt5webapi
https://github.com/ScottWei007/mt5webapi
https://github.com/feifanyajun/MT5API
https://github.com/aemaddin/mt5webapi
https://github.com/sysem85/MetaTrader4.Manager.Wrapper
4. What the affected user would need to do in order to remedy the infringement.
The affected users would need to permanently cease and desist the infringing URLs of forked repositories in their entirety with all their files, contents and materials.
5. Information reasonably sufficient to permit GitHub, Inc to contact the Complaining Party, such as an address, telephone number, and, if available, an electronic mail address at which the Complaining Party may be contacted.
MetaQuotes Software
P.O.Box 53786,
21 Iridos Street, Mesa Yitonia,
Limassol 4004, Cyprus
Tel: [private]
E-mail: [private]
Website: https://www.metaquotes.net
6. A statement that the Complaining Party has a good faith belief that use of the material in the manner complained of is not authorized by the copyright owner, its agent, or the law.
I have a good faith belief that use of the copyrighted materials described above on the infringing web pages is not authorized by the copyright owner, or its agent, or the law. I have taken fair use into consideration.
7. A statement that the information in the notification is accurate, and under penalty of perjury, that the Complaining Party is the owner, or is authorized to act on behalf of the owner, of an exclusive right that is allegedly infringed.
I swear, under penalty of perjury, that the information in this notification is accurate and that I am the copyright owner, or am authorized to act on behalf of the owner, of an exclusive right that is allegedly infringed.
8. An electronic signature of the copyright owner, or a person authorized to act on behalf of the owner, of an exclusive copyright that has allegedly been infringed.
[private]
[private]
MetaQuotes Software Corp.
Signed on this date of:
April 24th, 2020
| {
"pile_set_name": "Github"
} |
//
// AnyObserver.swift
// RxSwift
//
// Created by Krunoslav Zaher on 2/28/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
/// A type-erased `ObserverType`.
///
/// Forwards operations to an arbitrary underlying observer with the same `Element` type, hiding the specifics of the underlying observer type.
public struct AnyObserver<Element> : ObserverType {
/// The type of elements in sequence that observer can observe.
public typealias E = Element
/// Anonymous event handler type.
public typealias EventHandler = (Event<Element>) -> Void
private let observer: EventHandler
/// Construct an instance whose `on(event)` calls `eventHandler(event)`
///
/// - parameter eventHandler: Event handler that observes sequences events.
public init(eventHandler: @escaping EventHandler) {
self.observer = eventHandler
}
/// Construct an instance whose `on(event)` calls `observer.on(event)`
///
/// - parameter observer: Observer that receives sequence events.
public init<O : ObserverType>(_ observer: O) where O.E == Element {
self.observer = observer.on
}
/// Send `event` to this observer.
///
/// - parameter event: Event instance.
public func on(_ event: Event<Element>) {
return self.observer(event)
}
/// Erases type of observer and returns canonical observer.
///
/// - returns: type erased observer.
public func asObserver() -> AnyObserver<E> {
return self
}
}
extension AnyObserver {
/// Collection of `AnyObserver`s
typealias s = Bag<(Event<Element>) -> ()>
}
extension ObserverType {
/// Erases type of observer and returns canonical observer.
///
/// - returns: type erased observer.
public func asObserver() -> AnyObserver<E> {
return AnyObserver(self)
}
/// Transforms observer of type R to type E using custom transform method.
/// Each event sent to result observer is transformed and sent to `self`.
///
/// - returns: observer that transforms events.
public func mapObserver<R>(_ transform: @escaping (R) throws -> E) -> AnyObserver<R> {
return AnyObserver { e in
self.on(e.map(transform))
}
}
}
| {
"pile_set_name": "Github"
} |
.media {
margin-bottom: 25px;
.media-body {
color: #777;
font-size: 13px;
.media-heading {
font-size: 16px;
font-weight: bold;
color: #333;
}
}
}
| {
"pile_set_name": "Github"
} |
### “郑州毒王”隐瞒旅游史 全球近4万人受影响
------------------------
#### [首页](https://github.com/gfw-breaker/banned-news/blob/master/README.md) | [手把手翻墙教程](https://github.com/gfw-breaker/guides/wiki) | [禁闻聚合安卓版](https://github.com/gfw-breaker/bn-android) | [网门安卓版](https://github.com/oGate2/oGate) | [神州正道安卓版](https://github.com/SzzdOgate/update)
<div><div class="featured_image">
<a href="https://i.ntdtv.com/assets/uploads/2020/03/Untitled-14.jpg" target="_blank">
<figure>
<img alt="“郑州毒王”隐瞒旅游史 全球近4万人受影响" src="https://i.ntdtv.com/assets/uploads/2020/03/Untitled-14-800x450.jpg"/>
</figure><br/>
</a>
<span class="caption">
1月12日,一名男子离开武汉市的一家医院,该医院有一患者刚死于武汉肺炎。(NOEL CELIS/AFP via Getty Images)
</span>
</div>
</div><hr/>
#### [翻墙必看视频(文昭、江峰、法轮功、八九六四、香港反送中...)](https://github.com/gfw-breaker/banned-news/blob/master/pages/link3.md)
<div><div class="post_content" itemprop="articleBody">
<p>
【新唐人北京时间2020年03月14日讯】
<ok href="https://www.ntdtv.com/gb/442749.htm">
武汉肺炎疫情
</ok>
持续延烧,中国郑州一名
<ok href="https://www.ntdtv.com/gb/公务员.htm">
公务员
</ok>
<ok href="https://www.ntdtv.com/gb/郭伟鹏.htm">
郭伟鹏
</ok>
隐瞒3月初义、法旅游史,近日确诊感染武汉肺炎后令
<ok href="https://www.ntdtv.com/gb/中国网友.htm">
中国网友
</ok>
气炸,怒斥他是“一人毁一城”的“
<ok href="https://www.ntdtv.com/gb/郑州毒王.htm">
郑州毒王
</ok>
”;更有医疗从业人员在社群指出,与郭伟鹏密切接触者已近4万人,恐怕这4万人都有被传染的风险。
</p>
<p>
综合媒体报导,由中国爆发的武汉肺炎(COVID-19)疫情冲击全球,近日中国一名
<ok href="https://www.ntdtv.com/gb/公务员.htm">
公务员
</ok>
<ok href="https://www.ntdtv.com/gb/郭伟鹏.htm">
郭伟鹏
</ok>
确诊感染武汉肺炎,之前他隐瞒了3月初到意大利、法国,以及在阿联转机的旅游史。消息传出后,遭
<ok href="https://www.ntdtv.com/gb/中国网友.htm">
中国网友
</ok>
痛斥“一人毁一城”的“
<ok href="https://www.ntdtv.com/gb/郑州毒王.htm">
郑州毒王
</ok>
”。
</p>
<p>
报导指出,郭伟鹏早已办好签证准备这次行程,但时逢
<ok href="https://www.ntdtv.com/gb/442749.htm">
武汉肺炎疫情
</ok>
爆发,他直到3月1日才冒险从北京出境,飞经阿联阿布达比,转往意大利米兰;旅行期间曾短暂赴法国巴黎1天,于6日回到中国,其后连续几天检测体温正常,10日开始出现发烧症状、隔日确诊,12日证实为中国郑州“首例境外移入病例”。
</p>
<p>
中国微博网友“DrX的医学江湖”分析指出,郭男一共搭乘6个航班、1趟高铁及1趟火车,估计密切接触者已近4万人,郭伟鹏何时开始带原病毒已难以厘清,恐怕这4万人都有被传染的风险。
</p>
<p>
由于中共隐瞒致使武汉肺炎疫情传播全世界,与中共有密切联系的国家意大利、韩国、伊朗尤为严重。周五,意大利确诊病例增加到15,113例,死亡189人,累计1,016人丧生。当天意大利封锁第四天。除了超市和药品店,所有店铺关闭。景点也几乎无人光顾。
</p>
<p>
伊朗周五增加1289个确诊病例,累计11364例,共计514人死亡。多家媒体报导,卫星照片显示,伊朗疫情源头库姆出现了万人塚,实际疫情比当局通报更为严重。
</p>
<p>
而在各国武汉肺炎确诊病例不断猛增之际,中国大陆的确诊病例却在“锐减”。台湾前CDC副署长指出,中共官方确诊数字存在政策引导。
</p>
<p>
台湾前疾管署副署长施文仪3月12日接受自由亚洲电台专访时指出,在复工为最高指导原则下,中国的确诊病例从2月25日连续两周一路下滑,这数字一直存在“政策上的引导”。
</p>
<p>
施文仪说,自己已经观察大陆的疫情数字两个月。由于中共总书记习近平3月10日抵达武汉,大陆公布的疫情未来将再持续下降,且最终只会局限在湖北,而湖北疫情也将只剩武汉,未来七日左右,大陆高层将顺势宣布武汉解封,全境全面复工、全民正常生活。
</p>
<p>
路透社此前披露,习近平2月3日曾警告高阶官员,一些防范武汉肺炎扩散的措施力太过头了,已威胁国家经济成长。
</p>
<p>
施文仪指出,这是中共的最高指导原则,意思是大陆防控疫情“不能再这样做了”,所以习近平3月10日到武汉其实是一种政治活动宣示,中共接下来就是要走复工这条路。
</p>
<p>
吴福滨此前接受大纪元记者采访时也指出,中共在武汉肺炎确诊病例和死亡人数上做假,“没有人相信中共所公布的数字是可靠的”。
</p>
<p>
吴福滨表示,听台商传出来的消息,武汉的死亡人数超过10万人,比中共官方公布的数据严重许多,可见整个医疗体系崩溃了,武汉肺炎死亡率才那么高。
</p>
<p>
(记者刘明焕报导/责任编辑:戴明)
</p>
<div class="single_ad">
</div>
</div>
</div>
<hr/>
手机上长按并复制下列链接或二维码分享本文章:<br/>
https://github.com/gfw-breaker/banned-news/blob/master/pages/prog204/a102799328.md <br/>
<a href='https://github.com/gfw-breaker/banned-news/blob/master/pages/prog204/a102799328.md'><img src='https://github.com/gfw-breaker/banned-news/blob/master/pages/prog204/a102799328.md.png'/></a> <br/>
原文地址(需翻墙访问):https://www.ntdtv.com/gb/2020/03/14/a102799328.html
------------------------
#### [首页](https://github.com/gfw-breaker/banned-news/blob/master/README.md) | [一键翻墙软件](https://github.com/gfw-breaker/nogfw/blob/master/README.md) | [《九评共产党》](https://github.com/gfw-breaker/9ping.md/blob/master/README.md#九评之一评共产党是什么) | [《解体党文化》](https://github.com/gfw-breaker/jtdwh.md/blob/master/README.md) | [《共产主义的终极目的》](https://github.com/gfw-breaker/gczydzjmd.md/blob/master/README.md)
<img src='http://gfw-breaker.win/banned-news/pages/prog204/a102799328.md' width='0px' height='0px'/> | {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2010-2020 SAP and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* SAP - initial API and implementation
*/
package org.eclipse.dirigible.core.security.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.eclipse.dirigible.core.security.definition.AccessArtifact;
import org.eclipse.dirigible.core.security.definition.AccessArtifactConstraint;
import org.eclipse.dirigible.core.security.definition.AccessDefinition;
import org.junit.Test;
/**
* The Class AccessArtifactTest.
*/
public class AccessArtifactTest {
/**
* Serialize test.
*/
@Test
public void serializeTest() {
AccessArtifact access = new AccessArtifact();
access.getConstraints().add(new AccessArtifactConstraint());
access.getConstraints().get(0).setPath("/myproject/myfolder/myartifact1.txt");
access.getConstraints().get(0).setMethod("*");
access.getConstraints().get(0).getRoles().add("myrole1");
access.getConstraints().get(0).getRoles().add("myrole2");
access.getConstraints().add(new AccessArtifactConstraint());
access.getConstraints().get(1).setPath("/myproject/myfolder/myartifact2.txt");
access.getConstraints().get(1).setMethod("GET");
access.getConstraints().get(1).getRoles().add("myrole3");
access.getConstraints().get(1).getRoles().add("myrole4");
assertNotNull(access.serialize());
}
/**
* Parses the test.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void parseTest() throws IOException {
InputStream in = AccessArtifactTest.class.getResourceAsStream("/access/test.access");
try {
String json = IOUtils.toString(in, StandardCharsets.UTF_8);
AccessArtifact access = AccessArtifact.parse(json);
assertEquals("*", access.getConstraints().get(0).getMethod());
} finally {
if (in != null) {
in.close();
}
}
}
/**
* Combine test.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void combineTest() throws IOException {
List<AccessDefinition> accessDefinitions = new ArrayList<AccessDefinition>();
AccessDefinition accessDefinition = new AccessDefinition();
accessDefinition.setPath("/myproject/myfolder/myartifact1.txt");
accessDefinition.setMethod("*");
accessDefinition.setRole("myrole1");
accessDefinitions.add(accessDefinition);
accessDefinition.setHash("1234");
accessDefinition = new AccessDefinition();
accessDefinition.setPath("/myproject/myfolder/myartifact1.txt");
accessDefinition.setMethod("*");
accessDefinition.setRole("myrole2");
accessDefinition.setHash("1234");
accessDefinitions.add(accessDefinition);
accessDefinition = new AccessDefinition();
accessDefinition.setPath("/myproject/myfolder/myartifact2.txt");
accessDefinition.setMethod("GET");
accessDefinition.setRole("myrole3");
accessDefinition.setHash("1234");
accessDefinitions.add(accessDefinition);
accessDefinition = new AccessDefinition();
accessDefinition.setPath("/myproject/myfolder/myartifact2.txt");
accessDefinition.setMethod("GET");
accessDefinition.setRole("myrole4");
accessDefinition.setHash("1234");
accessDefinitions.add(accessDefinition);
AccessArtifact access = AccessArtifact.combine(accessDefinitions);
assertEquals("*", access.getConstraints().get(0).getMethod());
}
/**
* Divide test.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void divideTest() throws IOException {
String json = IOUtils.toString(AccessArtifactTest.class.getResourceAsStream("/access/test.access"), StandardCharsets.UTF_8);
AccessArtifact access = AccessArtifact.parse(json);
List<AccessDefinition> accessDefinitions = access.divide();
assertEquals("*", accessDefinitions.get(1).getMethod());
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2019 WeBank
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.webank.wedatasphere.linkis.cs.execution.matcher;
import com.webank.wedatasphere.linkis.cs.common.entity.source.ContextKeyValue;
import com.webank.wedatasphere.linkis.cs.condition.BinaryLogicCondition;
import com.webank.wedatasphere.linkis.cs.condition.Condition;
public abstract class BinaryLogicContextSearchMatcher extends AbstractContextSearchMatcher{
ContextSearchMatcher leftMatcher;
ContextSearchMatcher rightMatcher;
public BinaryLogicContextSearchMatcher(BinaryLogicCondition condition) {
super(condition);
this.leftMatcher = ConditionMatcherResolver.getMatcher(condition.getLeft());
this.rightMatcher = ConditionMatcherResolver.getMatcher(condition.getRight());
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{420D0D51-6BF7-4B33-8C53-7886844C2FE7}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RadImageEditorUIFirstLook</RootNamespace>
<AssemblyName>RadImageEditorUIFirstLook</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Telerik.Windows.Controls, Version=2013.1.213.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.ImageEditor, Version=2013.1.213.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.ImageEditor.dll</HintPath>
</Reference>
<Reference Include="Telerik.Windows.Controls.Input, Version=2013.1.213.1050, Culture=neutral, PublicKeyToken=5803cfa389c90ce7, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(TELERIKWPFDIR)\Binaries\WPF40\Telerik.Windows.Controls.Input.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="ImageExampleHelper.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="SampleImages\RadImageEditor.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> | {
"pile_set_name": "Github"
} |
package cn.rongcloud.im.model.qrcode;
public class QRUserInfo {
private String userId;
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserId() {
return userId;
}
}
| {
"pile_set_name": "Github"
} |
// This is a generated file from running the "createIcons" script. This file should not be updated manually.
import React, { forwardRef } from "react";
import { SVGIcon, SVGIconProps } from "@react-md/icon";
export const AccessibleSVGIcon = forwardRef<SVGSVGElement, SVGIconProps>(
function AccessibleSVGIcon(props, ref) {
return (
<SVGIcon {...props} ref={ref}>
<circle cx="12" cy="4" r="2" />
<path d="M19 13v-2c-1.54.02-3.09-.75-4.07-1.83l-1.29-1.43c-.17-.19-.38-.34-.61-.45-.01 0-.01-.01-.02-.01H13c-.35-.2-.75-.3-1.19-.26C10.76 7.11 10 8.04 10 9.09V15c0 1.1.9 2 2 2h5v5h2v-5.5c0-1.1-.9-2-2-2h-3v-3.45c1.29 1.07 3.25 1.94 5 1.95zm-6.17 5c-.41 1.16-1.52 2-2.83 2-1.66 0-3-1.34-3-3 0-1.31.84-2.41 2-2.83V12.1c-2.28.46-4 2.48-4 4.9 0 2.76 2.24 5 5 5 2.42 0 4.44-1.72 4.9-4h-2.07z" />
</SVGIcon>
);
}
);
| {
"pile_set_name": "Github"
} |
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
*
* The Apereo Foundation licenses this file to you under the Educational
* Community 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://opensource.org/licenses/ecl2.txt
*
* 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.opencastproject.composer.api;
import org.opencastproject.composer.layout.Dimension;
import org.opencastproject.job.api.Job;
import org.opencastproject.mediapackage.Attachment;
import org.opencastproject.mediapackage.MediaPackageException;
import org.opencastproject.mediapackage.Track;
import org.opencastproject.smil.entity.api.Smil;
import org.opencastproject.util.data.Option;
import java.util.List;
import java.util.Map;
/**
* Encodes media and (optionally) periodically alerts a statusService endpoint of the status of this encoding job.
*/
public interface ComposerService {
String JOB_TYPE = "org.opencastproject.composer";
/** Used as mediaType to mark the source to omit processing of audio or video stream for process smil */
String AUDIO_ONLY = "a";
String VIDEO_ONLY = "v";
/** sourceAudioName options for composite - use one or both, if null is passed, both will be used */
String UPPER = "upper";
String LOWER = "lower";
String BOTH = "both";
/**
* Encode one track, using that track's audio and video streams.
*
* @param sourceTrack
* The source track
* @param profileId
* The profile to use for encoding
* @return The receipt for this encoding job. The receipt can be used with ComposerService#getJob to
* obtain the status of an encoding job.
* @throws EncoderException
* @throws MediaPackageException
*/
Job encode(Track sourceTrack, String profileId) throws EncoderException, MediaPackageException;
/**
* Encode the video stream from one track and the audio stream from another, into a new Track.
*
* @param sourceVideoTrack
* The source video track
* @param sourceAudioTrack
* The source audio track
* @param profileId
* The profile to use for encoding
* @return The receipt for this encoding job
* @throws EncoderException
* if encoding fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job mux(Track sourceVideoTrack, Track sourceAudioTrack, String profileId) throws EncoderException,
MediaPackageException;
/**
* Compose two videos into one with an optional watermark.
*
* @param outputDimension
* The composite track dimension
* @param option
* upper track element from mediapackage (optional)
* @param lowerLaidOutElement
* lower track element from mediapackage
* @param watermarkOption
* watermark element (optional)
* @param identifier
* Encoding profile name
* @param outputBackground
* The background color
* @param sourceAudioName
* Use audio from only lower or upper track or both, use both when available if omitted
* @return The receipt for this composite job
* @throws EncoderException
* if encoding fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job composite(Dimension outputDimension, Option<LaidOutElement<Track>> option,
LaidOutElement<Track> lowerLaidOutElement, Option<LaidOutElement<Attachment>> watermarkOption,
String identifier, String outputBackground, String sourceAudioName) throws EncoderException, MediaPackageException;
/**
* Concat multiple tracks to a single track.
*
* @param profileId
* The encoding profile to use
* @param outputDimension
* The output dimensions
* @param sameCodec Defines if lossless concat should be used
* @param tracks
* an array of track to concat in order of the array
* @return The receipt for this concat job
* @throws EncoderException
* if encoding fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job concat(String profileId, Dimension outputDimension, boolean sameCodec, Track... tracks) throws EncoderException,
MediaPackageException;
/**
* Concat multiple tracks to a single track. Required ffmpeg version 1.1
*
* @param profileId The encoding profile to use
* @param outputDimension The output dimensions
* @param outputFrameRate The output frame rate
* @param sameCodec Defines if lossless concat should be used
* @param tracks an array of track to concat in order of the array
* @return The receipt for this concat job
* @throws EncoderException if encoding fails
* @throws MediaPackageException if the mediapackage is invalid
*/
Job concat(String profileId, Dimension outputDimension, float outputFrameRate, boolean sameCodec, Track... tracks) throws EncoderException,
MediaPackageException;
/**
* Transforms an image attachment to a video track
*
* @param sourceImageAttachment
* The source image attachment
* @param profileId
* The profile to use for encoding
* @param duration
* the length of the resulting video track in seconds
* @return The receipt for this image to video job
* @throws EncoderException
* if encoding fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job imageToVideo(Attachment sourceImageAttachment, String profileId, double duration) throws EncoderException,
MediaPackageException;
/**
* Trims the given track to the given start time and duration.
*
* @param sourceTrack
* The source track
* @param profileId
* The profile to use for trimming
* @param start
* start time in miliseconds
* @param duration
* duration in miliseconds
* @return The receipt for this encoding job. The receipt can be used with ComposerService#getJob to
* obtain the status of an encoding job.
* @throws EncoderException
* if trimming fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job trim(Track sourceTrack, String profileId, long start, long duration) throws EncoderException,
MediaPackageException;
/**
* Extracts an image from the media package element identified by <code>sourceVideoTrackId</code>. The image is taken
* at the timepoint <code>time</code> seconds into the movie.
*
* @param sourceTrack
* the source video track
* @param profileId
* identifier of the encoding profile
* @param time
* number of seconds into the video
* @return the extracted image as an attachment
* @throws EncoderException
* if image extraction fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
// TODO revise
Job image(Track sourceTrack, String profileId, double... time) throws EncoderException, MediaPackageException;
/**
* Synchronously extracts images from the source track. The images are taken at the given timepoints (seconds into
* the movie). Please note that synchronously doing this means, that the workload cannot be distributed amongst all
* nodes. This should be used rarely.
*
* @param sourceTrack
* the source video track
* @param profileId
* identifier of the encoding profile
* @param time
* number of seconds into the video
* @return the extracted images as attachments
* @throws EncoderException
* if image extraction fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
List<Attachment> imageSync(Track sourceTrack, String profileId, double... time) throws EncoderException,
MediaPackageException;
/**
* Extracts an image from the media package element identified by <code>sourceTrack</code>. The image is taken by the
* given properties and the corresponding encoding profile.
*
* @param sourceTrack
* the source video track
* @param profileId
* identifier of the encoding profile
* @param properties
* the properties applied to the encoding profile
* @return the extracted image as an attachment
* @throws EncoderException
* if image extraction fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job image(Track sourceTrack, String profileId, Map<String, String> properties) throws EncoderException,
MediaPackageException;
/**
* Converts the given image to a different image format using the specified image profiles.
*
* @param image
* the image
* @param profileIds
* the profiles to use for conversion
* @return the job for the image conversion
* @throws EncoderException
* if image conversion fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
Job convertImage(Attachment image, String... profileIds) throws EncoderException, MediaPackageException;
/**
* Synchronously converts the given image to different image formats using the specified encoding profiles. Please
* note that synchronously doing this means that the workload cannot be distributed amongst all nodes.
*
* @param image
* the image
* @param profileIds
* the profiles to use for conversion
* @return the converted images
* @throws EncoderException
* if image conversion fails
* @throws MediaPackageException
* if the mediapackage is invalid
*/
List<Attachment> convertImageSync(Attachment image, String... profileIds) throws EncoderException,
MediaPackageException;
/**
* @return All registered {@link EncodingProfile}s.
*/
EncodingProfile[] listProfiles();
/**
* Gets a profile by its ID
*
* @param profileId
* The profile ID
* @return The encoding profile, or null if no profile is registered with that ID
*/
EncodingProfile getProfile(String profileId);
/**
* Encode one track to multiple other tracks in one encoding operation, using that track's audio and video streams.
*
* @param sourceTrack
* The source track
* @param profileId
* The profile to use for encoding
* @throws EncoderException
* @throws MediaPackageException
*/
Job parallelEncode(Track sourceTrack, String profileId) throws EncoderException, MediaPackageException;
/**
* Demux a multi-track source into 2 media as defined by the encoding profile, the results are flavored and tagged
* positionally. eg: One ffmpeg operation to produce presenter/work and presentation/work
*
* @param sourceTrack
* @param profileId
* @return Receipt for this demux based on the profile
* @throws EncoderException
* @throws MediaPackageException
*/
Job demux(Track sourceTrack, String profileId) throws EncoderException, MediaPackageException;
/**
* Reads a smil definition and create one media track in multiple delivery formats. The track in the smil is selected
* by "trackParamGroupId" which is the paramGroup in the smil The multiple delivery formats are determined by a list
* of encoding profiles by name. The resultant tracks will be tagged by profile name. The smil file can contain more
* than one source track but they must have the same dimension. This is used mainly on smil.xml from the editor. There
* is a configurable fadein/fadeout between each clip (default is 2s).
*
* @param smil
* - Describes one media (can contain multiple source in ws) and editing instructions (in out points of video
* clips) for concatenation into one video with transitions
* @param trackParamGroupId
* - track group id to process, if missing, will process first track found in smil
* @param mediaType
* - v for videoOnly, a for audioOnly, anything else is AudioVisual
* @param profileIds
* - Encoding profiles for each output from this media
* @return Receipt for this processing based on the smil file and the list of profiles
* @throws EncoderException
* @throws MediaPackageException
*/
Job processSmil(Smil smil, String trackParamGroupId, String mediaType, List<String> profileIds)
throws EncoderException, MediaPackageException;
/**
* Encodes a track to set of media targets as defined by a list of encoding profiles
*
* @param track
* - video or audio track
* @param profileIds
* - a list of encoding profiles by name
* @return Receipt for this processing based on the inputs
* @throws EncoderException
* if it fails
* @throws MediaPackageException
* if adding files to a mediapackage produces errors
*/
Job multiEncode(Track track, List<String> profileIds) throws EncoderException, MediaPackageException;
}
| {
"pile_set_name": "Github"
} |
#!/bin/bash -e
# The -e option will make the bash stop if any command raise an error ($? != 0)
ln -s $TRAVIS_BUILD_DIR /var/lib/domogik/domogik_packages/plugin_$DMG_PLUGIN
ls -l /var/lib/domogik/domogik_packages/plugin_$DMG_PLUGIN/
| {
"pile_set_name": "Github"
} |
/*
* Copyright © 2014-2016 Cask Data, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package io.cdap.cdap.explore.jdbc;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import io.cdap.cdap.explore.client.ExploreClient;
import io.cdap.cdap.explore.client.MockExploreClient;
import io.cdap.cdap.proto.ColumnDesc;
import io.cdap.cdap.proto.QueryResult;
import org.junit.Assert;
import org.junit.Test;
import java.sql.ResultSet;
import java.util.List;
/**
* Tests for {@link ExploreStatement}.
*/
public class ExploreStatementTest {
@Test
public void executeTest() throws Exception {
List<ColumnDesc> columnDescriptions = Lists.newArrayList(new ColumnDesc("column1", "STRING", 1, ""));
List<QueryResult> queryResults = Lists.newArrayList();
ExploreClient exploreClient = new MockExploreClient(
ImmutableMap.of(
"mock_query_1", columnDescriptions,
"mock_query_2", columnDescriptions,
"mock_query_3", columnDescriptions,
"mock_query_4", columnDescriptions
),
ImmutableMap.of(
"mock_query_1", queryResults,
"mock_query_2", queryResults,
"mock_query_3", queryResults,
"mock_query_4", queryResults
)
);
// Make sure an empty query still has a ResultSet associated to it
ExploreStatement statement = new ExploreStatement(null, exploreClient, "ns1");
Assert.assertTrue(statement.execute("mock_query_1"));
ResultSet rs = statement.getResultSet();
Assert.assertNotNull(rs);
Assert.assertFalse(rs.isClosed());
Assert.assertFalse(rs.next());
rs = statement.executeQuery("mock_query_2");
Assert.assertNotNull(rs);
Assert.assertFalse(rs.isClosed());
Assert.assertFalse(rs.next());
// Make sure subsequent calls to an execute method close the previous results
ResultSet rs2 = statement.executeQuery("mock_query_3");
Assert.assertTrue(rs.isClosed());
Assert.assertNotNull(rs2);
Assert.assertFalse(rs2.isClosed());
Assert.assertFalse(rs2.next());
Assert.assertTrue(statement.execute("mock_query_4"));
Assert.assertTrue(rs2.isClosed());
}
}
| {
"pile_set_name": "Github"
} |
#anaconda-spoke-selector-title {
font-weight: bold;
font-size: large;
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/iot/model/StartOnDemandAuditTaskResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::IoT::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
StartOnDemandAuditTaskResult::StartOnDemandAuditTaskResult()
{
}
StartOnDemandAuditTaskResult::StartOnDemandAuditTaskResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
*this = result;
}
StartOnDemandAuditTaskResult& StartOnDemandAuditTaskResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
JsonView jsonValue = result.GetPayload().View();
if(jsonValue.ValueExists("taskId"))
{
m_taskId = jsonValue.GetString("taskId");
}
return *this;
}
| {
"pile_set_name": "Github"
} |

[](https://travis-ci.org/onsi/gomega)
Jump straight to the [docs](http://onsi.github.io/gomega/) to learn about Gomega, including a list of [all available matchers](http://onsi.github.io/gomega/#provided-matchers).
If you have a question, comment, bug report, feature request, etc. please open a GitHub issue.
## [Ginkgo](http://github.com/onsi/ginkgo): a BDD Testing Framework for Golang
Learn more about Ginkgo [here](http://onsi.github.io/ginkgo/)
## Community Matchers
A collection of community matchers is available on the [wiki](https://github.com/onsi/gomega/wiki).
## License
Gomega is MIT-Licensed
The `ConsistOf` matcher uses [goraph](https://github.com/amitkgupta/goraph) which is embedded in the source to simplify distribution. goraph has an MIT license.
| {
"pile_set_name": "Github"
} |
package com.jege.spring.boot.exception;
/**
* @author JE哥
* @email [email protected]
* @description:自定义异常类
*/
public class ServiceException extends RuntimeException {
public ServiceException(String msg) {
super(msg);
}
}
| {
"pile_set_name": "Github"
} |
/*
This file is part of TON Blockchain Library.
TON Blockchain Library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
TON Blockchain Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with TON Blockchain Library. If not, see <http://www.gnu.org/licenses/>.
Copyright 2017-2020 Telegram Systems LLP
*/
#include "adnl-query.h"
#include "common/errorcode.h"
#include "td/utils/Random.h"
namespace ton {
namespace adnl {
void AdnlQuery::alarm() {
promise_.set_error(td::Status::Error(ErrorCode::timeout, "adnl query timeout"));
stop();
}
void AdnlQuery::result(td::BufferSlice data) {
promise_.set_value(std::move(data));
stop();
}
AdnlQueryId AdnlQuery::random_query_id() {
AdnlQueryId q_id;
td::Random::secure_bytes(q_id.as_slice());
return q_id;
}
} // namespace adnl
} // namespace ton
| {
"pile_set_name": "Github"
} |
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) %copyright_year%, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* ---------------------------------------------------------------------------- */
#ifndef _SAM3U_WDT_COMPONENT_
#define _SAM3U_WDT_COMPONENT_
/* ============================================================================= */
/** SOFTWARE API DEFINITION FOR Watchdog Timer */
/* ============================================================================= */
/** \addtogroup SAM3U_WDT Watchdog Timer */
/*@{*/
#if !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
/** \brief Wdt hardware registers */
typedef struct {
WoReg WDT_CR; /**< \brief (Wdt Offset: 0x00) Control Register */
RwReg WDT_MR; /**< \brief (Wdt Offset: 0x04) Mode Register */
RoReg WDT_SR; /**< \brief (Wdt Offset: 0x08) Status Register */
} Wdt;
#endif /* !(defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
/* -------- WDT_CR : (WDT Offset: 0x00) Control Register -------- */
#define WDT_CR_WDRSTT (0x1u << 0) /**< \brief (WDT_CR) Watchdog Restart */
#define WDT_CR_KEY_Pos 24
#define WDT_CR_KEY_Msk (0xffu << WDT_CR_KEY_Pos) /**< \brief (WDT_CR) Password */
#define WDT_CR_KEY(value) ((WDT_CR_KEY_Msk & ((value) << WDT_CR_KEY_Pos)))
/* -------- WDT_MR : (WDT Offset: 0x04) Mode Register -------- */
#define WDT_MR_WDV_Pos 0
#define WDT_MR_WDV_Msk (0xfffu << WDT_MR_WDV_Pos) /**< \brief (WDT_MR) Watchdog Counter Value */
#define WDT_MR_WDV(value) ((WDT_MR_WDV_Msk & ((value) << WDT_MR_WDV_Pos)))
#define WDT_MR_WDFIEN (0x1u << 12) /**< \brief (WDT_MR) Watchdog Fault Interrupt Enable */
#define WDT_MR_WDRSTEN (0x1u << 13) /**< \brief (WDT_MR) Watchdog Reset Enable */
#define WDT_MR_WDRPROC (0x1u << 14) /**< \brief (WDT_MR) Watchdog Reset Processor */
#define WDT_MR_WDDIS (0x1u << 15) /**< \brief (WDT_MR) Watchdog Disable */
#define WDT_MR_WDD_Pos 16
#define WDT_MR_WDD_Msk (0xfffu << WDT_MR_WDD_Pos) /**< \brief (WDT_MR) Watchdog Delta Value */
#define WDT_MR_WDD(value) ((WDT_MR_WDD_Msk & ((value) << WDT_MR_WDD_Pos)))
#define WDT_MR_WDDBGHLT (0x1u << 28) /**< \brief (WDT_MR) Watchdog Debug Halt */
#define WDT_MR_WDIDLEHLT (0x1u << 29) /**< \brief (WDT_MR) Watchdog Idle Halt */
/* -------- WDT_SR : (WDT Offset: 0x08) Status Register -------- */
#define WDT_SR_WDUNF (0x1u << 0) /**< \brief (WDT_SR) Watchdog Underflow */
#define WDT_SR_WDERR (0x1u << 1) /**< \brief (WDT_SR) Watchdog Error */
/*@}*/
#endif /* _SAM3U_WDT_COMPONENT_ */
| {
"pile_set_name": "Github"
} |
/*
* jclossls.c
*
* Copyright (C) 1998, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains the control logic for the lossless JPEG compressor.
*/
#define JPEG_INTERNALS
#include "jinclude16.h"
#include "jpeglib16.h"
#include "jlossls16.h"
#ifdef C_LOSSLESS_SUPPORTED
/*
* Initialize for a processing pass.
*/
METHODDEF(void)
start_pass (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
j_lossless_c_ptr losslsc = (j_lossless_c_ptr) cinfo->codec;
(*losslsc->scaler_start_pass) (cinfo);
(*losslsc->predict_start_pass) (cinfo);
(*losslsc->diff_start_pass) (cinfo, pass_mode);
}
/*
* Initialize the lossless compression codec.
* This is called only once, during master selection.
*/
GLOBAL(void)
jinit_lossless_c_codec(j_compress_ptr cinfo)
{
j_lossless_c_ptr losslsc;
/* Create subobject in permanent pool */
losslsc = (j_lossless_c_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
SIZEOF(jpeg_lossless_c_codec));
cinfo->codec = (struct jpeg_c_codec *) losslsc;
/* Initialize sub-modules */
/* Scaler */
jinit_c_scaler(cinfo);
/* Differencer */
jinit_differencer(cinfo);
/* Entropy encoding: either Huffman or arithmetic coding. */
if (cinfo->arith_code) {
#ifdef WITH_ARITHMETIC_PATCH
jinit_arith_encoder(cinfo);
#else
ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
#endif
} else {
jinit_lhuff_encoder(cinfo);
}
/* Need a full-image difference buffer in any multi-pass mode. */
jinit_c_diff_controller(cinfo,
(boolean) (cinfo->num_scans > 1 ||
cinfo->optimize_coding));
/* Initialize method pointers.
*
* Note: entropy_start_pass and entropy_finish_pass are assigned in
* jclhuff.c and compress_data is assigned in jcdiffct.c.
*/
losslsc->pub.start_pass = start_pass;
}
#endif /* C_LOSSLESS_SUPPORTED */
| {
"pile_set_name": "Github"
} |
namespace XSharp.Assembler.x86.SSE
{
[XSharp.Assembler.OpCode("addpd")]
public class AddPD : InstructionWithDestinationAndSource
{
}
} | {
"pile_set_name": "Github"
} |
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "postfacto.fullname" . }}-test-connection"
labels:
{{ include "postfacto.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "postfacto.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
| {
"pile_set_name": "Github"
} |
<?php
| {
"pile_set_name": "Github"
} |
all: manyboxplots.js hypo.json
manyboxplots.js: manyboxplots.coffee
coffee -c manyboxplots.coffee
hypo.json: R/grab_data.R R/F2.mlratio.hypo.RData
cd R;R CMD BATCH grab_data.R
web: all
scp index.html manyboxplots.coffee manyboxplots.css manyboxplots.js hypo.json broman-2.biostat.wisc.edu:public_html/D3/manyboxplots/
| {
"pile_set_name": "Github"
} |
; REQUIRES: object-emission
; RUN: %llc_dwarf -generate-dwarf-pub-sections=Enable -filetype=obj -o %t.o < %s
; RUN: llvm-dwarfdump -debug-dump=pubnames %t.o | FileCheck %s
; ModuleID = 'dwarf-public-names.cpp'
;
; Generated from:
;
; struct C {
; void member_function();
; static int static_member_function();
; static int static_member_variable;
; };
;
; int C::static_member_variable = 0;
;
; void C::member_function() {
; static_member_variable = 0;
; }
;
; int C::static_member_function() {
; return static_member_variable;
; }
;
; C global_variable;
;
; int global_function() {
; return -1;
; }
;
; namespace ns {
; void global_namespace_function() {
; global_variable.member_function();
; }
; int global_namespace_variable = 1;
; }
; Skip the output to the header of the pubnames section.
; CHECK: debug_pubnames
; CHECK: version = 0x0002
; Check for each name in the output.
; CHECK-DAG: "ns"
; CHECK-DAG: "C::static_member_function"
; CHECK-DAG: "global_variable"
; CHECK-DAG: "ns::global_namespace_variable"
; CHECK-DAG: "ns::global_namespace_function"
; CHECK-DAG: "global_function"
; CHECK-DAG: "C::static_member_variable"
; CHECK-DAG: "C::member_function"
source_filename = "test/DebugInfo/Generic/dwarf-public-names.ll"
%struct.C = type { i8 }
@_ZN1C22static_member_variableE = global i32 0, align 4, !dbg !0
@global_variable = global %struct.C zeroinitializer, align 1, !dbg !15
@_ZN2ns25global_namespace_variableE = global i32 1, align 4, !dbg !17
; Function Attrs: nounwind uwtable
define void @_ZN1C15member_functionEv(%struct.C* %this) #0 align 2 !dbg !23 {
entry:
%this.addr = alloca %struct.C*, align 8
store %struct.C* %this, %struct.C** %this.addr, align 8
call void @llvm.dbg.declare(metadata %struct.C** %this.addr, metadata !24, metadata !26), !dbg !27
%this1 = load %struct.C*, %struct.C** %this.addr
store i32 0, i32* @_ZN1C22static_member_variableE, align 4, !dbg !28
ret void, !dbg !29
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
; Function Attrs: nounwind uwtable
define i32 @_ZN1C22static_member_functionEv() #0 align 2 !dbg !30 {
entry:
%0 = load i32, i32* @_ZN1C22static_member_variableE, align 4, !dbg !31
ret i32 %0, !dbg !31
}
; Function Attrs: nounwind uwtable
define i32 @_Z15global_functionv() #0 !dbg !32 {
entry:
ret i32 -1, !dbg !33
}
; Function Attrs: nounwind uwtable
define void @_ZN2ns25global_namespace_functionEv() #0 !dbg !34 {
entry:
call void @_ZN1C15member_functionEv(%struct.C* @global_variable), !dbg !37
ret void, !dbg !38
}
attributes #0 = { nounwind uwtable }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!20}
!llvm.module.flags = !{!22}
!0 = !DIGlobalVariableExpression(var: !1)
!1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5)
!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "C", file: !3, line: 1, size: 8, align: 8, elements: !4)
!3 = !DIFile(filename: "dwarf-public-names.cpp", directory: "/usr2/kparzysz/s.hex/t")
!4 = !{!5, !7, !12}
!5 = !DIDerivedType(tag: DW_TAG_member, name: "static_member_variable", scope: !2, file: !3, line: 4, baseType: !6, flags: DIFlagStaticMember)
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!7 = !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: !2, file: !3, line: 2, type: !8, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, variables: !11)
!8 = !DISubroutineType(types: !9)
!9 = !{null, !10}
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
!11 = !{}
!12 = !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: !2, file: !3, line: 3, type: !13, isLocal: false, isDefinition: false, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, variables: !11)
!13 = !DISubroutineType(types: !14)
!14 = !{!6}
!15 = !DIGlobalVariableExpression(var: !16)
!16 = !DIGlobalVariable(name: "global_variable", scope: null, file: !3, line: 17, type: !2, isLocal: false, isDefinition: true) ; previously: invalid DW_TAG_base_type
!17 = !DIGlobalVariableExpression(var: !18)
!18 = !DIGlobalVariable(name: "global_namespace_variable", linkageName: "_ZN2ns25global_namespace_variableE", scope: !19, file: !3, line: 27, type: !6, isLocal: false, isDefinition: true)
!19 = !DINamespace(name: "ns", scope: null)
!20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3 (http://llvm.org/git/clang.git a09cd8103a6a719cb2628cdf0c91682250a17bd2) (http://llvm.org/git/llvm.git 47d03cec0afca0c01ae42b82916d1d731716cd20)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type
!21 = !{!0, !15, !17}
!22 = !{i32 1, !"Debug Info Version", i32 3}
!23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, variables: !11)
!24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64)
!26 = !DIExpression()
!27 = !DILocation(line: 9, scope: !23)
!28 = !DILocation(line: 10, scope: !23)
!29 = !DILocation(line: 11, scope: !23)
!30 = distinct !DISubprogram(name: "static_member_function", linkageName: "_ZN1C22static_member_functionEv", scope: null, file: !3, line: 13, type: !13, isLocal: false, isDefinition: true, scopeLine: 13, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !12, variables: !11)
!31 = !DILocation(line: 14, scope: !30)
!32 = distinct !DISubprogram(name: "global_function", linkageName: "_Z15global_functionv", scope: !3, file: !3, line: 19, type: !13, isLocal: false, isDefinition: true, scopeLine: 19, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, variables: !11)
!33 = !DILocation(line: 20, scope: !32)
!34 = distinct !DISubprogram(name: "global_namespace_function", linkageName: "_ZN2ns25global_namespace_functionEv", scope: !19, file: !3, line: 24, type: !35, isLocal: false, isDefinition: true, scopeLine: 24, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, variables: !11)
!35 = !DISubroutineType(types: !36)
!36 = !{null}
!37 = !DILocation(line: 25, scope: !34)
!38 = !DILocation(line: 26, scope: !34)
| {
"pile_set_name": "Github"
} |
#import "RuntimeRepository.h"
#import "RuntimeInstance.h"
#import "RuntimeContainer.h"
#import "MissingRuntimeInstance.h"
NSString *const LRRuntimesDidChangeNotification = @"LRRuntimesDidChangeNotification";
@interface RuntimeRepository ()
@end
@implementation RuntimeRepository {
NSMutableDictionary *_instancesByIdentifier;
NSMutableArray *_instances;
NSMutableArray *_containers;
NSMutableArray *_customInstances;
NSMutableArray *_customContainers;
NSMutableDictionary *_containerTypes;
BOOL _scheduledRuntimesDidChangeNotification;
BOOL _dirty;
}
- (id)init {
self = [super init];
if (self) {
_containerTypes = [[NSMutableDictionary alloc] init];
_instancesByIdentifier = [[NSMutableDictionary alloc] init];
_instances = [[NSMutableArray alloc] init];
_customInstances = [[NSMutableArray alloc] init];
_containers = [[NSMutableArray alloc] init];
_customContainers = [[NSMutableArray alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(runtimeDidChange:) name:LRRuntimeInstanceDidChangeNotification object:nil];
}
return self;
}
#pragma mark - Instances
- (NSArray *)instances {
return _instances;
}
- (NSArray *)systemInstances {
return [_instances filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
return ![evaluatedObject isPersistent];
}]];
}
- (NSArray *)customInstances {
return [_instances filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
return [evaluatedObject isPersistent];
}]];
}
- (void)addInstance:(RuntimeInstance *)instance {
[_instances addObject:instance];
[_instancesByIdentifier setObject:instance forKey:instance.identifier];
[instance validate];
[self runtimesDidChange];
}
- (void)addCustomInstance:(RuntimeInstance *)instance {
[_customInstances addObject:instance];
[self addInstance:instance];
}
- (void)removeInstance:(RuntimeInstance *)instance {
[_customInstances removeObject:instance];
[_instances removeObject:instance];
[self runtimesDidChange];
}
#pragma mark - Containers
- (NSArray *)containers {
return _containers;
}
- (void)addContainerClass:(Class)containerClass {
NSString *typeIdentifier = [containerClass containerTypeIdentifier];
_containerTypes[typeIdentifier] = containerClass;
}
- (void)addContainer:(RuntimeContainer *)container {
[_containers addObject:container];
[container validate];
[self runtimesDidChange];
}
- (void)addCustomContainer:(RuntimeContainer *)container {
[_customContainers addObject:container];
[self addContainer:container];
}
- (void)removeContainer:(RuntimeContainer *)container {
[_customContainers removeObject:container];
[_containers removeObject:container];
[self runtimesDidChange];
}
#pragma mark - Polymorphic instance/container handling
- (void)addCustomRuntimeObject:(id<RuntimeObject>)object {
if ([object isKindOfClass:[RuntimeInstance class]])
[self addCustomInstance:object];
else if ([object isKindOfClass:[RuntimeContainer class]])
[self addCustomContainer:object];
else
abort();
}
- (BOOL)canRemoveRuntimeObject:(id<RuntimeObject>)object {
if ([object isKindOfClass:[RuntimeInstance class]])
return [_customInstances containsObject:object];
else if ([object isKindOfClass:[RuntimeContainer class]])
return [_customContainers containsObject:object];
else
abort();
}
- (void)removeRuntimeObject:(id<RuntimeObject>)object {
if ([object isKindOfClass:[RuntimeInstance class]])
[self removeInstance:object];
else if ([object isKindOfClass:[RuntimeContainer class]])
[self removeContainer:object];
else
abort();
}
#pragma mark - Lookup
- (RuntimeInstance *)instanceIdentifiedBy:(NSString *)identifier {
RuntimeInstance *result = [_instancesByIdentifier objectForKey:identifier];
if (!result) {
for (RuntimeContainer *container in _containers) {
result = [container instanceIdentifiedBy:identifier];
if (result)
break;
}
}
if (!result)
result = [[MissingRuntimeInstance alloc] initWithMemento:@{@"identifier": identifier} additionalInfo:nil];
return result;
}
#pragma mark - Change events
- (void)runtimesDidChange {
dispatch_async(dispatch_get_main_queue(), ^{
[self saveSoon];
if (_scheduledRuntimesDidChangeNotification)
return;
_scheduledRuntimesDidChangeNotification = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 10 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
_scheduledRuntimesDidChangeNotification = NO;
[[NSNotificationCenter defaultCenter] postNotificationName:LRRuntimesDidChangeNotification object:self];
});
});
}
- (void)runtimeDidChange:(NSNotification *)notification {
dispatch_async(dispatch_get_main_queue(), ^{
[self saveSoon];
});
}
#pragma mark - Instance creation
- (RuntimeInstance *)newInstanceWithMemento:(NSDictionary *)memento {
return nil;
}
- (RuntimeContainer *)newContainerWithMemento:(NSDictionary *)memento {
NSString *type = memento[@"type"];
if ([type length] > 0) {
Class containerClass = _containerTypes[type];
if (containerClass) {
return [[containerClass alloc] initWithMemento:memento additionalInfo:nil];
}
}
return nil;
}
#pragma mark - Memento
- (NSDictionary *)memento {
return @{@"instances": [_customInstances valueForKey:@"memento"], @"containers": [_customContainers valueForKey:@"memento"]};
}
- (void)setMemento:(NSDictionary *)dictionary {
for (NSDictionary *instanceMemento in dictionary[@"instances"]) {
RuntimeInstance *instance = [self newInstanceWithMemento:instanceMemento];
if (instance) {
[_customInstances addObject:instance];
[self addInstance:instance];
}
}
for (NSDictionary *containerMemento in dictionary[@"containers"]) {
RuntimeContainer *container = [self newContainerWithMemento:containerMemento];
if (container) {
[_customContainers addObject:container];
[self addContainer:container];
}
}
[self runtimesDidChange];
}
#pragma mark - Persistence
- (NSString *)dataFileName {
abort();
}
- (NSString *)dataFilePath {
return [[[[[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:NULL] path] stringByAppendingPathComponent:@"LiveReload/Data"] stringByAppendingPathComponent:[self dataFileName]];
}
- (void)load {
NSDictionary *dictionary = [NSDictionary dictionary];
NSData *data = [NSData dataWithContentsOfFile:[self dataFilePath] options:NSDataReadingUncached error:NULL];
if (data) {
id obj = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:NULL];
if (obj) {
dictionary = obj;
}
}
[self setMemento:dictionary];
}
- (void)saveSoon {
_dirty = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 50 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
_dirty = NO;
[self saveNow];
});
}
- (void)saveNow {
[[NSFileManager defaultManager] createDirectoryAtPath:[self.dataFilePath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:NULL];
[[NSJSONSerialization dataWithJSONObject:self.memento options:NSJSONWritingPrettyPrinted error:NULL] writeToFile:self.dataFilePath options:NSDataWritingAtomic error:NULL];
}
@end
| {
"pile_set_name": "Github"
} |
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`tabs color property 1`] = `
<div class="wv-tabs wv-tabs--line">
<div class="wv-tabs__wrap wv-hairline--top-bottom">
<div class="wv-tabs__nav wv-tabs__nav--line" style="border-color: red;">
<div class="wv-tabs__line" style="background-color: red; width: 0px; transform: translateX(0px); transition-duration: 0.2s;"></div>
<div class="wv-tab wv-tab--active"><span class="wv-ellipsis"></span></div>
<div class="wv-tab"><span class="wv-ellipsis"></span></div>
<div class="wv-tab"><span class="wv-ellipsis"></span></div>
</div>
</div>
<div class="wv-tabs__content">
<div class="wv-tab__pane"></div>
<div class="wv-tab__pane" style="display: none;"></div>
<div class="wv-tab__pane" style="display: none;"></div>
</div>
</div>
`;
exports[`tabs create with tab items 1`] = `
<div class="wv-tabs wv-tabs--line">
<div class="wv-tabs__wrap wv-hairline--top-bottom">
<div class="wv-tabs__nav wv-tabs__nav--line">
<div class="wv-tabs__line"></div>
<div class="wv-tab wv-tab--active"><span class="wv-ellipsis"></span></div>
<div class="wv-tab"><span class="wv-ellipsis"></span></div>
<div class="wv-tab"><span class="wv-ellipsis"></span></div>
</div>
</div>
<div class="wv-tabs__content">
<div class="wv-tab__pane"></div>
<div class="wv-tab__pane" style="display: none;"></div>
<div class="wv-tab__pane" style="display: none;"></div>
</div>
</div>
`;
exports[`tabs lineHeight property 1`] = `
<div class="wv-tabs wv-tabs--line">
<div class="wv-tabs__wrap wv-hairline--top-bottom">
<div class="wv-tabs__nav wv-tabs__nav--line">
<div class="wv-tabs__line" style="width: 0px; transform: translateX(0px); transition-duration: 0.2s; height: 10px; border-radius: 10px;"></div>
<div class="wv-tab wv-tab--active"><span class="wv-ellipsis"></span></div>
<div class="wv-tab"><span class="wv-ellipsis"></span></div>
<div class="wv-tab"><span class="wv-ellipsis"></span></div>
</div>
</div>
<div class="wv-tabs__content">
<div class="wv-tab__pane"></div>
<div class="wv-tab__pane" style="display: none;"></div>
<div class="wv-tab__pane" style="display: none;"></div>
</div>
</div>
`;
| {
"pile_set_name": "Github"
} |
var Vector2 = function (x,y) {
this.x= x || 0;
this.y = y || 0;
};
Vector2.prototype = {
reset: function ( x, y ) {
this.x = x;
this.y = y;
return this;
},
toString : function (decPlaces) {
decPlaces = decPlaces || 3;
var scalar = Math.pow(10,decPlaces);
return "[" + Math.round (this.x * scalar) / scalar + ", " + Math.round (this.y * scalar) / scalar + "]";
},
clone : function () {
return new Vector2(this.x, this.y);
},
copyTo : function (v) {
v.x = this.x;
v.y = this.y;
},
copyFrom : function (v) {
this.x = v.x;
this.y = v.y;
},
magnitude : function () {
return Math.sqrt((this.x*this.x)+(this.y*this.y));
},
magnitudeSquared : function () {
return (this.x*this.x)+(this.y*this.y);
},
normalise : function () {
var m = this.magnitude();
this.x = this.x/m;
this.y = this.y/m;
return this;
},
reverse : function () {
this.x = -this.x;
this.y = -this.y;
return this;
},
plusEq : function (v) {
this.x+=v.x;
this.y+=v.y;
return this;
},
plusNew : function (v) {
return new Vector2(this.x+v.x, this.y+v.y);
},
minusEq : function (v) {
this.x-=v.x;
this.y-=v.y;
return this;
},
minusNew : function (v) {
return new Vector2(this.x-v.x, this.y-v.y);
},
multiplyEq : function (scalar) {
this.x*=scalar;
this.y*=scalar;
return this;
},
multiplyNew : function (scalar) {
var returnvec = this.clone();
return returnvec.multiplyEq(scalar);
},
divideEq : function (scalar) {
this.x/=scalar;
this.y/=scalar;
return this;
},
divideNew : function (scalar) {
var returnvec = this.clone();
return returnvec.divideEq(scalar);
},
dot : function (v) {
return (this.x * v.x) + (this.y * v.y) ;
},
angle : function (useRadians) {
return Math.atan2(this.y,this.x) * (useRadians ? 1 : Vector2Const.TO_DEGREES);
},
rotate : function (angle, useRadians) {
var cosRY = Math.cos(angle * (useRadians ? 1 : Vector2Const.TO_RADIANS));
var sinRY = Math.sin(angle * (useRadians ? 1 : Vector2Const.TO_RADIANS));
Vector2Const.temp.copyFrom(this);
this.x= (Vector2Const.temp.x*cosRY)-(Vector2Const.temp.y*sinRY);
this.y= (Vector2Const.temp.x*sinRY)+(Vector2Const.temp.y*cosRY);
return this;
},
equals : function (v) {
return((this.x==v.x)&&(this.y==v.x));
},
isCloseTo : function (v, tolerance) {
if(this.equals(v)) return true;
Vector2Const.temp.copyFrom(this);
Vector2Const.temp.minusEq(v);
return(Vector2Const.temp.magnitudeSquared() < tolerance*tolerance);
},
rotateAroundPoint : function (point, angle, useRadians) {
Vector2Const.temp.copyFrom(this);
//trace("rotate around point "+t+" "+point+" " +angle);
Vector2Const.temp.minusEq(point);
//trace("after subtract "+t);
Vector2Const.temp.rotate(angle, useRadians);
//trace("after rotate "+t);
Vector2Const.temp.plusEq(point);
//trace("after add "+t);
this.copyFrom(Vector2Const.temp);
},
isMagLessThan : function (distance) {
return(this.magnitudeSquared()<distance*distance);
},
isMagGreaterThan : function (distance) {
return(this.magnitudeSquared()>distance*distance);
}
// still AS3 to convert :
// public function projectOnto(v:Vector2) : Vector2
// {
// var dp:Number = dot(v);
//
// var f:Number = dp / ( v.x*v.x + v.y*v.y );
//
// return new Vector2( f*v.x , f*v.y);
// }
//
//
// public function convertToNormal():void
// {
// var tempx:Number = x;
// x = -y;
// y = tempx;
//
//
// }
// public function getNormal():Vector2
// {
//
// return new Vector2(-y,x);
//
// }
//
//
//
// public function getClosestPointOnLine ( vectorposition : Point, targetpoint : Point ) : Point
// {
// var m1 : Number = y / x ;
// var m2 : Number = x / -y ;
//
// var b1 : Number = vectorposition.y - ( m1 * vectorposition.x ) ;
// var b2 : Number = targetpoint.y - ( m2 * targetpoint.x ) ;
//
// var cx : Number = ( b2 - b1 ) / ( m1 - m2 ) ;
// var cy : Number = m1 * cx + b1 ;
//
// return new Point ( cx, cy ) ;
// }
//
};
Vector2Const = {
TO_DEGREES : 180 / Math.PI,
TO_RADIANS : Math.PI / 180,
temp : new Vector2()
};
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.