text
stringlengths 2
99.5k
| meta
dict |
|---|---|
{
"type": "bundle",
"id": "bundle--298fe966-72ff-41af-91bb-c56ecd399c50",
"spec_version": "2.0",
"objects": [
{
"created_by_ref": "identity--c78cb6e5-0c4b-4611-8297-d1b8b55e40b5",
"object_marking_refs": [
"marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168"
],
"source_ref": "malware--6fcaf9b0-b509-4644-9f93-556222c81ed2",
"target_ref": "attack-pattern--6683aa0c-d98a-4f5b-ac57-ca7e9934a760",
"external_references": [
{
"description": "GReAT. (2019, June 26). ViceLeaker Operation: mobile espionage targeting Middle East. Retrieved November 21, 2019.",
"url": "https://securelist.com/fanning-the-flames-viceleaker-operation/90877/",
"source_name": "SecureList - ViceLeaker 2019"
},
{
"source_name": "Bitdefender - Triout 2018",
"url": "https://labs.bitdefender.com/2018/08/triout-spyware-framework-for-android-with-extensive-surveillance-capabilities/",
"description": "L. Arsene, C. Ochinca. (2018, August 20). Triout \u2013 Spyware Framework for Android with Extensive Surveillance Capabilities. Retrieved January 21, 2020."
}
],
"description": "[ViceLeaker](https://attack.mitre.org/software/S0418) can record audio from the device\u2019s microphone and can record phone calls together with the caller ID.(Citation: SecureList - ViceLeaker 2019)(Citation: Bitdefender - Triout 2018)",
"relationship_type": "uses",
"id": "relationship--f632b0bb-69ce-4678-bc3c-9ddff5a38794",
"type": "relationship",
"modified": "2020-01-21T14:20:50.474Z",
"created": "2019-11-21T16:42:48.488Z"
}
]
}
|
{
"pile_set_name": "Github"
}
|
################################################################################
#
# libcli
#
################################################################################
LIBCLI_VERSION = c63c9d35144939c8b4fa3c5394aed2e29ff517b0
LIBCLI_SITE = $(call github,dparrish,libcli,$(LIBCLI_VERSION))
LIBCLI_LICENSE = LGPL-2.1
LIBCLI_LICENSE_FILES = COPYING
LIBCLI_INSTALL_STAGING = YES
# We will pass optimisation level via CFLAGS so remove libcli default
LIBCLI_MAKE_ARGS += OPTIM=
# We can't run the test harness
LIBCLI_MAKE_ARGS += TESTS=
# Disable the static library for shared only build
ifeq ($(BR2_SHARED_LIBS),y)
LIBCLI_MAKE_ARGS += STATIC_LIB=
endif
# Disable the shared library for static only build
ifeq ($(BR2_STATIC_LIBS),y)
LIBCLI_MAKE_ARGS += DYNAMIC_LIB=
endif
define LIBCLI_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
$(LIBCLI_MAKE_ARGS)
endef
define LIBCLI_INSTALL_STAGING_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
$(LIBCLI_MAKE_ARGS) DESTDIR=$(STAGING_DIR) PREFIX=/usr install
endef
define LIBCLI_INSTALL_TARGET_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
$(LIBCLI_MAKE_ARGS) DESTDIR=$(TARGET_DIR) PREFIX=/usr install
endef
$(eval $(generic-package))
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD//XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: Grid-column with a negative value</title>
<link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
<link rel="help" href="http://dev.w3.org/csswg/css3-grid-align/#grid-declaration" />
<meta name="flags" content="ahem invalid" />
<meta name="assert" content="The 'grid-column' with a negative value is invalid and inserts the grid-item in the first column." />
<script src="../../../../libs/jquery-1.9.1.min.js"></script>
<script src="../../../../grid-layout-polyfill.js"></script>
<style type="text/css">
#test
{
color: green;
display: -ms-grid;
display: -moz-grid;
display: -o-grid;
display: -webkit-grid;
display: grid;
font: 20px/1 ahem;
height: 3em;
-ms-grid-columns: auto 1fr;
-moz-grid-columns: auto 1fr;
-o-grid-columns: auto 1fr;
-webkit-grid-columns: auto 1fr;
grid-columns: auto 1fr;
-ms-grid-rows: auto 1fr;
-moz-grid-rows: auto 1fr;
-o-grid-rows: auto 1fr;
-webkit-grid-rows: auto 1fr;
grid-rows: auto 1fr;
}
#griditem
{
color: red;
-ms-grid-column: -1;
-moz-grid-column: -1;
-o-grid-column: -1;
-webkit-grid-column: -1;
grid-column: -1;
-ms-grid-row: 1;
-moz-grid-row: 1;
-o-grid-row: 1;
-webkit-grid-row: 1;
grid-row: 1;
}
</style>
</head>
<body>
<p>Test passes if there is no red visible on the page.</p>
<div id="test">
<div id="griditem">XXXX</div>
<div>XXXXX</div>
</div>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.clb.v20180317.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class CreateTopicRequest extends AbstractModel{
/**
* 日志主题的名字
*/
@SerializedName("TopicName")
@Expose
private String TopicName;
/**
* 主题分区 partition个数,不传参默认创建1个,最大创建允许10个,分裂/合并操作会改变分区数量,整体上限50个。
*/
@SerializedName("PartitionCount")
@Expose
private Long PartitionCount;
/**
* Get 日志主题的名字
* @return TopicName 日志主题的名字
*/
public String getTopicName() {
return this.TopicName;
}
/**
* Set 日志主题的名字
* @param TopicName 日志主题的名字
*/
public void setTopicName(String TopicName) {
this.TopicName = TopicName;
}
/**
* Get 主题分区 partition个数,不传参默认创建1个,最大创建允许10个,分裂/合并操作会改变分区数量,整体上限50个。
* @return PartitionCount 主题分区 partition个数,不传参默认创建1个,最大创建允许10个,分裂/合并操作会改变分区数量,整体上限50个。
*/
public Long getPartitionCount() {
return this.PartitionCount;
}
/**
* Set 主题分区 partition个数,不传参默认创建1个,最大创建允许10个,分裂/合并操作会改变分区数量,整体上限50个。
* @param PartitionCount 主题分区 partition个数,不传参默认创建1个,最大创建允许10个,分裂/合并操作会改变分区数量,整体上限50个。
*/
public void setPartitionCount(Long PartitionCount) {
this.PartitionCount = PartitionCount;
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "TopicName", this.TopicName);
this.setParamSimple(map, prefix + "PartitionCount", this.PartitionCount);
}
}
|
{
"pile_set_name": "Github"
}
|
/******************************************************************************
*
* Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* The full GNU General Public License is included in this distribution in the
* file called LICENSE.
*
* Contact Information:
* Intel Linux Wireless <linuxwifi@intel.com>
* Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*
*****************************************************************************/
#if !defined(__IWLWIFI_DEVICE_TRACE_MSG) || defined(TRACE_HEADER_MULTI_READ)
#define __IWLWIFI_DEVICE_TRACE_MSG
#include <linux/tracepoint.h>
#undef TRACE_SYSTEM
#define TRACE_SYSTEM iwlwifi_msg
#define MAX_MSG_LEN 110
DECLARE_EVENT_CLASS(iwlwifi_msg_event,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf),
TP_STRUCT__entry(
__dynamic_array(char, msg, MAX_MSG_LEN)
),
TP_fast_assign(
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
),
TP_printk("%s", __get_str(msg))
);
DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);
DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);
DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);
DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
TP_PROTO(struct va_format *vaf),
TP_ARGS(vaf)
);
TRACE_EVENT(iwlwifi_dbg,
TP_PROTO(u32 level, bool in_interrupt, const char *function,
struct va_format *vaf),
TP_ARGS(level, in_interrupt, function, vaf),
TP_STRUCT__entry(
__field(u32, level)
__field(u8, in_interrupt)
__string(function, function)
__dynamic_array(char, msg, MAX_MSG_LEN)
),
TP_fast_assign(
__entry->level = level;
__entry->in_interrupt = in_interrupt;
__assign_str(function, function);
WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
MAX_MSG_LEN, vaf->fmt,
*vaf->va) >= MAX_MSG_LEN);
),
TP_printk("%s", __get_str(msg))
);
#endif /* __IWLWIFI_DEVICE_TRACE_MSG */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE iwl-devtrace-msg
#include <trace/define_trace.h>
|
{
"pile_set_name": "Github"
}
|
class CreateCategoryNotifications < ActiveRecord::Migration
def change
create_table :category_notifications do |t|
t.integer :user_id, null: false
t.integer :category_id, null: false
t.text :from_email, null: false
t.text :from_name, null: false
t.text :template_name, null: false
t.text :locale, null: false
t.timestamp :sent_at
t.timestamps
end
end
end
|
{
"pile_set_name": "Github"
}
|
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Or,
*
* As this program is a library, any link to this program must follow
* GNU General Public License version 3 (GPLv3). If you cannot accept
* GPLv3, you need to be licensed from FMSoft.
*
* If you have got a commercial license of this program, please use it
* under the terms and conditions of the commercial license.
*
* For more information about the commercial license, please refer to
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
*/
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <sys/sem.h>
#include "define.h"
#include "xxvfbhdr.h"
#include "xxvfb_common.h"
#include "xxvfb_input.h"
XXVFBInfo xInfo;
static int displayid;
static int lockId = -1;
static char* data; //shell memory address
static int my_connect(int sockfd, struct sockaddr *address, int len)
{
return connect(sockfd, address, len);
}
static Display* InitXDisplay(Display* display, int* screen, unsigned int* dis_width, unsigned int* dis_height)
{
// 和X 服务器连接
if ((display=XOpenDisplay(NULL)) == NULL )
{
printf("Cannot connect to X server %s\n",XDisplayName(NULL));
exit(-1);
}
//获得缺省的 screen_num
*screen = DefaultScreen(display);
//获得屏幕的宽度和高度
*dis_width = DisplayWidth(display, *screen);
*dis_height = DisplayHeight(display, *screen);
return display;
}
static void initLock()
{
lockId = semget( displayid, 0, 0 );
}
static void lock()
{
if ( lockId == -1 )
initLock();
{
struct sembuf sops;
sops.sem_num = 0;
sops.sem_op = -1;
sops.sem_flg = SEM_UNDO;
semop(lockId,&sops,1);
}
}
static void unlock()
{
if ( lockId >= 0 ) {
struct sembuf sops;
sops.sem_num = 0;
sops.sem_op = +1;
sops.sem_flg = SEM_UNDO;
semop(lockId,&sops,1);
}
}
static void DrawDirtyRect()
{
int width, height, length;
char* mem_data;
char* fb_data;
int bpp = (xInfo.xhdr->depth+7)/8;
if(!xInfo.xhdr->dirty) return;
lock();
if(xInfo.xhdr->dirty_rc_l < 0)
xInfo.xhdr->dirty_rc_l = 0;
if(xInfo.xhdr->dirty_rc_t < 0)
xInfo.xhdr->dirty_rc_t = 0;
if(xInfo.xhdr->dirty_rc_r > xInfo.xhdr->width)
xInfo.xhdr->dirty_rc_r = xInfo.xhdr->width;
if(xInfo.xhdr->dirty_rc_b > xInfo.xhdr->height)
xInfo.xhdr->dirty_rc_b = xInfo.xhdr->height;
width = xInfo.xhdr->dirty_rc_r - xInfo.xhdr->dirty_rc_l;
height = xInfo.xhdr->dirty_rc_b - xInfo.xhdr->dirty_rc_t;
length = bpp * width * height;
fb_data = data + xInfo.xhdr->fb_offset
+ xInfo.xhdr->pitch * xInfo.xhdr->dirty_rc_t
+ bpp * xInfo.xhdr->dirty_rc_l;
mem_data = (char*)calloc(1, length);
memcpy(mem_data,fb_data,length);
DrawImage(xInfo.xhdr->dirty_rc_l,xInfo.xhdr->dirty_rc_t,width,height,mem_data);
xInfo.xhdr->dirty = 0;
unlock();
}
static void MarkDrawAll()
{
lock();
xInfo.xhdr->dirty = True;
xInfo.xhdr->dirty_rc_l = xInfo.xhdr->dirty_rc_t = 0;
xInfo.xhdr->dirty_rc_r = xInfo.xhdr->width;
xInfo.xhdr->dirty_rc_b = xInfo.xhdr->height;
unlock();
}
static void EventProc(Display* display, Window win, GC gc, XEvent report)
{
Colormap colormap;
switch (report.type) {
//曝光事件, 窗口应重绘
case Expose:
MarkDrawAll();
break;
//窗口尺寸改变, 重新取得窗口的宽度和高度
case ConfigureNotify:
xInfo.xhdr->width = report.xconfigure.width;
xInfo.xhdr->height = report.xconfigure.height;
break;
case ButtonPress:
case ButtonRelease:
{
fprintf(stderr,"button release \n");
int x = report.xbutton.x ;
int y = report.xbutton.y ;
SendMouseData(x, y,(int)report.xbutton.button);
}
break;
case MotionNotify:
{
int x = report.xmotion.x;
int y = report.xmotion.y;
SendMouseData(x, y, (int)report.xbutton.button);
}
break;
case KeyPress:
{
int keycode = report.xkey.keycode;
int unicode = report.xkey.keycode;
setPressedKey(keycode,unicode);
if (isAlpha(keycode))
{
sendKeyboardData(unicode, keycode,
0,//e->state()&(ShiftButton|ControlButton|AltButton),
True, False);
}
else
{
sendKeyboardData(unicode, keycode,
0,//e->state()&(ShiftButton|ControlButton|AltButton),
True, False);
sendKeyboardData(unicode, keycode,
0,//e->state()&(ShiftButton|ControlButton|AltButton),
False, False);
}
}
break;
case KeyRelease:
{
int keycode = report.xkey.keycode;
int unicode = report.xkey.keycode;
if(!clearPressedKey(keycode))
{
return ;
}
if (isAlpha(keycode))
{
sendKeyboardData(unicode, keycode,
0,//e->state()&(ShiftButton|ControlButton|AltButton),
False, False);
}
}
break;
case DestroyNotify:
{
unsigned int type = XXVFB_CLOSE_TYPE;
write(xInfo.sockfd, &type, sizeof(type));
}
break;
default:
break;
}
}
int MainWndLoop(int ppid, int wnd_width, int wnd_height, int depth, char* caption)
{
Display *display;
int screen_num;
Window win;
XEvent report;
GC gc;
unsigned long valuemask = 0;
XGCValues values;
XSizeHints *sz;
XSetWindowAttributes attr;
Colormap colormap;
unsigned int width, height; //窗口尺寸
unsigned int display_width, display_height;//屏幕尺寸
unsigned int border_width = BORDER_WIDTH;
int dev_depth;
int shmId;
int withalpha = 0;
int nr_entry = 0;
XXVFBHeader *hdr;
int sockfd;
displayid = ppid;
if(depth <= 8)
nr_entry = 1 << depth;
display = InitXDisplay(display,&screen_num,&display_width,&display_height);
dev_depth = XDefaultDepth(display,screen_num);
//创建窗口
attr.background_pixel = WhitePixel(display,screen_num);
win = XCreateWindow(display, //display
RootWindow(display,screen_num), //父窗口
0, 0, wnd_width, wnd_height, //位置和大小
border_width, //边界宽度
dev_depth,
InputOutput,
DefaultVisual(display, DefaultScreen(display)),
CWBackPixel, &attr);
//设置窗口大小位置
XStoreName(display, win, caption);
sz = XAllocSizeHints();
sz->x = 0;
sz->y = 0;
sz->width = wnd_width;
sz->height = wnd_height;
sz->flags = USPosition | USSize;
XSetNormalHints(display, win, sz);
//建立GC
gc = XCreateGC(display, win, valuemask, &values);
//显示窗口
XMapWindow(display, win);
//调整colormap
colormap = DefaultColormap(display, screen_num);
//选择窗口感兴趣的事件掩码
XSelectInput(display, win,
ExposureMask | KeyPressMask | KeyReleaseMask |
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
PointerMotionMask | StructureNotifyMask);
//记录数据交互
memset(&xInfo,sizeof(xInfo),0);
xInfo.display = display;
xInfo.win = win;
xInfo.gc = gc;
xInfo.visual = DefaultVisual(display, screen_num);
xInfo.colormap = colormap;
{
key_t key = ppid;
int bpl;
int dataSize;
if ( depth == 1 )
bpl = (wnd_width*depth+7)/8;
else
bpl = ((wnd_width*depth+31)/32)*4;
dataSize = bpl * wnd_height + sizeof(XXVFBHeader) + nr_entry * sizeof(XXVFBPalEntry);
shmId = shmget( key, dataSize, IPC_CREAT|0666);
if ( shmId != -1 )
data = (unsigned char *)shmat( shmId, 0, 0 );
else {
struct shmid_ds shm;
shmctl( shmId, IPC_RMID, &shm );
shmId = shmget( key, dataSize, IPC_CREAT|0666);
data = (unsigned char *)shmat( shmId, 0, 0 );
}
if ( (int)data == -1 )
{
fprintf(stderr, "Cannot attach to shared memory" );
return;
}
hdr = (XXVFBHeader *)data;
hdr->width = wnd_width;
hdr->height = wnd_height;
hdr->depth = depth;
hdr->pitch = bpl;
hdr->fb_offset = sizeof(XXVFBHeader);
hdr->palette_changed = 0;
hdr->palette_offset = sizeof(XXVFBHeader);
hdr->fb_offset = sizeof(XXVFBHeader) + nr_entry * sizeof(XXVFBPalEntry);
hdr->dirty = 0;
hdr->dirty_rc_l = 0;
hdr->dirty_rc_t = 0;
hdr->dirty_rc_r = 0;
hdr->dirty_rc_b = 0;
hdr->MSBLeft = 0;
switch(depth)
{
#if 0
case 2:
hdr->MSBLeft = 1;
break;
case 1:
case 4:
case 8:
hdr->MSBLeft = 0;
break;
#endif
case 16:
if (withalpha) {
hdr->Amask = 0x8000;
hdr->Rmask = 0x7C00;
hdr->Gmask = 0x03E0;
hdr->Bmask = 0x001F;
}
else {
hdr->Amask = 0x0000;
hdr->Rmask = 0xF800;
hdr->Gmask = 0x07E0;
hdr->Bmask = 0x001F;
}
break;
case 24:
case 32:
if (withalpha) {
hdr->Amask = 0xFF000000;
hdr->Rmask = 0x00FF0000;
hdr->Gmask = 0x0000FF00;
hdr->Bmask = 0x000000FF;
}
else {
hdr->Amask = 0x00000000;
hdr->Rmask = 0x00FF0000;
hdr->Gmask = 0x0000FF00;
hdr->Bmask = 0x000000FF;
}
break;
default:
break;
}
}
{
int len;
int result;
char socket_file[50];
struct sockaddr_un address;
sprintf(socket_file, "/tmp/pcxvfb_socket%d", ppid);
socket_file[49] = '\0';
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
address.sun_family = AF_UNIX;
strcpy(address.sun_path, socket_file);
len = sizeof(address);
result = my_connect(sockfd, (struct sockaddr *)&address, len);
if (result == -1) {
perror("oops:client1 ");
exit(1);
}
write(sockfd, &shmId, sizeof(int));
}
//把hdr地址添加到xInfo保存
xInfo.xhdr = hdr;
xInfo.dev_depth = dev_depth;
xInfo.sockfd = sockfd;
//初始化键盘映射
init_code_map ();
while(1)
{
if(XPending(display))
{
XNextEvent(display,&report);
EventProc(display,win,gc,report);
}
else
{
DrawDirtyRect();
}
}
XCloseDisplay(display);
}
|
{
"pile_set_name": "Github"
}
|
/**
* This file is copyright 2017 State of the Netherlands (Ministry of Interior Affairs and Kingdom Relations).
* It is made available under the terms of the GNU Affero General Public License, version 3 as published by the Free Software Foundation.
* The project of which this file is part, may be found at https://github.com/MinBZK/operatieBRP.
*/
package nl.bzk.brp.model.data.kern;
import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;
@RooJavaBean
@RooToString
@RooJpaActiveRecord(versionField = "", table = "bron", schema = "kern")
@RooDbManaged(automaticallyDelete = true)
public class Bron {
}
|
{
"pile_set_name": "Github"
}
|
# [PhantomJS](http://phantomjs.org) - Scriptable Headless WebKit
PhantomJS ([www.phantomjs.org](http://phantomjs.org)) is a headless WebKit scriptable with JavaScript or CoffeeScript. It is used by hundreds of [developers](https://github.com/ariya/phantomjs/wiki/Buzz) and dozens of [organizations](https://github.com/ariya/phantomjs/wiki/Users) for web-related development workflow.
The latest [stable release](http://phantomjs.org/release-1.9.html) is version 1.9 (codenamed <a href="http://phantomjs.org/release-names.html">"Sakura"</a>). Follow the official Twitter stream [@PhantomJS](http://twitter.com/PhantomJS) to get the frequent development updates.
**Note**: Please **do not** create a GitHub pull request **without** reading the [Contribution Guide](https://github.com/ariya/phantomjs/blob/master/CONTRIBUTING.md) first. Failure to do so may result in the rejection of the pull request.
## Use Cases
- **Headless web testing**. Lightning-fast testing without the browser is now possible! Various [test frameworks](https://github.com/ariya/phantomjs/wiki/Headless-Testing) such as Jasmine, Capybara, QUnit, Mocha, WebDriver, YUI Test, BusterJS, FuncUnit, Robot Framework, and many others are supported.
- **Page automation**. [Access and manipulate](https://github.com/ariya/phantomjs/wiki/Page-Automation) web pages with the standard DOM API, or with usual libraries like jQuery.
- **Screen capture**. Programmatically [capture web contents](https://github.com/ariya/phantomjs/wiki/Screen-Capture), including CSs, SVG and Canvas. Build server-side web graphics apps, from a screenshot service to a vector chart rasterizer.
- **Network monitoring**. Automate performance analysis, track [page loading](https://github.com/ariya/phantomjs/wiki/Network-Monitoring) and export as standard HAR format.
## Features
- **Multiplatform**, available on major operating systems: Windows, Mac OS X, Linux, other Unices.
- **Fast and native implementation** of web standards: DOM, CSS, JavaScript, Canvas, SVG. No emulation!
- **Pure headless (no X11) on Linux**, ideal for continuous integration systems. Also runs on Amazon EC2, Heroku, Iron.io.
- **Easy to install**: [Download](http://phantomjs.org/download.html), unpack, and start having fun in just 5 minutes.
## Ecosystem
PhantomJS needs not be used only as a stand-alone tool. Check also some excellent related projects:
- [CasperJS](http://casperjs.org) enables easy navigation scripting and common high-level testing.
- [Poltergeist](https://github.com/jonleighton/poltergeist) allows running Capybara tests headlessly.
- [Guard::Jasmine](https://github.com/netzpirat/guard-jasmine) automatically tests Jasmine specs on Rails when files are modified.
- [GhostDriver](http://github.com/detro/ghostdriver/) complements Selenium tests with a PhantomJS WebDriver implementation.
- [PhantomRobot](https://github.com/datakurre/phantomrobot) runs Robot Framework acceptance tests in the background via PhantomJS.
- [Mocha-PhantomJS](https://github.com/metaskills/mocha-phantomjs) run Mocha tests using PhantomJS.
and many others [related projects](https://github.com/ariya/phantomjs/wiki/Related-Projects).
## Questions?
- Explore the complete [documentation](https://github.com/ariya/phantomjs/wiki)
- Read tons of [user articles](https://github.com/ariya/phantomjs/wiki/Buzz) on using PhantomJS.
- Join the [mailing-list](http://groups.google.com/group/phantomjs) and discuss with other PhantomJS fans.
PhantomJS is free software/open source, and is distributed under the [BSD license](http://opensource.org/licenses/BSD-3-Clause). It contains third-party code, see the included `third-party.txt` file for the license information on third-party code.
PhantomJS is created and maintained by [Ariya Hidayat](http://ariya.ofilabs.com/about) (Twitter: [@ariyahidayat](http://twitter.com/ariyahidayat)), with the help of [many contributors](https://github.com/ariya/phantomjs/contributors).
|
{
"pile_set_name": "Github"
}
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Platform keyring for firmware/platform keys
*
* Copyright IBM Corporation, 2018
* Author(s): Nayna Jain <nayna@linux.ibm.com>
*/
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/cred.h>
#include <linux/err.h>
#include <linux/slab.h>
#include "../integrity.h"
/**
* add_to_platform_keyring - Add to platform keyring without validation.
* @source: Source of key
* @data: The blob holding the key
* @len: The length of the data blob
*
* Add a key to the platform keyring without checking its trust chain. This
* is available only during kernel initialisation.
*/
void __init add_to_platform_keyring(const char *source, const void *data,
size_t len)
{
key_perm_t perm;
int rc;
perm = (KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW;
rc = integrity_load_cert(INTEGRITY_KEYRING_PLATFORM, source, data, len,
perm);
if (rc)
pr_info("Error adding keys to platform keyring %s\n", source);
}
/*
* Create the trusted keyrings.
*/
static __init int platform_keyring_init(void)
{
int rc;
rc = integrity_init_keyring(INTEGRITY_KEYRING_PLATFORM);
if (rc)
return rc;
pr_notice("Platform Keyring initialized\n");
return 0;
}
/*
* Must be initialised before we try and load the keys into the keyring.
*/
device_initcall(platform_keyring_init);
|
{
"pile_set_name": "Github"
}
|
tests/complex/netconvert/left_turn_noblocking_longveh/runner.py
|
{
"pile_set_name": "Github"
}
|
<component name="libraryTable">
<library name="imagepipeline-1.0.1">
<CLASSES>
<root url="file://$USER_HOME$/.android/build-cache/60f1a5f515e677243597b382d4ec69fca7476766/output/res" />
<root url="jar://$USER_HOME$/.android/build-cache/60f1a5f515e677243597b382d4ec69fca7476766/output/jars/classes.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.facebook.fresco/imagepipeline/1.0.1/6b7938b9810e73be111101ee184e01b2a4ec59c5/imagepipeline-1.0.1-sources.jar!/" />
</SOURCES>
</library>
</component>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2013, OpenCloudDB/MyCAT and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software;Designed and Developed mainly by many Chinese
* opensource volunteers. you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 2 only, as published by the
* Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Any questions about this component can be directed to it's project Web address
* https://code.google.com/p/opencloudb/.
*
*/
package io.mycat.util;
import java.nio.charset.Charset;
import java.util.Date;
public class ByteUtil {
/**
* compare to number or dicamal ascii byte array, for number :123456 ,store
* to array [1,2,3,4,5,6]
*
* @param b1
* @param b2
* @return -1 means b1 < b2, or 0 means b1=b2 else return 1
*/
public static int compareNumberByte(byte[] b1, byte[] b2) {
if(b1 == null || b1.length == 0) {
return -1;
}
else if(b2 == null || b2.length == 0) {
return 1;
}
boolean isNegetive = b1[0] == 45 || b2[0] == 45;
if (isNegetive == false && b1.length != b2.length) {
return b1.length - b2.length;
}
int len = b1.length > b2.length ? b2.length : b1.length;
int result = 0;
int index = -1;
for (int i = 0; i < len; i++) {
int b1val = b1[i];
int b2val = b2[i];
if (b1val > b2val) {
result = 1;
index = i;
break;
} else if (b1val < b2val) {
index = i;
result = -1;
break;
}
}
if (index == 0) {
// first byte compare
return result;
} else {
if( b1.length != b2.length ) {
int lenDelta = b1.length - b2.length;
return isNegetive ? 0 - lenDelta : lenDelta;
} else {
return isNegetive ? 0 - result : result;
}
}
}
public static byte[] compareNumberArray2(byte[] b1, byte[] b2, int order) {
if (b1.length <= 0 && b2.length > 0) {
return b2;
}
if (b1.length > 0 && b2.length <= 0) {
return b1;
}
int len = b1.length > b2.length ? b1.length : b2.length;
for (int i = 0; i < len; i++) {
if (b1[i] != b2[i]) {
if (order == 1) {
return ((b1[i] & 0xff) - (b2[i] & 0xff)) > 0 ? b1 : b2;
} else {
return ((b1[i] & 0xff) - (b2[i] & 0xff)) > 0 ? b2 : b1;
}
}
}
return b1;
}
public static byte[] getBytes(short data) {
byte[] bytes = new byte[2];
bytes[0] = (byte) (data & 0xff);
bytes[1] = (byte) ((data & 0xff00) >> 8);
return bytes;
}
public static byte[] getBytes(char data) {
byte[] bytes = new byte[2];
bytes[0] = (byte) (data);
bytes[1] = (byte) (data >> 8);
return bytes;
}
public static byte[] getBytes(int data) {
byte[] bytes = new byte[4];
bytes[0] = (byte) (data & 0xff);
bytes[1] = (byte) ((data & 0xff00) >> 8);
bytes[2] = (byte) ((data & 0xff0000) >> 16);
bytes[3] = (byte) ((data & 0xff000000) >> 24);
return bytes;
}
public static byte[] getBytes(long data) {
byte[] bytes = new byte[8];
bytes[0] = (byte) (data & 0xff);
bytes[1] = (byte) ((data >> 8) & 0xff);
bytes[2] = (byte) ((data >> 16) & 0xff);
bytes[3] = (byte) ((data >> 24) & 0xff);
bytes[4] = (byte) ((data >> 32) & 0xff);
bytes[5] = (byte) ((data >> 40) & 0xff);
bytes[6] = (byte) ((data >> 48) & 0xff);
bytes[7] = (byte) ((data >> 56) & 0xff);
return bytes;
}
public static byte[] getBytes(float data) {
int intBits = Float.floatToIntBits(data);
return getBytes(intBits);
}
public static byte[] getBytes(double data) {
long intBits = Double.doubleToLongBits(data);
return getBytes(intBits);
}
public static byte[] getBytes(String data, String charsetName) {
Charset charset = Charset.forName(charsetName);
return data.getBytes(charset);
}
public static byte[] getBytes(String data) {
return getBytes(data, "GBK");
}
public static short getShort(byte[] bytes) {
return Short.parseShort(new String(bytes));
// return (short) ((0xff & bytes[0]) | (0xff00 & (bytes[1] << 8)));
}
public static char getChar(byte[] bytes) {
return (char) ((0xff & bytes[0]) | (0xff00 & (bytes[1] << 8)));
}
public static int getInt(byte[] bytes) {
return Integer.parseInt(new String(bytes));
// return (0xff & bytes[0]) | (0xff00 & (bytes[1] << 8)) | (0xff0000 &
// (bytes[2] << 16)) | (0xff000000 & (bytes[3] << 24));
}
public static long getLong(byte[] bytes) {
return Long.parseLong(new String(bytes));
// return(0xffL & (long)bytes[0]) | (0xff00L & ((long)bytes[1] << 8)) |
// (0xff0000L & ((long)bytes[2] << 16)) | (0xff000000L & ((long)bytes[3]
// << 24))
// | (0xff00000000L & ((long)bytes[4] << 32)) | (0xff0000000000L &
// ((long)bytes[5] << 40)) | (0xff000000000000L & ((long)bytes[6] <<
// 48)) | (0xff00000000000000L & ((long)bytes[7] << 56));
}
public static double getDouble(byte[] bytes) {
return Double.parseDouble(new String(bytes));
}
public static float getFloat(byte[] bytes) {
return Float.parseFloat(new String(bytes));
}
public static String getString(byte[] bytes, String charsetName) {
return new String(bytes, Charset.forName(charsetName));
}
public static String getString(byte[] bytes) {
return getString(bytes, "UTF-8");
}
public static String getDate(byte[] bytes) {
return new String(bytes);
}
public static String getTime(byte[] bytes) {
return new String(bytes);
}
public static String getTimestmap(byte[] bytes) {
return new String(bytes);
}
public static byte[] getBytes(Date date, boolean isTime) {
if(isTime) {
return getBytesFromTime(date);
} else {
return getBytesFromDate(date);
}
}
private static byte[] getBytesFromTime(Date date) {
int day = 0;
int hour = DateUtil.getHour(date);
int minute = DateUtil.getMinute(date);
int second = DateUtil.getSecond(date);
int microSecond = DateUtil.getMicroSecond(date);
byte[] bytes = null;
byte[] tmp = null;
if(day == 0 && hour == 0 && minute == 0
&& second == 0 && microSecond == 0) {
bytes = new byte[1];
bytes[0] = (byte) 0;
} else if(microSecond == 0) {
bytes = new byte[1 + 8];
bytes[0] = (byte) 8;
bytes[1] = (byte) 0; // is_negative (1) -- (1 if minus, 0 for plus)
tmp = getBytes(day);
bytes[2] = tmp[0];
bytes[3] = tmp[1];
bytes[4] = tmp[2];
bytes[5] = tmp[3];
bytes[6] = (byte) hour;
bytes[7] = (byte) minute;
bytes[8] = (byte) second;
} else {
bytes = new byte[1 + 12];
bytes[0] = (byte) 12;
bytes[1] = (byte) 0; // is_negative (1) -- (1 if minus, 0 for plus)
tmp = getBytes(day);
bytes[2] = tmp[0];
bytes[3] = tmp[1];
bytes[4] = tmp[2];
bytes[5] = tmp[3];
bytes[6] = (byte) hour;
bytes[7] = (byte) minute;
bytes[8] = (byte) second;
tmp = getBytes(microSecond);
bytes[9] = tmp[0];
bytes[10] = tmp[1];
bytes[11] = tmp[2];
bytes[12] = tmp[3];
}
return bytes;
}
private static byte[] getBytesFromDate(Date date) {
int year = DateUtil.getYear(date);
int month = DateUtil.getMonth(date);
int day = DateUtil.getDay(date);
int hour = DateUtil.getHour(date);
int minute = DateUtil.getMinute(date);
int second = DateUtil.getSecond(date);
int microSecond = DateUtil.getMicroSecond(date);
byte[] bytes = null;
byte[] tmp = null;
if(year == 0 && month == 0 && day == 0
&& hour == 0 && minute == 0 && second == 0
&& microSecond == 0) {
bytes = new byte[1];
bytes[0] = (byte) 0;
} else if(hour == 0 && minute == 0 && second == 0
&& microSecond == 0) {
bytes = new byte[1 + 4];
bytes[0] = (byte) 4;
tmp = getBytes((short) year);
bytes[1] = tmp[0];
bytes[2] = tmp[1];
bytes[3] = (byte) month;
bytes[4] = (byte) day;
} else if(microSecond == 0) {
bytes = new byte[1 + 7];
bytes[0] = (byte) 7;
tmp = getBytes((short) year);
bytes[1] = tmp[0];
bytes[2] = tmp[1];
bytes[3] = (byte) month;
bytes[4] = (byte) day;
bytes[5] = (byte) hour;
bytes[6] = (byte) minute;
bytes[7] = (byte) second;
} else {
bytes = new byte[1 + 11];
bytes[0] = (byte) 11;
tmp = getBytes((short) year);
bytes[1] = tmp[0];
bytes[2] = tmp[1];
bytes[3] = (byte) month;
bytes[4] = (byte) day;
bytes[5] = (byte) hour;
bytes[6] = (byte) minute;
bytes[7] = (byte) second;
tmp = getBytes(microSecond);
bytes[8] = tmp[0];
bytes[9] = tmp[1];
bytes[10] = tmp[2];
bytes[11] = tmp[3];
}
return bytes;
}
// 支持 byte dump
//---------------------------------------------------------------------
public static String dump(byte[] data, int offset, int length) {
StringBuilder sb = new StringBuilder();
sb.append(" byte dump log ");
sb.append(System.lineSeparator());
sb.append(" offset ").append( offset );
sb.append(" length ").append( length );
sb.append(System.lineSeparator());
int lines = (length - 1) / 16 + 1;
for (int i = 0, pos = 0; i < lines; i++, pos += 16) {
sb.append(String.format("0x%04X ", i * 16));
for (int j = 0, pos1 = pos; j < 16; j++, pos1++) {
sb.append(pos1 < length ? String.format("%02X ", data[offset + pos1]) : " ");
}
sb.append(" ");
for (int j = 0, pos1 = pos; j < 16; j++, pos1++) {
sb.append(pos1 < length ? print(data[offset + pos1]) : '.');
}
sb.append(System.lineSeparator());
}
sb.append(length).append(" bytes").append(System.lineSeparator());
return sb.toString();
}
public static char print(byte b) {
return (b < 32 || b > 127) ? '.' : (char) b;
}
/*
* 返回小数点的位置
* @return 找不到 ,其他都是小数点的位置
* */
public static int getDot(byte[] array) {
for(int s = 0; s < array.length; s++){
if(array[s] == 46) {
return s;
}
}
return array.length;
}
/*
* @return 返回是否是科学计数法
* */
public static boolean hasE(byte[] array) {
for(int s = 0; s < array.length; s++){
if(array[s] == 'E' || array[s] == 'e') {
return true;
}
}
return false;
}
/*
* @比較 對於b1取0 到b1End進行比較
* 對於b2取0 到b2End進行比較
* */
public static int compareNumberByte(byte[] b1, int b1End, byte[] b2, int b2End) {
if(b1 == null || b1.length == 0) {
return -1;
}
else if(b2 == null || b2.length == 0) {
return 1;
}
boolean isNegetive = b1[0] == 45 || b2[0] == 45; // 45 表示负数符号
//正数 长度不等 直接返回 长度 //都是正数长度不等,直接返回长度的比较
if (isNegetive == false && b1End != b2End) {
return b1End - b2End;
}
//取短的一个
int len = b1End > b2End ? b2End : b1End;
int result = 0;
int index = -1;
for (int i = 0; i < len; i++) {
int b1val = b1[i];
int b2val = b2[i];
if (b1val > b2val) {
result = 1;
index = i;
break;
} else if (b1val < b2val) {
index = i;
result = -1;
break;
}
}
if (index == 0) {
//正负数直接符号比较
// first byte compare ,数值与符号的比较 一正 一负数
return result;
} else {
if( b1End != b2End ) {
//都是正数 长度不等, 都是负数 长度不等
int lenDelta = b1End - b2End;
return isNegetive ? 0 - lenDelta : lenDelta;
} else {
//长度相等 符号相同
//位数相同 直接取比较结果的 正数就是结果,否则就是比较结果取反
return isNegetive ? 0 - result : result;
}
}
}
/*
* double類型的b1 b2進行比較
* 首先:判斷是否是科學計數法 是直接創建Double對象進行比較
* 否則利用byte進行比較
* 先判斷整數位 再判斷小數位
* */
public static int compareDouble(byte[] b1, byte[] b2) {
if(b1 == null || b1.length == 0) {
return -1;
}
else if(b2 == null || b2.length == 0) {
return 1;
}
boolean isHasE = hasE(b1) || hasE(b2);
if(isHasE){
return Double.valueOf(new String(b1)).compareTo( Double.valueOf(new String(b2))) ;
}
int d1 = getDot(b1);
int d2 = getDot(b2);
//判斷整數位
int result = compareNumberByte(b1, d1, b2, d2);
//符号相等
if(result == 0){
//判斷小數位
boolean isNegetive = b1[0] == 45 || b2[0] == 45; // 45 表示负数符号
int xsLen1 = b1.length - d1;
int xsLen2 = b2.length - d2;
int len = xsLen1 > xsLen2 ? xsLen2 : xsLen1; //小数位数中的 小数
int temp = 0;
for(int i = 0; i < len ; i++) {
temp = b1[i + d1] - b2 [i+ d2];
if(temp != 0){
break;
}
}
if(temp == 0){
//0.12 0.123 或者 -0.12 -0.123
int lenDelta = xsLen1 - xsLen2;
result = isNegetive? 0 - lenDelta : lenDelta;
} else{
//0.12 0.113 或者 -0.12 -0.113
result = isNegetive? 0 - temp : temp;
}
}
return result;
}
}
|
{
"pile_set_name": "Github"
}
|
# CAVS 17.1
# Config Info for : "aesniavx+ssse3sha-64"
# TDES Monte Carlo (Modes) Test for OFB
# State : Encrypt and Decrypt
# Mon Aug 18 09:21:18 AM
[ENCRYPT]
NumKeys = 1
KEY1 = 1310e698cd83e001
KEY2 = 1310e698cd83e001
KEY3 = 1310e698cd83e001
IV = 7837b77338efe61d
PLAINTEXT = 73c63851a9e9c02c
[DECRYPT]
NumKeys = 1
KEY1 = 949d1c0294ce3bdc
KEY2 = 949d1c0294ce3bdc
KEY3 = 949d1c0294ce3bdc
IV = 8affd755b5393365
CIPHERTEXT = 64f14ca9f4db0267
|
{
"pile_set_name": "Github"
}
|
**Are you the copyright owner or authorized to act on the copyright owner’s behalf?**
Authorized Representative
**Please provide a detailed description of the original copyrighted work that has allegedly been infringed. If possible, include a URL to where it is posted online.**
Humana.com and the underlying code that helps run the site and its internal structures.
**What files should be taken down? Please provide URLs for each file, or if the entire repository, the repository’s URL:**
https://github.com/Zabed7/Humana_MavenProject
**Have you searched for any forks of the allegedly infringing files or repositories? Each fork is a distinct repository and must be identified separately if you believe it is infringing and wish to have it taken down.**
Yes, this entire repository appears to be related to the Humana Maven Project and is housing internal code and structures for the website.
**Is the work licensed under an open source license? If so, which open source license? Are the allegedly infringing files being used under the open source license, or are they in violation of the license?**
Violations of the license.
**What would be the best solution for the alleged infringement? Are there specific changes the other person can make other than removal? Can the repository be made private?**
Please remove this repository.
**Do you have the alleged infringer’s contact information? If so, please provide it:**
https://github.com/Zabed7
**Type (or copy and paste) the following statement: "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."**
"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."
**Type (or copy and paste) the following statement: "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."**
"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."
**Please confirm that you have you have read our Guide to Submitting a DMCA Takedown Notice: https://help.github.com/articles/guide-to-submitting-a-dmca-takedown-notice/**
I confirm I have read them.
**So that we can get back to you, please provide either your telephone number or physical address:**
[private]
**Please type your full legal name below to sign this request:**
[private]
|
{
"pile_set_name": "Github"
}
|
Git è un "sistema di controllo versione" utilizzato da molti programmatori. Questo software può tracciare le modifiche ai file nel corso del tempo, così da poter ripristinare successivamente una specifica versione. Un po' come la funzione "revisioni" nei programmi di elaborazione di testi (come Microsoft Word o LibreOffice), ma molto più potente.
## Installare Git
<!--sec data-title="Installing Git: Windows" data-id="git_install_windows"
data-collapse=true ces-->
È possibile scaricare Git da [git-scm.com](https://git-scm.com/). Puoi saltare tutti i passaggi tranne due: nel passaggio dove ti chiede di scegliere l'editor, dovrai selezionare Nano, e nel passaggio "Regolazione della variabile di ambiente PATH", seleziona "Esegui Git e gli strumenti Unix opzionali dal prompt dei comandi di Windows" (l'opzione in basso). A parte questo, i valori predefiniti vanno bene. 'Checkout Windows-style' e 'commit Unix-style line endings' vanno bene.
Non dimenticare di riavviare il prompt dei comandi o la powershell dopo che l'installazione è terminata con successo. <!--endsec-->
<!--sec data-title="Installing Git: OS X" data-id="git_install_OSX"
data-collapse=true ces-->
Scarica Git da [git-scm.com](https://git-scm.com/) e segui le istruzioni.
> **Nota** Se stai usando OS X 10.6, 10.7 o 10.8, dovrai installare la versione di Git da qui: [Git installer for OS X Snow Leopard](https://sourceforge.net/projects/git-osx-installer/files/git-2.3.5-intel-universal-snow-leopard.dmg/download)
<!--endsec-->
<!--sec data-title="Installing Git: Debian or Ubuntu" data-id="git_install_debian_ubuntu"
data-collapse=true ces-->
{% filename %}command-line{% endfilename %}
```bash
$ sudo apt install git
```
<!--endsec-->
<!--sec data-title="Installing Git: Fedora" data-id="git_install_fedora"
data-collapse=true ces-->
{% filename %}command-line{% endfilename %}
```bash
$ sudo dnf install git
```
<!--endsec-->
<!--sec data-title="Installing Git: openSUSE" data-id="git_install_openSUSE"
data-collapse=true ces-->
{% filename %}command-line{% endfilename %}
```bash
$ sudo zypper install git
```
<!--endsec-->
|
{
"pile_set_name": "Github"
}
|
#ifndef AMGCL_RELAXATION_ILUK_HPP
#define AMGCL_RELAXATION_ILUK_HPP
/*
The MIT License
Copyright (c) 2012-2019 Denis Demidov <dennis.demidov@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* \file amgcl/relaxation/iluk.hpp
* \author Denis Demidov <dennis.demidov@gmail.com>
* \brief Incomplete LU with fill-in level.
*/
#include <vector>
#include <deque>
#include <queue>
#include <cmath>
#include <amgcl/backend/builtin.hpp>
#include <amgcl/util.hpp>
#include <amgcl/relaxation/detail/ilu_solve.hpp>
namespace amgcl {
namespace relaxation {
/// ILU(k) smoother.
template <class Backend>
struct iluk {
typedef typename Backend::value_type value_type;
typedef typename Backend::matrix matrix;
typedef typename Backend::matrix_diagonal matrix_diagonal;
typedef typename Backend::vector vector;
typedef typename math::scalar_of<value_type>::type scalar_type;
typedef detail::ilu_solve<Backend> ilu_solve;
/// Relaxation parameters.
struct params {
/// Level of fill-in.
int k;
/// Damping factor.
scalar_type damping;
/// Parameters for sparse triangular system solver
typename ilu_solve::params solve;
params() : k(1), damping(1) {}
#ifndef AMGCL_NO_BOOST
params(const boost::property_tree::ptree &p)
: AMGCL_PARAMS_IMPORT_VALUE(p, k)
, AMGCL_PARAMS_IMPORT_VALUE(p, damping)
, AMGCL_PARAMS_IMPORT_CHILD(p, solve)
{
check_params(p, {"k", "damping", "solve"});
}
void get(boost::property_tree::ptree &p, const std::string &path) const {
AMGCL_PARAMS_EXPORT_VALUE(p, path, k);
AMGCL_PARAMS_EXPORT_VALUE(p, path, damping);
AMGCL_PARAMS_EXPORT_CHILD(p, path, solve);
}
#endif
} prm;
/// \copydoc amgcl::relaxation::damped_jacobi::damped_jacobi
template <class Matrix>
iluk( const Matrix &A, const params &prm, const typename Backend::params &bprm)
: prm(prm)
{
typedef typename backend::builtin<value_type>::matrix build_matrix;
const size_t n = backend::rows(A);
size_t Anz = backend::nonzeros(A);
std::vector<ptrdiff_t> Lptr; Lptr.reserve(n+1); Lptr.push_back(0);
std::vector<ptrdiff_t> Lcol; Lcol.reserve(Anz / 3);
std::vector<value_type> Lval; Lval.reserve(Anz / 3);
std::vector<ptrdiff_t> Uptr; Uptr.reserve(n+1); Uptr.push_back(0);
std::vector<ptrdiff_t> Ucol; Ucol.reserve(Anz / 3);
std::vector<value_type> Uval; Uval.reserve(Anz / 3);
std::vector<int> Ulev; Ulev.reserve(Anz / 3);
auto D = std::make_shared<backend::numa_vector<value_type> >(n, false);
sparse_vector w(n, prm.k);
for(ptrdiff_t i = 0; i < static_cast<ptrdiff_t>(n); ++i) {
w.reset(i);
for(auto a = backend::row_begin(A, i); a; ++a) {
w.add(a.col(), a.value(), 0);
}
while(!w.q.empty()) {
nonzero &a = w.next_nonzero();
a.val = a.val * (*D)[a.col];
for(ptrdiff_t j = Uptr[a.col], e = Uptr[a.col+1]; j < e; ++j) {
int lev = std::max(a.lev, Ulev[j]) + 1;
w.add(Ucol[j], -a.val * Uval[j], lev);
}
}
w.sort();
for(const nonzero &e : w.nz) {
if (e.col < i) {
Lcol.push_back(e.col);
Lval.push_back(e.val);
} else if (e.col == i) {
(*D)[i] = math::inverse(e.val);
} else {
Ucol.push_back(e.col);
Uval.push_back(e.val);
Ulev.push_back(e.lev);
}
}
Lptr.push_back(Lcol.size());
Uptr.push_back(Ucol.size());
}
ilu = std::make_shared<ilu_solve>(
std::make_shared<build_matrix>(n, n, Lptr, Lcol, Lval),
std::make_shared<build_matrix>(n, n, Uptr, Ucol, Uval),
D, prm.solve, bprm);
}
/// \copydoc amgcl::relaxation::damped_jacobi::apply_pre
template <class Matrix, class VectorRHS, class VectorX, class VectorTMP>
void apply_pre(
const Matrix &A, const VectorRHS &rhs, VectorX &x, VectorTMP &tmp
) const
{
backend::residual(rhs, A, x, tmp);
ilu->solve(tmp);
backend::axpby(prm.damping, tmp, math::identity<scalar_type>(), x);
}
/// \copydoc amgcl::relaxation::damped_jacobi::apply_post
template <class Matrix, class VectorRHS, class VectorX, class VectorTMP>
void apply_post(
const Matrix &A, const VectorRHS &rhs, VectorX &x, VectorTMP &tmp
) const
{
backend::residual(rhs, A, x, tmp);
ilu->solve(tmp);
backend::axpby(prm.damping, tmp, math::identity<scalar_type>(), x);
}
template <class Matrix, class VectorRHS, class VectorX>
void apply(const Matrix&, const VectorRHS &rhs, VectorX &x) const
{
backend::copy(rhs, x);
ilu->solve(x);
}
size_t bytes() const {
return ilu->bytes();
}
private:
std::shared_ptr<ilu_solve> ilu;
struct nonzero {
ptrdiff_t col;
value_type val;
int lev;
nonzero() : col(-1) {}
nonzero(ptrdiff_t col, const value_type &val, int lev)
: col(col), val(val), lev(lev) {}
friend bool operator<(const nonzero &a, const nonzero &b) {
return a.col < b.col;
}
};
struct sparse_vector {
struct comp_indices {
const std::deque<nonzero> &nz;
comp_indices(const std::deque<nonzero> &nz) : nz(nz) {}
bool operator()(int a, int b) const {
return nz[a].col > nz[b].col;
}
};
typedef
std::priority_queue<int, std::vector<int>, comp_indices>
priority_queue;
int lfil;
std::deque<nonzero> nz;
std::vector<ptrdiff_t> idx;
priority_queue q;
ptrdiff_t dia;
sparse_vector(size_t n, int lfil)
: lfil(lfil), idx(n, -1), q(comp_indices(nz)), dia(0)
{}
void add(ptrdiff_t col, const value_type &val, int lev) {
if (idx[col] < 0) {
if (lev <= lfil) {
int p = nz.size();
idx[col] = p;
nz.push_back(nonzero(col, val, lev));
if (col < dia) q.push(p);
}
} else {
nonzero &a = nz[idx[col]];
a.val += val;
a.lev = std::min(a.lev, lev);
}
}
typename std::vector<nonzero>::iterator begin() {
return nz.begin();
}
typename std::vector<nonzero>::iterator end() {
return nz.end();
}
nonzero& next_nonzero() {
int p = q.top();
q.pop();
return nz[p];
}
void sort() {
std::sort(nz.begin(), nz.end());
}
void reset(ptrdiff_t d) {
for(const nonzero &e : nz) idx[e.col] = -1;
nz.clear();
dia = d;
}
};
};
} // namespace relaxation
} // namespace amgcl
#endif
|
{
"pile_set_name": "Github"
}
|
{
"services": {
"repository-manager": {
"class": "./../RepositoryManager",
"arguments": ["!tagged repository"]
},
"repository-foo": {
"class": "./../RepositoryFoo",
"tags": [{ "name": "repository" }]
},
"repository-bar": {
"class": "./../RepositoryBar",
"tags": [{ "name": "repository" }]
}
}
}
|
{
"pile_set_name": "Github"
}
|
# The contents of this file are subject to the Common Public Attribution
# License Version 1.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://code.reddit.com/LICENSE. The License is based on the Mozilla Public
# License Version 1.1, but Sections 14 and 15 have been added to cover use of
# software over a computer network and provide for limited attribution for the
# Original Developer. In addition, Exhibit A has been modified to be consistent
# with Exhibit B.
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
# the specific language governing rights and limitations under the License.
#
# The Original Code is reddit.
#
# The Original Developer is the Initial Developer. The Initial Developer of
# the Original Code is reddit Inc.
#
# All portions of the code written by reddit are Copyright (c) 2006-2015 reddit
# Inc. All Rights Reserved.
###############################################################################
"""A delayed execution system.
The ``trylater`` module provides tools for performing an action at a set time
in the future. To use it, you must do two things.
First, make a scheduling call::
from datetime import timedelta
from r2.models.trylater import TryLater
def make_breakfast(spam):
breakfast = cook(spam)
later = timedelta(minutes=45)
# The storage layer only likes strings.
data = json.dumps(breakfast)
TryLater.schedule('wash_dishes', data, later)
Then, write the delayed code and decorate it with a hook, using the same
identifier as you used when you scheduled it::
from r2.lib import hooks
trylater_hooks = hooks.HookRegistrar()
@trylater_hooks.on('trylater.wash_dishes')
def on_dish_washing(data):
# data is an ordered dictionary of timeuuid -> data pairs.
for datum in data.values():
meal = json.loads(datum)
for dish in meal.dishes:
dish.wash()
Note: once you've scheduled a ``TryLater`` task, there's no stopping it! If
you might need to cancel your jobs later, use ``TryLaterBySubject``, which uses
almost the exact same semantics, but has a useful ``unschedule`` method.
"""
from collections import OrderedDict
from datetime import datetime, timedelta
import uuid
from pycassa.system_manager import TIME_UUID_TYPE, UTF8_TYPE
from pycassa.util import convert_uuid_to_time
from pylons import app_globals as g
from r2.lib.db import tdb_cassandra
from r2.lib.utils import tup
class TryLater(tdb_cassandra.View):
_use_db = True
_read_consistency_level = tdb_cassandra.CL.QUORUM
_write_consistency_level = tdb_cassandra.CL.QUORUM
_compare_with = TIME_UUID_TYPE
@classmethod
def process_ready_items(cls, rowkey, ready_fn):
cutoff = datetime.now(g.tz)
columns = cls._cf.xget(rowkey, include_timestamp=True)
ready_items = OrderedDict()
ready_timestamps = []
unripe_timestamps = []
for ready_time_uuid, (data, timestamp) in columns:
ready_time = convert_uuid_to_time(ready_time_uuid)
ready_datetime = datetime.fromtimestamp(ready_time, tz=g.tz)
if ready_datetime <= cutoff:
ready_items[ready_time_uuid] = data
ready_timestamps.append(timestamp)
else:
unripe_timestamps.append(timestamp)
g.stats.simple_event(
"trylater.{system}.ready".format(system=rowkey),
delta=len(ready_items),
)
g.stats.simple_event(
"trylater.{system}.pending".format(system=rowkey),
delta=len(unripe_timestamps),
)
if not ready_items:
return
try:
ready_fn(ready_items)
except:
g.stats.simple_event(
"trylater.{system}.failed".format(system=rowkey),
)
cls.cleanup(rowkey, ready_items, ready_timestamps, unripe_timestamps)
@classmethod
def cleanup(cls, rowkey, ready_items, ready_timestamps, unripe_timestamps):
"""Remove ALL ready items from the C* row"""
if (not unripe_timestamps or
min(unripe_timestamps) > max(ready_timestamps)):
# do a row/timestamp delete to avoid generating column
# tombstones
cls._cf.remove(rowkey, timestamp=max(ready_timestamps))
g.stats.simple_event(
"trylater.{system}.row_delete".format(system=rowkey),
delta=len(ready_items),
)
else:
# the columns weren't created with a fixed delay and there are some
# unripe items with older (lower) timestamps than the items we want
# to delete. fallback to deleting specific columns.
cls._cf.remove(rowkey, ready_items.keys())
g.stats.simple_event(
"trylater.{system}.column_delete".format(system=rowkey),
delta=len(ready_items),
)
@classmethod
def run(cls):
"""Run all ready items through their processing hook."""
from r2.lib import amqp
from r2.lib.hooks import all_hooks
for hook_name, hook in all_hooks().items():
if hook_name.startswith("trylater."):
rowkey = hook_name[len("trylater."):]
def ready_fn(ready_items):
return hook.call(data=ready_items)
g.log.info("Trying %s", rowkey)
cls.process_ready_items(rowkey, ready_fn)
amqp.worker.join()
g.stats.flush()
@classmethod
def search(cls, rowkey, when):
if isinstance(when, uuid.UUID):
when = convert_uuid_to_time(when)
try:
return cls._cf.get(rowkey, column_start=when, column_finish=when)
except tdb_cassandra.NotFoundException:
return {}
@classmethod
def schedule(cls, system, data, delay=None):
"""Schedule code for later execution.
system: an string identifying the hook to be executed
data: passed to the hook as an argument
delay: (optional) a datetime.timedelta indicating the desired
execution time
"""
if delay is None:
delay = timedelta(minutes=60)
key = datetime.now(g.tz) + delay
scheduled = {key: data}
cls._set_values(system, scheduled)
return scheduled
@classmethod
def unschedule(cls, rowkey, column_keys):
column_keys = tup(column_keys)
return cls._cf.remove(rowkey, column_keys)
class TryLaterBySubject(tdb_cassandra.View):
_use_db = True
_read_consistency_level = tdb_cassandra.CL.QUORUM
_write_consistency_level = tdb_cassandra.CL.QUORUM
_compare_with = UTF8_TYPE
_extra_schema_creation_args = {
"key_validation_class": UTF8_TYPE,
"default_validation_class": TIME_UUID_TYPE,
}
_value_type = 'date'
@classmethod
def schedule(cls, system, subject, data, delay, trylater_rowkey=None):
if trylater_rowkey is None:
trylater_rowkey = system
scheduled = TryLater.schedule(trylater_rowkey, data, delay)
when = scheduled.keys()[0]
# TTL 10 minutes after the TryLater runs just in case TryLater
# is running late.
ttl = (delay + timedelta(minutes=10)).total_seconds()
coldict = {subject: when}
cls._set_values(system, coldict, ttl=ttl)
return scheduled
@classmethod
def search(cls, rowkey, subjects=None):
try:
if subjects:
subjects = tup(subjects)
return cls._cf.get(rowkey, subjects)
else:
return cls._cf.get(rowkey)
except tdb_cassandra.NotFoundException:
return {}
@classmethod
def unschedule(cls, rowkey, colkey, schedule_rowkey):
colkey = tup(colkey)
victims = cls.search(rowkey, colkey)
for uu in victims.itervalues():
keys = TryLater.search(schedule_rowkey, uu).keys()
TryLater.unschedule(schedule_rowkey, keys)
cls._cf.remove(rowkey, colkey)
|
{
"pile_set_name": "Github"
}
|
<annotation>
<folder>less_selected</folder>
<filename>videoplayback0808.jpg</filename>
<size>
<width>1000</width>
<height>563</height>
</size>
<segmented>0</segmented>
<object>
<name>Tie Fighter</name>
<bndbox>
<xmin>181</xmin>
<ymin>181</ymin>
<xmax>192</xmax>
<ymax>192</ymax>
</bndbox>
</object>
<object>
<name>Millennium Falcon</name>
<bndbox>
<xmin>271</xmin>
<ymin>228</ymin>
<xmax>727</xmax>
<ymax>318</ymax>
</bndbox>
</object>
</annotation>
|
{
"pile_set_name": "Github"
}
|
package pflag
import (
"fmt"
"net"
"os"
"testing"
)
func setUpIP(ip *net.IP) *FlagSet {
f := NewFlagSet("test", ContinueOnError)
f.IPVar(ip, "address", net.ParseIP("0.0.0.0"), "IP Address")
return f
}
func TestIP(t *testing.T) {
testCases := []struct {
input string
success bool
expected string
}{
{"0.0.0.0", true, "0.0.0.0"},
{" 0.0.0.0 ", true, "0.0.0.0"},
{"1.2.3.4", true, "1.2.3.4"},
{"127.0.0.1", true, "127.0.0.1"},
{"255.255.255.255", true, "255.255.255.255"},
{"", false, ""},
{"0", false, ""},
{"localhost", false, ""},
{"0.0.0", false, ""},
{"0.0.0.", false, ""},
{"0.0.0.0.", false, ""},
{"0.0.0.256", false, ""},
{"0 . 0 . 0 . 0", false, ""},
}
devnull, _ := os.Open(os.DevNull)
os.Stderr = devnull
for i := range testCases {
var addr net.IP
f := setUpIP(&addr)
tc := &testCases[i]
arg := fmt.Sprintf("--address=%s", tc.input)
err := f.Parse([]string{arg})
if err != nil && tc.success == true {
t.Errorf("expected success, got %q", err)
continue
} else if err == nil && tc.success == false {
t.Errorf("expected failure")
continue
} else if tc.success {
ip, err := f.GetIP("address")
if err != nil {
t.Errorf("Got error trying to fetch the IP flag: %v", err)
}
if ip.String() != tc.expected {
t.Errorf("expected %q, got %q", tc.expected, ip.String())
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --expose-wasm
load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
var builder = new WasmModuleBuilder();
builder.addMemory(1, 1, false);
builder.addFunction("foo", kSig_i_v)
.addBody([
kExprI32Const, 00,
kExprMemorySize,
kExprBrIf, 00,
kExprMemorySize,
kExprBr, 0xe7, 0xd2, 0xf2, 0xff, 0x1d
])
.exportFunc();
assertThrows(function() { builder.instantiate(); });
})();
|
{
"pile_set_name": "Github"
}
|
/* Copyright (c) 2012 Rick (rick 'at' gibbed 'dot' us)
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would
* be appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not
* be misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
using System.Collections.Generic;
namespace Gibbed.Borderlands2.GameInfo
{
public sealed class CustomizationDefinition
{
internal CustomizationDefinition()
{
}
public string ResourcePath { get; internal set; }
public string Name { get; internal set; }
public CustomizationType Type { get; internal set; }
public List<CustomizationUsage> Usage { get; internal set; }
public DownloadableContentDefinition DLC { get; internal set; }
}
}
|
{
"pile_set_name": "Github"
}
|
/*
Copyright (c) Microsoft Corporation 2014
Copyright Rene Rivera 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H
#define BOOST_PREDEF_PLAT_WINDOWS_RUNTIME_H
#include <boost/predef/make.h>
#include <boost/predef/os/windows.h>
#include <boost/predef/platform/windows_phone.h>
#include <boost/predef/platform/windows_store.h>
#include <boost/predef/version_number.h>
/*`
[heading `BOOST_PLAT_WINDOWS_RUNTIME`]
Deprecated.
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
for Windows Phone or Store development. This does not align to the existing development model for
UWP and is deprecated. Use one of the other `BOOST_PLAT_WINDOWS_*`definitions instead.
[table
[[__predef_symbol__] [__predef_version__]]
[[`BOOST_PLAT_WINDOWS_PHONE`] [__predef_detection__]]
[[`BOOST_PLAT_WINDOWS_STORE`] [__predef_detection__]]
]
*/
#define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_NOT_AVAILABLE
#if BOOST_OS_WINDOWS && \
(BOOST_PLAT_WINDOWS_STORE || BOOST_PLAT_WINDOWS_PHONE)
# undef BOOST_PLAT_WINDOWS_RUNTIME
# define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_AVAILABLE
#endif
#if BOOST_PLAT_WINDOWS_RUNTIME
# define BOOST_PLAT_WINDOWS_RUNTIME_AVAILABLE
# include <boost/predef/detail/platform_detected.h>
#endif
#define BOOST_PLAT_WINDOWS_RUNTIME_NAME "Windows Runtime"
#endif
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_PLAT_WINDOWS_RUNTIME,BOOST_PLAT_WINDOWS_RUNTIME_NAME)
|
{
"pile_set_name": "Github"
}
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("rpm-changes", function() {
var headerSeperator = /^-+$/;
var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
var simpleEmail = /^[\w+.-]+@[\w.-]+/;
return {
token: function(stream) {
if (stream.sol()) {
if (stream.match(headerSeperator)) { return 'tag'; }
if (stream.match(headerLine)) { return 'tag'; }
}
if (stream.match(simpleEmail)) { return 'string'; }
stream.next();
return null;
}
};
});
CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes");
// Quick and dirty spec file highlighting
CodeMirror.defineMode("rpm-spec", function() {
var arch = /^(i386|i586|i686|x86_64|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
var preamble = /^(Name|Version|Release|License|Summary|Url|Group|Source|BuildArch|BuildRequires|BuildRoot|AutoReqProv|Provides|Requires(\(\w+\))?|Obsoletes|Conflicts|Recommends|Source\d*|Patch\d*|ExclusiveArch|NoSource|Supplements):/;
var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pre|post|triggerin|triggerun|pretrans|posttrans|verifyscript|check|triggerpostun|triggerprein|trigger)/;
var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
return {
startState: function () {
return {
controlFlow: false,
macroParameters: false,
section: false
};
},
token: function (stream, state) {
var ch = stream.peek();
if (ch == "#") { stream.skipToEnd(); return "comment"; }
if (stream.sol()) {
if (stream.match(preamble)) { return "preamble"; }
if (stream.match(section)) { return "section"; }
}
if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
if (stream.match(control_flow_simple)) { return "keyword"; }
if (stream.match(control_flow_complex)) {
state.controlFlow = true;
return "keyword";
}
if (state.controlFlow) {
if (stream.match(operators)) { return "operator"; }
if (stream.match(/^(\d+)/)) { return "number"; }
if (stream.eol()) { state.controlFlow = false; }
}
if (stream.match(arch)) { return "number"; }
// Macros like '%make_install' or '%attr(0775,root,root)'
if (stream.match(/^%[\w]+/)) {
if (stream.match(/^\(/)) { state.macroParameters = true; }
return "macro";
}
if (state.macroParameters) {
if (stream.match(/^\d+/)) { return "number";}
if (stream.match(/^\)/)) {
state.macroParameters = false;
return "macro";
}
}
if (stream.match(/^%\{\??[\w \-]+\}/)) { return "macro"; } // Macros like '%{defined fedora}'
//TODO: Include bash script sub-parser (CodeMirror supports that)
stream.next();
return null;
}
};
});
CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec");
});
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
// 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.
#pragma once
#include <vector>
#include "rocksdb/db.h"
namespace rocksdb {
class SnapshotList;
// Snapshots are kept in a doubly-linked list in the DB.
// Each SnapshotImpl corresponds to a particular sequence number.
class SnapshotImpl : public Snapshot {
public:
SequenceNumber number_; // const after creation
// It indicates the smallest uncommitted data at the time the snapshot was
// taken. This is currently used by WritePrepared transactions to limit the
// scope of queries to IsInSnpashot.
SequenceNumber min_uncommitted_ = 0;
virtual SequenceNumber GetSequenceNumber() const override { return number_; }
private:
friend class SnapshotList;
// SnapshotImpl is kept in a doubly-linked circular list
SnapshotImpl* prev_;
SnapshotImpl* next_;
SnapshotList* list_; // just for sanity checks
int64_t unix_time_;
// Will this snapshot be used by a Transaction to do write-conflict checking?
bool is_write_conflict_boundary_;
};
class SnapshotList {
public:
SnapshotList() {
list_.prev_ = &list_;
list_.next_ = &list_;
list_.number_ = 0xFFFFFFFFL; // placeholder marker, for debugging
// Set all the variables to make UBSAN happy.
list_.list_ = nullptr;
list_.unix_time_ = 0;
list_.is_write_conflict_boundary_ = false;
count_ = 0;
}
// No copy-construct.
SnapshotList(const SnapshotList&) = delete;
bool empty() const { return list_.next_ == &list_; }
SnapshotImpl* oldest() const { assert(!empty()); return list_.next_; }
SnapshotImpl* newest() const { assert(!empty()); return list_.prev_; }
SnapshotImpl* New(SnapshotImpl* s, SequenceNumber seq, uint64_t unix_time,
bool is_write_conflict_boundary) {
s->number_ = seq;
s->unix_time_ = unix_time;
s->is_write_conflict_boundary_ = is_write_conflict_boundary;
s->list_ = this;
s->next_ = &list_;
s->prev_ = list_.prev_;
s->prev_->next_ = s;
s->next_->prev_ = s;
count_++;
return s;
}
// Do not responsible to free the object.
void Delete(const SnapshotImpl* s) {
assert(s->list_ == this);
s->prev_->next_ = s->next_;
s->next_->prev_ = s->prev_;
count_--;
}
// retrieve all snapshot numbers up until max_seq. They are sorted in
// ascending order.
std::vector<SequenceNumber> GetAll(
SequenceNumber* oldest_write_conflict_snapshot = nullptr,
const SequenceNumber& max_seq = kMaxSequenceNumber) const {
std::vector<SequenceNumber> ret;
if (oldest_write_conflict_snapshot != nullptr) {
*oldest_write_conflict_snapshot = kMaxSequenceNumber;
}
if (empty()) {
return ret;
}
const SnapshotImpl* s = &list_;
while (s->next_ != &list_) {
if (s->next_->number_ > max_seq) {
break;
}
ret.push_back(s->next_->number_);
if (oldest_write_conflict_snapshot != nullptr &&
*oldest_write_conflict_snapshot == kMaxSequenceNumber &&
s->next_->is_write_conflict_boundary_) {
// If this is the first write-conflict boundary snapshot in the list,
// it is the oldest
*oldest_write_conflict_snapshot = s->next_->number_;
}
s = s->next_;
}
return ret;
}
// get the sequence number of the most recent snapshot
SequenceNumber GetNewest() {
if (empty()) {
return 0;
}
return newest()->number_;
}
int64_t GetOldestSnapshotTime() const {
if (empty()) {
return 0;
} else {
return oldest()->unix_time_;
}
}
uint64_t count() const { return count_; }
private:
// Dummy head of doubly-linked list of snapshots
SnapshotImpl list_;
uint64_t count_;
};
} // namespace rocksdb
|
{
"pile_set_name": "Github"
}
|
This file was derived from
http://www.gutenberg.org/cache/epub/4650/pg4650.txt
--------
CANDIDE,
ou
L'OPTIMISME,
TRADUIT DE L'ALLEMAND
DE M. LE DOCTEUR RALPH,
AVEC LES ADDITIONS
QU'ON A TROUVÉES DANS LA POCHE DU DOCTEUR, LORSQU'IL MOURUT
À MINDEN, L'AN DE GRÂCE 1759
1759
CHAPITRE I.
Comment Candide fut élevé dans un beau château, et comment il fut
chassé d'icelui.
Il y avait en Vestphalie, dans le château de M. le baron de
Thunder-ten-tronckh, un jeune garçon à qui la nature avait donné
les moeurs les plus douces. Sa physionomie annonçait son âme.
Il avait le jugement assez droit, avec l'esprit le plus simple;
c'est, je crois, pour cette raison qu'on le nommait Candide. Les
anciens domestiques de la maison soupçonnaient qu'il était fils
de la soeur de monsieur le baron et d'un bon et honnête
gentilhomme du voisinage, que cette demoiselle ne voulut jamais
épouser parce qu'il n'avait pu prouver que soixante et onze
quartiers, et que le reste de son arbre généalogique avait été
perdu par l'injure du temps.
Monsieur le baron était un des plus puissants seigneurs de la
Westphalie, car son château avait une porte et des fenêtres. Sa
grande salle même était ornée d'une tapisserie. Tous les chiens
de ses basses-cours composaient une meute dans le besoin; ses
palefreniers étaient ses piqueurs; le vicaire du village était
son grand-aumônier. Ils l'appelaient tous monseigneur, et ils
riaient quand il fesait des contes.
Madame la baronne, qui pesait environ trois cent cinquante
livres, s'attirait par là une très grande considération, et
fesait les honneurs de la maison avec une dignité qui la rendait
encore plus respectable. Sa fille Cunégonde, âgée de dix-sept
ans, était haute en couleur, fraîche, grasse, appétissante. Le
fils du baron paraissait en tout digne de son père. Le
précepteur Pangloss[1] était l'oracle de la maison, et le petit
Candide écoutait ses leçons avec toute la bonne foi de son âge et
de son caractère.
[1] De _pan_, tout, et _glossa_, langue. B.
Pangloss enseignait la métaphysico-théologo-cosmolonigologie. Il
prouvait admirablement qu'il n'y a point d'effet sans cause, et
que, dans ce meilleur des mondes possibles, le château de
monseigneur le baron était le plus beau des châteaux, et madame
la meilleure des baronnes possibles.
Il est démontré, disait-il, que les choses ne peuvent être
autrement; car tout étant fait pour une fin, tout est
nécessairement pour la meilleure fin. Remarquez bien que les nez
ont été faits pour porter des lunettes; aussi avons-nous des
lunettes[2]. Les jambes sont visiblement instituées pour être
chaussées, et nous avons des chausses. Les pierres ont été
formées pour être taillées et pour en faire des châteaux; aussi
monseigneur a un très beau château: le plus grand baron de la
province doit être le mieux logé; et les cochons étant faits pour
être mangés, nous mangeons du porc toute l'année: par conséquent,
ceux qui ont avancé que tout est bien ont dit une sottise; il
fallait dire que tout est au mieux.
[2] Voyez tome XXVII, page 528; et dans les _Mélanges_, année
1738, le chapitre XI de la troisième partie des _Éléments de la
philosophie de Newton_; et année 1768, le chapitre X des
_Singularités de la nature_. B.
Candide écoutait attentivement, et croyait innocemment; car il
trouvait mademoiselle Cunégonde extrêmement belle, quoiqu'il ne
prît jamais la hardiesse de le lui dire. Il concluait qu'après
le bonheur d'être né baron de Thunder-ten-tronckh, le second
degré de bonheur était d'être mademoiselle Cunégonde; le
troisième, de la voir tous les jours; et le quatrième, d'entendre
maître Pangloss, le plus grand philosophe de la province, et par
conséquent de toute la terre.
Un jour Cunégonde, en se promenant auprès du château, dans le
petit bois qu'on appelait parc, vit entre des broussailles le
docteur Pangloss qui donnait une leçon de physique expérimentale
à la femme de chambre de sa mère, petite brune très jolie et très
docile. Comme mademoiselle Cunégonde avait beaucoup de
disposition pour les sciences, elle observa, sans souffler, les
expériences réitérées dont elle fut témoin; elle vit clairement
la raison suffisante du docteur, les effets et les causes, et
s'en retourna tout agitée, toute pensive, toute remplie du désir
d'être savante, songeant qu'elle pourrait bien être la raison
suffisante du jeune Candide, qui pouvait aussi être la sienne.
Elle rencontra Candide en revenant au château, et rougit: Candide
rougit aussi . Elle lui dit bonjour d'une voix entrecoupée; et
Candide lui parla sans savoir ce qu'il disait. Le lendemain,
après le dîner, comme on sortait de table, Cunégonde et Candide
se trouvèrent derrière un paravent; Cunégonde laissa tomber son
mouchoir, Candide le ramassa; elle lui prit innocemment la main;
le jeune homme baisa innocemment la main de la jeune demoiselle
avec une vivacité, une sensibilité, une grâce toute particulière;
leurs bouches se rencontrèrent, leurs yeux s'enflammèrent, leurs
genoux tremblèrent, leurs mains s'égarèrent. M. le baron de
Thunder-ten-tronckh passa auprès du paravent, et voyant cette
cause et cet effet, chassa Candide du château à grands coups de
pied dans le derrière. Cunégonde s'évanouit: elle fut souffletée
par madame la baronne dès qu'elle fut revenue à elle-même; et
tout fut consterné dans le plus beau et le plus agréable des
châteaux possibles.
CHAPITRE II
Ce que devint Candide parmi les Bulgares.
Candide, chassé du paradis terrestre, marcha longtemps sans
savoir où, pleurant, levant les yeux au ciel, les tournant
souvent vers le plus beau des châteaux qui renfermait la plus
belle des baronnettes; il se coucha sans souper au milieu des
champs entre deux sillons; la neige tombait à gros flocons.
Candide, tout transi, se traîna le lendemain vers la ville
voisine, qui s'appelle _Valdberghoff-trarbk-dikdorff_, n'ayant
point d'argent, mourant de faim et de lassitude. Il s'arrêta
tristement à la porte d'un cabaret. Deux hommes habillés de bleu
le remarquèrent: Camarade, dit l'un, voilà un jeune homme très
bien fait, et qui a la taille requise; ils s'avancèrent vers
Candide et le prièrent à dîner très civilement.--Messieurs, leur
dit Candide avec une modestie charmante, vous me faites beaucoup
d'honneur, mais je n'ai pas de quoi payer mon écot.--Ah!
monsieur, lui dit un des bleus, les personnes de votre figure et
de votre mérite ne paient jamais rien: n'avez-vous pas cinq pieds
cinq pouces de haut?--Oui, messieurs, c'est ma taille, dit-il en
fesant la révérence.--Ah! monsieur, mettez-vous à table; non
seulement nous vous défraierons, mais nous ne souffrirons jamais
qu'un homme comme vous manque d'argent; les hommes ne sont faits
que pour se secourir les uns les autres.--Vous avez raison, dit
Candide; c'est ce que M. Pangloss m'a toujours dit, et je vois
bien que tout est au mieux. On le prie d'accepter quelques écus,
il les prend et veut faire son billet; on n'en veut point, on se
met à table. N'aimez-vous pas tendrement?....--Oh! oui,
répond-il, j'aime tendrement mademoiselle Cunégonde.--Non, dit
l'un de ces messieurs, nous vous demandons si vous n'aimez pas
tendrement le roi des Bulgares?--Point du tout, dit-il, car je ne
l'ai jamais vu.--Comment! c'est le plus charmant des rois, et il
faut boire à sa santé.--Oh! très volontiers, messieurs. Et il
boit. C'en est assez, lui dit-on, vous voilà l'appui, le
soutien, le défenseur, le héros des Bulgares; votre fortune est
faite, et votre gloire est assurée. On lui met sur-le-champ les
fers aux pieds, et on le mène au régiment. On le fait tourner à
droite, à gauche, hausser la baguette, remettre la baguette,
coucher en joue, tirer, doubler le pas, et on lui donne trente
coups de bâton; le lendemain, il fait l'exercice un peu moins
mal, et il ne reçoit que vingt coups; le surlendemain, on ne lui
en donne que dix, et il est regardé par ses camarades comme un
prodige.
Candide, tout stupéfait, ne démêlait pas encore trop bien comment
il était un héros. Il s'avisa un beau jour de printemps de
s'aller promener, marchant tout droit devant lui, croyant que
c'était un privilège de l'espèce humaine, comme de l'espèce
animale, de se servir de ses jambes à son plaisir. Il n'eut pas
fait deux lieues que voilà quatre autres héros de six pieds qui
l'atteignent, qui le lient, qui le mènent dans un cachot. On lui
demanda juridiquement ce qu'il aimait le mieux d'être fustigé
trente-six fois par tout le régiment, ou de recevoir à-la-fois
douze balles de plomb dans la cervelle. Il eut beau dire que les
volontés sont libres, et qu'il ne voulait ni l'un ni l'autre, il
fallut faire un choix; il se détermina, en vertu du don de Dieu
qu'on nomme _liberté_, à passer trente-six fois par les
baguettes; il essuya deux promenades. Le régiment était composé
de deux mille hommes; cela lui composa quatre mille coups de
baguette, qui, depuis la nuque du cou jusqu'au cul, lui
découvrirent les muscles et les nerfs. Comme on allait procéder
à la troisième course, Candide, n'en pouvant plus, demanda en
grâce qu'on voulût bien avoir la bonté de lui casser la tête; il
obtint cette faveur; on lui bande les yeux; on le fait mettre à
genoux. Le roi des Bulgares passe dans ce moment, s'informe du
crime du patient; et comme ce roi avait un grand génie, il
comprit, par tout ce qu'il apprit de Candide, que c'était un
jeune métaphysicien fort ignorant des choses de ce monde, et il
lui accorda sa grâce avec une clémence qui sera louée dans tous
les journaux et dans tous les siècles. Un brave chirurgien
guérit Candide en trois semaines avec les émollients enseignés
par Dioscoride. Il avait déjà un peu de peau et pouvait marcher,
quand le roi des Bulgares livra bataille au roi des Abares.
CHAPITRE III.
Comment Candide se sauva d'entre les Bulgares, et ce qu'il
devint.
Rien n'était si beau, si leste, si brillant, si bien ordonné que
les deux armées. Les trompettes, les fifres, les hautbois, les
tambours, les canons; formaient une harmonie telle qu'il n'y en
eut jamais en enfer. Les canons renversèrent d'abord à peu près
six mille hommes de chaque côté; ensuite la mousqueterie ôta du
meilleur des mondes environ neuf à dix mille coquins qui en
infectaient la surface. La baïonnette fut aussi la raison
suffisante de la mort de quelques milliers d'hommes. Le tout
pouvait bien se monter à une trentaine de mille âmes. Candide,
qui tremblait comme un philosophe, se cacha du mieux qu'il put
pendant cette boucherie héroïque.
Enfin, tandis que les deux rois fesaient chanter des _Te Deum_,
chacun dans son camp, il prit le parti d'aller raisonner ailleurs
des effets et des causes. Il passa par-dessus des tas de morts
et de mourants, et gagna d'abord un village voisin; il était en
cendres: c'était un village abare que les Bulgares avaient brûlé,
selon les lois du droit public. Ici des vieillards criblés de
coups regardaient mourir leurs femmes égorgées, qui tenaient
leurs enfants à leurs mamelles sanglantes; là des filles
éventrées après avoir assouvi les besoins naturels de quelques
héros, rendaient les derniers soupirs; d'autres à demi brûlées
criaient qu'on achevât de leur donner la mort. Des cervelles
étaient répandues sur la terre à côté de bras et de jambes
coupés.
Candide s'enfuit au plus vite dans un autre village: il
appartenait à des Bulgares, et les héros abares l'avaient traité
de même. Candide, toujours marchant sur des membres palpitants
ou à travers des ruines, arriva enfin hors du théâtre de la
guerre, portant quelques petites provisions dans son bissac, et
n'oubliant jamais mademoiselle Cunégonde. Ses provisions lui
manquèrent quand il fut en Hollande; mais ayant entendu dire que
tout le monde était riche dans ce pays-là, et qu'on y était
chrétien, il ne douta pas qu'on ne le traitât aussi bien qu'il
l'avait été dans le château de M. le baron, avant qu'il en eût
été chassé pour les beaux yeux de mademoiselle Cunégonde.
Il demanda l'aumône à plusieurs graves personnages, qui lui
répondirent tous que, s'il continuait à faire ce métier, on
l'enfermerait dans une maison de correction pour lui apprendre à
vivre.
Il s'adressa ensuite à un homme qui venait de parler tout seul
une heure de suite sur la charité dans une grande assemblée. Cet
orateur le regardant de travers lui dit: Que venez-vous faire
ici? y êtes-vous pour la bonne cause? Il n'y a point d'effet sans
cause, répondit modestement Candide; tout est enchaîné
nécessairement et arrangé pour le mieux. Il a fallu que je fusse
chassé d'auprès de mademoiselle Cunégonde, que j'aie passé par
les baguettes, et il faut que je demande mon pain, jusqu'à ce que
je puisse en gagner; tout cela ne pouvait être autrement. Mon
ami, lui dit l'orateur, croyez-vous que le pape soit
l'antechrist? Je ne l'avais pas encore entendu dire, répondit
Candide: mais qu'il le soit, ou qu'il ne le soit pas, je manque
de pain. Tu ne mérites pas d'en manger, dit l'autre: va, coquin,
va, misérable, ne m'approche de ta vie. La femme de l'orateur
ayant mis la tête à la fenêtre, et avisant un homme qui doutait
que le pape fût antechrist, lui répandit sur le chef un
plein..... O ciel! à quel excès se porte le zèle de la religion
dans les dames!
Un homme qui n'avait point été baptisé, un bon anabaptiste, nommé
Jacques, vit la manière cruelle et ignominieuse dont on traitait
ainsi un de ses frères, un être à deux pieds sans plumes, qui
avait une âme; il l'amena chez lui, le nettoya, lui donna du pain
et de la bière, lui fit présent de deux florins, et voulut même
lui apprendre à travailler dans ses manufactures aux étoffes de
Perse qu'on fabrique en Hollande. Candide se prosternant presque
devant lui, s'écriait: Maître Pangloss me l'avait bien dit que
tout est au mieux dans ce monde, car je suis infiniment plus
touché de votre extrême générosité que de la dureté de ce
monsieur à manteau noir, et de madame son épouse.
Le lendemain, en se promenant, il rencontra un gueux tout couvert
de pustules, les yeux morts, le bout du nez rongé, la bouche de
travers, les dents noires, et parlant de la gorge, tourmenté
d'une toux violente, et crachant une dent à chaque effort.
CHAPITRE IV.
Comment Candide rencontra son ancien maître de philosophie, le
docteur Pangloss, et ce qui en advint.
Candide, plus ému encore de compassion que d'horreur, donna à cet
épouvantable gueux les deux florins qu'il avait reçus de son
honnête anabaptiste Jacques. Le fantôme le regarda fixement,
versa des larmes, et sauta à son cou. Candide effrayé recule.
Hélas! dit le misérable à l'autre misérable, ne reconnaissez-vous
plus votre cher Pangloss? Qu'entends-je? vous, mon cher maître!
vous, dans cet état horrible! quel malheur vous est-il donc
arrivé? pourquoi n'êtes-vous plus dans le plus beau des châteaux?
qu'est devenue mademoiselle Cunégonde, la perle des filles, le
chef-d'oeuvre de la nature? Je n'en peux plus, dit Pangloss.
Aussitôt Candide le mena dans l'étable de l'anabaptiste, où il
lui fit manger un peu de pain; et quand Pangloss fut refait: Eh
bien! lui dit-il, Cunégonde? Elle est morte, reprit l'autre.
Candide s'évanouit à ce mot: son ami rappela ses sens avec un peu
de mauvais vinaigre qui se trouva par hasard dans l'étable.
Candide rouvre les yeux. Cunégonde est morte! Ah! meilleur des
mondes, où êtes-vous? Mais de quelle maladie est-elle morte? ne
serait-ce point de m'avoir vu chasser du beau château de monsieur
son père à grands coups de pied? Non, dit Pangloss, elle a été
éventrée par des soldats bulgares, après avoir été violée autant
qu'on peut l'être; ils ont cassé la tête à monsieur le baron qui
voulait la défendre; madame la baronne a été coupée en morceaux;
mon pauvre pupille traité précisément comme sa soeur; et quant au
château, il n'est pas resté pierre sur pierre, pas une grange,
pas un mouton, pas un canard, pas un arbre; mais nous avons été
bien vengés, car les Abares en ont fait autant dans une baronnie
voisine qui appartenait à un seigneur bulgare.
A ce discours, Candide s'évanouit encore; mais revenu à soi, et
ayant dit tout ce qu'il devait dire, il s'enquit de la cause et
de l'effet, et de la raison suffisante qui avait mis Pangloss
dans un si piteux état. Hélas! dit l'autre, c'est l'amour:
l'amour, le consolateur du genre humain, le conservateur de
l'univers, l'âme de tous les êtres sensibles, le tendre amour.
Hélas! dit Candide, je l'ai connu cet amour, ce souverain des
coeurs, cette âme de notre âme; il ne m'a jamais valu qu'un
baiser et vingt coups de pied au cul. Comment cette belle cause
a-t-elle pu produire en vous un effet si abominable?
Pangloss répondit en ces termes: O mon cher Candide! vous avez
connu Paquette, cette jolie suivante de notre auguste baronne:
j'ai goûté dans ses bras les délices du paradis, qui ont produit
ces tourments d'enfer dont vous me voyez dévoré; elle en était
infectée, elle en est peut-être morte. Paquette tenait ce
présent d'un cordelier très savant qui avait remonté à la source,
car il l'avait eu d'une vieille comtesse, qui l'avait reçu d'un
capitaine de cavalerie, qui le devait à une marquise, qui le
tenait d'un page, qui l'avait reçu d'un jésuite, qui, étant
novice, l'avait eu en droite ligne d'un des compagnons de
Christophe Colomb. Pour moi, je ne le donnerai à personne, car
je me meurs.
O Pangloss! s'écria Candide, voilà une étrange généalogie!
n'est-ce pas le diable qui en fut la souche? Point du tout,
répliqua ce grand homme; c'était une chose indispensable dans le
meilleur des mondes, un ingrédient nécessaire; car si Colomb
n'avait pas attrapé dans une île de l'Amérique cette maladie[1]
qui empoisonne la source de la génération, qui souvent même
empêche la génération, et qui est évidemment l'opposé du grand
but de la nature, nous n'aurions ni le chocolat ni la cochenille;
il faut encore observer que jusqu'aujourd'hui, dans notre
continent, cette maladie nous est particulière, comme la
controverse. Les Turcs, les Indiens, les Persans, les Chinois,
les Siamois, les Japonais, ne la connaissent pas encore; mais il
y a une raison suffisante pour qu'ils la connaissent à leur tour
dans quelques siècles. En attendant elle a fait un merveilleux
progrès parmi nous, et surtout dans ces grandes armées composées
d'honnêtes stipendiaires bien élevés, qui décident du destin des
états; on peut assurer que, quand trente mille hommes combattent
en bataille rangée contre des troupes égales en nombre, il y a
environ vingt mille vérolés de chaque côté.
[1] Voyez tome XXXI, page 7. B.
Voilà qui est admirable, dit Candide; mais il faut vous faire
guérir. Et comment le puis-je? dit Pangloss; je n'ai pas le sou,
mon ami, et dans toute l'étendue de ce globe on ne peut ni se
faire saigner, ni prendre un lavement sans payer, ou sans qu'il y
ait quelqu'un qui paie pour nous.
Ce dernier discours détermina Candide; il alla se jeter aux pieds
de son charitable anabaptiste Jacques, et lui fit une peinture si
touchante de l'état où son ami était réduit, que le bon-homme
n'hésita pas à recueillir le docteur Pangloss; il le fit guérir à
ses dépens. Pangloss, dans la cure, ne perdit qu'un oeil et une
oreille. Il écrivait bien, et savait parfaitement
l'arithmétique. L'anabaptiste Jacques en fit son teneur de
livres. Au bout de deux mois, étant obligé d'aller à Lisbonne
pour les affaires de son commerce, il mena dans son vaisseau ses
deux philosophes. Pangloss lui expliqua comment tout était on ne
peut mieux. Jacques n'était pas de cet avis. Il faut bien,
disait-il, que les hommes aient un peu corrompu la nature, car
ils ne sont point nés loups, et ils sont devenus loups. Dieu ne
leur a donné ni canons de vingt-quatre, ni baïonnettes, et ils se
sont fait des baïonnettes et des canons pour se détruire. Je
pourrais mettre en ligne de compte les banqueroutes, et la
justice qui s'empare des biens des banqueroutiers pour en
frustrer les créanciers. Tout cela était indispensable,
répliquait le docteur borgne, et les malheurs particuliers font
le bien général; de sorte que plus il y a de malheurs
particuliers, et plus tout est bien. Tandis qu'il raisonnait,
l'air s'obscurcit, les vents soufflèrent des quatre coins du
monde, et le vaisseau fut assailli de la plus horrible tempête, à
la vue du port de Lisbonne.
CHAPITRE V.
Tempête, naufrage, tremblement de terre, et ce qui advint du
docteur Pangloss, de Candide, et de l'anabaptiste Jacques.
La moitié des passagers affaiblis, expirants de ces angoisses
inconcevables que le roulis d'un vaisseau porte dans les nerfs et
dans toutes les humeurs du corps agitées en sens contraires,
n'avait pas même la force de s'inquiéter du danger. L'autre
moitié jetait des cris et fesait des prières; les voiles étaient
déchirées, les mâts brisés, le vaisseau entr'ouvert. Travaillait
qui pouvait, personne ne s'entendait, personne ne commandait.
L'anabaptiste aidait un peu à la manoeuvre; il était sur le
tillac; un matelot furieux le frappe rudement et l'étend sur les
planches; mais du coup qu'il lui donna, il eut lui-même une si
violente secousse, qu'il tomba hors du vaisseau, la tête la
première. Il restait suspendu et accroché à une partie de mât
rompu. Le bon Jacques court à son secours, l'aide à remonter, et
de l'effort qu'il fait, il est précipité dans la mer à la vue du
matelot, qui le laissa périr sans daigner seulement le regarder.
Candide approche, voit son bienfaiteur qui reparaît un moment, et
qui est englouti pour jamais. Il veut se jeter après lui dans la
mer: le philosophe Pangloss l'en empêche, en lui prouvant que la
rade de Lisbonne avait été formée exprès pour que cet anabaptiste
s'y noyât. Tandis qu'il le prouvait _à priori_, le vaisseau
s'entr'ouvre, tout périt à la réserve de Pangloss, de Candide, et
de ce brutal de matelot qui avait noyé le vertueux anabaptiste;
le coquin nagea heureusement jusqu'au rivage, où Pangloss et
Candide furent portés sur une planche.
Quand ils furent revenus un peu à eux, ils marchèrent vers
Lisbonne; il leur restait quelque argent, avec lequel ils
espéraient se sauver de la faim après avoir échappé à la tempête.
A peine ont-ils mis le pied dans la ville, en pleurant la mort de
leur bienfaiteur, qu'ils sentent la terre trembler sous leurs
pas[1]; la mer s'élève en bouillonnant dans le port, et brise les
vaisseaux qui sont à l'ancre. Des tourbillons de flammes et de
cendres couvrent les rues et les places publiques; les maisons
s'écroulent, les toits sont renversés sur les fondements, et les
fondements se dispersent; trente mille habitants de tout âge et
de tout sexe sont écrasés sous des ruines. Le matelot disait en
sifflant et en jurant: il y aura quelque chose à gagner ici.
Quelle peut être la raison suffisante de ce phénomène? disait
Pangloss. Voici le dernier jour du monde! s'écriait Candide.
Le matelot court incontinent au milieu des débris, affronte la
mort pour trouver de l'argent, en trouve, s'en empare, s'enivre,
et ayant cuvé son vin, achète les faveurs de la première fille de
bonne volonté qu'il rencontre sur les ruines des maisons
détruites, et au milieu des mourants et des morts. Pangloss le
tirait cependant par la manche: Mon ami, lui disait-il, cela
n'est pas bien, vous manquez à la raison universelle, vous prenez
mal votre temps. Tête et sang, répondit l'autre, je suis matelot
et né à Batavia; j'ai marché quatre fois sur le crucifix dans
quatre voyages au Japon[2]; tu as bien trouvé ton homme avec ta
raison universelle!
[1] Le tremblement de terre de Lisbonne est du 1er novembre 1755.
B.
[2] Voyez tome XVIII, page 470. B.
Quelques éclats de pierre avaient blessé Candide; il était étendu
dans la rue et couvert de débris. Il disait à Pangloss: Hélas!
procure-moi un peu de vin et d'huile; je me meurs. Ce
tremblement de terre n'est pas une chose nouvelle, répondit
Pangloss; la ville de Lima éprouva les mêmes secousses en
Amérique l'année passée; mêmes causes, mêmes effets; il y a
certainement une traînée de soufre sous terre depuis Lima jusqu'à
Lisbonne. Rien n'est plus probable, dit Candide; mais, pour
Dieu, un peu d'huile et de vin. Comment probable? répliqua le
philosophe, je soutiens que la chose est démontrée. Candide
perdit connaissance, et Pangloss lui apporta un peu d'eau d'une
fontaine voisine.
Le lendemain, ayant trouvé quelques provisions de bouche en se
glissant à travers des décombres, ils réparèrent un peu leurs
forces. Ensuite ils travaillèrent comme les autres à soulager
les habitants échappés à la mort. Quelques citoyens, secourus
par eux, leur donnèrent un aussi bon dîner qu'on le pouvait dans
un tel désastre: il est vrai que le repas était triste; les
convives arrosaient leur pain de leurs larmes; mais Pangloss les
consola, en les assurant que les choses ne pouvaient être
autrement: Car, dit-il, tout ceci est ce qu'il y a de mieux; car
s'il y a un volcan à Lisbonne, il ne pouvait être ailleurs; car
il est impossible que les choses ne soient pas où elles sont, car
tout est bien.
Un petit homme noir, familier de l'inquisition, lequel était à
côté de lui, prit poliment la parole et dit: Apparemment que
monsieur ne croit pas au péché originel; car si tout est au
mieux, il n'y a donc eu ni chute ni punition.
Je demande très humblement pardon à votre excellence, répondit
Pangloss encore plus poliment, car la chute de l'homme et la
malédiction entraient nécessairement dans le meilleur des mondes
possibles. Monsieur ne croit donc pas à la liberté? dit le
familier. Votre excellence m'excusera, dit Pangloss; la liberté
peut subsister avec la nécessité absolue; car il était nécessaire
que nous fussions libres; car enfin la volonté déterminée......
Pangloss était au milieu de sa phrase, quand Je familier fit un
signe de tête à son estafier qui lui servait à boire du vin de
Porto ou d'Oporto.
|
{
"pile_set_name": "Github"
}
|
from typing import Optional
from webdnn.graph.attribute import Attribute
from webdnn.graph.operator import Operator
class InplaceOperator(Attribute):
"""InplaceOperator(op, input_name, output_name)
This attribute represents that the operation can be performed as inplace for corresponding input and output variables. Note that the
operation with this attribute is not always performed as inplace. For example, if orders of input and output variables are different,
operation cannot be performed as inplace.
Attributes:
op (:class:`~webdnn.graph.operator.Operator`) : base operator
input_name (str): input names which can be operated in-place
output_name (str): output names which can be operated in-place
"""
def __init__(self, op: Operator, input_name: str, output_name: str):
self.op = op
self.input_name = input_name
self.output_name = output_name
def get_input(self):
return self.op.inputs[self.input_name]
def get_output(self):
return self.op.outputs[self.output_name]
def get_status(self):
return self.op.has_attribute(Inplace)
def toggle_status(self, inplace: Optional[bool] = None):
if inplace is None:
inplace = not self.op.has_attribute(Inplace)
if inplace:
if self.op.has_attribute(Inplace):
return
self.op.attributes.add(Inplace(self.op))
else:
if not self.op.has_attribute(Inplace):
return
self.op.attributes.remove(self.op.get_attribute(Inplace)[0])
class Inplace(Attribute):
"""Inplace(op, input_name, output_name)
Operation with this attribute is transpiled as inplace operation.
Attributes:
op (:class:`~webdnn.graph.operator.Operator`) : base operator
"""
def __init__(self, op: Operator):
self.op = op
def get_input(self):
return self.op.get_attribute(InplaceOperator)[0].get_input()
def get_output(self):
return self.op.get_attribute(InplaceOperator)[0].get_output()
|
{
"pile_set_name": "Github"
}
|
oneadmin ALL=(ALL) NOPASSWD: ONE_CEPH, ONE_HA, ONE_MARKET
|
{
"pile_set_name": "Github"
}
|
package com.wantedtech.common.xpresso.regex;
public class CA_Regex {
public Regex POSTAL_CODE = new Regex("\\b[ABCEGHJKLMNPRSTVXY][0-9][A-Z] [0-9][A-Z][0-9]\\b");
}
|
{
"pile_set_name": "Github"
}
|
#if !XB1
using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading;
using VRage.Collections;
using VRage.Game.Components;
using VRage.Profiler;
using VRage.Utils;
namespace VRage.Game.SessionComponents
{
/// <summary>
/// Communication between game and editor.
/// </summary>
[MySessionComponentDescriptor(MyUpdateOrder.BeforeSimulation)]
public class MySessionComponentExtDebug : MySessionComponentBase
{
private class MyDebugClientInfo
{
public TcpClient TcpClient;
public MyExternalDebugStructures.CommonMsgHeader LastHeader;
}
// ------------------------------------------------------------------------------------
// public members
public delegate void ReceivedMsgHandler(MyExternalDebugStructures.CommonMsgHeader messageHeader, IntPtr messageData);
// Event - received message.
public event ReceivedMsgHandler ReceivedMsg
{
add
{
m_receivedMsgHandlers.Add(value);
m_receivedMsgHandlers.ApplyAdditions();
}
remove
{
if (m_receivedMsgHandlers.Contains(value))
{
m_receivedMsgHandlers.Remove(value);
m_receivedMsgHandlers.ApplyRemovals();
}
}
}
public bool IsHandlerRegistered(ReceivedMsgHandler handler)
{
return m_receivedMsgHandlers.Contains(handler);
}
// Static reference to this session component.
public static MySessionComponentExtDebug Static = null;
public static bool ForceDisable = false;
// Static reference to this session component.
public const int GameDebugPort = 13000;
// Is any client connected?
public bool HasClients
{
get { return m_clients.Count > 0; }
}
// ------------------------------------------------------------------------------------
// private members
// Maximum message size. 10 KB limit... for now.
private const int MsgSizeLimit = 1024 * 10;
// Thread for TCP listener.
private Thread m_listenerThread;
// Tcp listener instance.
private TcpListener m_listener;
// Connected tcp clients.
private ConcurrentCachingList<MyDebugClientInfo> m_clients = new ConcurrentCachingList<MyDebugClientInfo>(1);
// Is component active (listening)?
private bool m_active = false;
// Buffer for receiving. 10 KB limit... for now.
private byte[] m_arrayBuffer = new byte[MsgSizeLimit];
// Temporary receive buffer. 10 KB limit... for now.
private IntPtr m_tempBuffer;
// Array of handlers (callback methods).
private ConcurrentCachingList<ReceivedMsgHandler> m_receivedMsgHandlers = new ConcurrentCachingList<ReceivedMsgHandler>();
// ------------------------------------------------------------------------------------
public override void LoadData()
{
if (Static != null)
{
// take data from previous instance
m_listenerThread = Static.m_listenerThread;
m_listener = Static.m_listener;
m_clients = Static.m_clients;
m_active = Static.m_active;
m_arrayBuffer = Static.m_arrayBuffer;
m_tempBuffer = Static.m_tempBuffer;
m_receivedMsgHandlers = Static.m_receivedMsgHandlers;
MySessionComponentExtDebug.Static = this;
base.LoadData();
return;
}
MySessionComponentExtDebug.Static = this;
if (m_tempBuffer == IntPtr.Zero)
m_tempBuffer = Marshal.AllocHGlobal(MsgSizeLimit);
if (!ForceDisable)
StartServer();
base.LoadData();
}
protected override void UnloadData()
{
m_receivedMsgHandlers.ClearImmediate();
base.UnloadData();
}
public void Dispose()
{
m_receivedMsgHandlers.ClearList();
if (m_active)
{
StopServer(); // do not stop server
}
if (m_tempBuffer != IntPtr.Zero)
Marshal.FreeHGlobal(m_tempBuffer);
}
/// <summary>
/// Start using this component as server (game side).
/// </summary>
private bool StartServer()
{
if (!m_active)
{
m_listenerThread = new Thread(ServerListenerProc) { IsBackground = true};
m_listenerThread.Start();
m_active = true;
return true;
}
else
{
return false;
}
}
/// <summary>
/// Stop the server on the game side. Called automatically.
/// </summary>
private void StopServer()
{
if (m_active && m_listenerThread != null)
{
m_listener.Stop();
//m_listenerThread.Interrupt(); // will stop itself
foreach (var client in m_clients)
{
if (client.TcpClient != null)
{
client.TcpClient.Client.Disconnect(true);
client.TcpClient.Close();
}
}
m_clients.ClearImmediate();
m_active = false;
}
}
/// <summary>
/// Parallel thread - listener.
/// </summary>
private void ServerListenerProc()
{
Thread.CurrentThread.Name = "External Debugging Listener";
ProfilerShort.Autocommit = false;
try
{
#if OFFICIAL_BUILD == true
m_listener = new TcpListener(IPAddress.Loopback, GameDebugPort) {ExclusiveAddressUse = false};
#else
m_listener = new TcpListener(IPAddress.Any, GameDebugPort) { ExclusiveAddressUse = false };
#endif
m_listener.Start();
}
catch (SocketException ex)
{
MyLog.Default.WriteLine("Cannot start debug listener.");
MyLog.Default.WriteLine(ex);
m_listener = null;
m_active = false;
return;
}
MyLog.Default.WriteLine("External debugger: listening...");
while (true)
{
try
{
var client = m_listener.AcceptTcpClient();
client.Client.Blocking = true;
MyLog.Default.WriteLine("External debugger: accepted client.");
m_clients.Add(new MyDebugClientInfo()
{
TcpClient = client,
LastHeader = MyExternalDebugStructures.CommonMsgHeader.Create("UNKNOWN")
});
m_clients.ApplyAdditions();
}
catch (SocketException e)
{
if (e.SocketErrorCode == SocketError.Interrupted)
{
m_listener.Stop();
m_listener = null;
MyLog.Default.WriteLine("External debugger: interrupted.");
ProfilerShort.Commit();
ProfilerShort.DestroyThread();
return;
}
else
{
if (MyLog.Default != null && MyLog.Default.LogEnabled)
MyLog.Default.WriteLine(e);
break;
}
}
}
m_listener.Stop();
m_listener = null;
ProfilerShort.Commit();
ProfilerShort.DestroyThread();
}
// Read messages coming from clients.
public override void UpdateBeforeSimulation()
{
ProfilerShort.Begin("External Debugging");
foreach (var clientInfo in m_clients)
{
if (clientInfo == null || clientInfo.TcpClient == null || clientInfo.TcpClient.Client == null || !clientInfo.TcpClient.Connected)
{
if (clientInfo != null && clientInfo.TcpClient != null && clientInfo.TcpClient.Client != null &&
clientInfo.TcpClient.Client.Connected)
{
clientInfo.TcpClient.Client.Disconnect(true);
clientInfo.TcpClient.Close();
}
m_clients.Remove(clientInfo);
continue;
}
if (clientInfo.TcpClient.Connected && clientInfo.TcpClient.Available > 0)
ReadMessagesFromClients(clientInfo);
}
m_clients.ApplyRemovals();
ProfilerShort.End();
}
// Read messages coming from one client.
private void ReadMessagesFromClients(MyDebugClientInfo clientInfo)
{
Socket socket = clientInfo.TcpClient.Client;
while (socket.Available >= 0)
{
bool readAnything = false;
// receive header
if (!clientInfo.LastHeader.IsValid
&& socket.Available >= MyExternalDebugStructures.MsgHeaderSize) // already checked ^
{
socket.Receive(m_arrayBuffer, MyExternalDebugStructures.MsgHeaderSize, SocketFlags.None);
Marshal.Copy(m_arrayBuffer, 0, m_tempBuffer, MyExternalDebugStructures.MsgHeaderSize);
clientInfo.LastHeader =
(MyExternalDebugStructures.CommonMsgHeader)
Marshal.PtrToStructure(m_tempBuffer,
typeof (MyExternalDebugStructures.CommonMsgHeader));
readAnything = true;
}
// receive body (only if we received header!)
if (clientInfo.LastHeader.IsValid &&
socket.Available >= clientInfo.LastHeader.MsgSize)
{
socket.Receive(m_arrayBuffer, clientInfo.LastHeader.MsgSize, SocketFlags.None);
if (m_receivedMsgHandlers != null && m_receivedMsgHandlers.Count > 0)
{
Marshal.Copy(m_arrayBuffer, 0, m_tempBuffer, clientInfo.LastHeader.MsgSize);
// callback
foreach (var handler in m_receivedMsgHandlers)
if (handler != null)
handler(clientInfo.LastHeader, m_tempBuffer);
}
// erase header
clientInfo.LastHeader = default(MyExternalDebugStructures.CommonMsgHeader);
readAnything = true;
}
if (!readAnything)
break;
}
}
// Send messages to all clients.
public bool SendMessageToClients<TMessage>(TMessage msg) where TMessage : struct, MyExternalDebugStructures.IExternalDebugMsg
{
int messageDataSize = Marshal.SizeOf(typeof (TMessage));
MyExternalDebugStructures.CommonMsgHeader msgHeader = MyExternalDebugStructures.CommonMsgHeader.Create(msg.GetTypeStr(), messageDataSize);
Marshal.StructureToPtr(msgHeader, m_tempBuffer, true);
Marshal.Copy(m_tempBuffer, m_arrayBuffer, 0, MyExternalDebugStructures.MsgHeaderSize);
Marshal.StructureToPtr(msg, m_tempBuffer, true);
Marshal.Copy(m_tempBuffer, m_arrayBuffer, MyExternalDebugStructures.MsgHeaderSize, messageDataSize);
foreach (var clientInfo in m_clients)
{
try
{
if (clientInfo.TcpClient.Client != null)
clientInfo.TcpClient.Client.Send(m_arrayBuffer, 0,
MyExternalDebugStructures.MsgHeaderSize + messageDataSize, SocketFlags.None);
}
catch (SocketException)
{
clientInfo.TcpClient.Close();
}
}
return true;
}
}
}
#endif // !XB1
|
{
"pile_set_name": "Github"
}
|
{
"$schema": "http://schemastore.org/schemas/json/webjob-publish-settings.json",
"webJobName": "CoreSimpleTimerJobConsole",
"startTime": null,
"endTime": null,
"jobRecurrenceFrequency": null,
"interval": null,
"runMode": "OnDemand"
}
|
{
"pile_set_name": "Github"
}
|
/** @namespace */
myProject = myProject || {};
/** @namespace */
myProject.myModule = (function () {
/** describe myPrivateVar here */
var myPrivateVar = "";
var myPrivateMethod = function () {
}
/** @scope myProject.myModule */
return {
myPublicMethod: function () {
}
};
})();
|
{
"pile_set_name": "Github"
}
|
#
# ovirt-engine-setup -- ovirt engine setup
#
# Copyright oVirt Authors
# SPDX-License-Identifier: Apache-2.0
#
#
"""Notifier plugin."""
import gettext
from otopi import plugin
from otopi import util
from ovirt_engine import configfile
from ovirt_engine_setup.engine import constants as oenginecons
from ovirt_setup_lib import dialog
def _(m):
return gettext.dgettext(message=m, domain='ovirt-engine-setup')
@util.export
class Plugin(plugin.PluginBase):
"""Notifier plugin."""
def __init__(self, context):
super(Plugin, self).__init__(context=context)
@plugin.event(
stage=plugin.Stages.STAGE_INIT,
)
def _init(self):
self.environment.setdefault(
oenginecons.ConfigEnv.IGNORE_VDS_GROUP_IN_NOTIFIER,
None
)
@plugin.event(
stage=plugin.Stages.STAGE_VALIDATION,
condition=lambda self: self.environment[
oenginecons.CoreEnv.ENABLE
] and not self.environment[
oenginecons.ConfigEnv.IGNORE_VDS_GROUP_IN_NOTIFIER
],
)
def _validation(self):
config = configfile.ConfigFile(
(
oenginecons.FileLocations.OVIRT_ENGINE_NOTIFIER_SERVICE_CONFIG,
),
)
filterStr = config.get('FILTER')
self.logger.debug('filterStr: %s', filterStr)
if filterStr is not None and 'VDS_GROUP' in filterStr:
ans = dialog.queryBoolean(
dialog=self.dialog,
name='OVESETUP_WAIT_NOTIFIER_FILTER',
note=_(
'Setup found filter/s in engine-notifier configuration '
'files in {conf}.d/*.conf containing the string '
'"VDS_GROUP".\n You must manually change "VDS_GROUP" to '
'"CLUSTER" throughout the notifier configuration in '
'order to get notified on cluster related events.\n Do '
'you want to continue?\n'
'(Answering "no" will stop the upgrade '
'(@VALUES@) [@DEFAULT@]: '
).format(
conf=(
oenginecons.FileLocations.
OVIRT_ENGINE_NOTIFIER_SERVICE_CONFIG
),
),
prompt=True,
default=False,
)
self.environment[
oenginecons.ConfigEnv.IGNORE_VDS_GROUP_IN_NOTIFIER
] = ans
if not ans:
raise RuntimeError(_('Aborted by user'))
# vim: expandtab tabstop=4 shiftwidth=4
|
{
"pile_set_name": "Github"
}
|
owner = SOV
controller = SOV
add_core = SOV
infra = 4
|
{
"pile_set_name": "Github"
}
|
Running on vangogh:
1) download opencv 2.4.9 to /scratch/opencv-cuda/
http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip
2) install it using the following commands (I used cmake version 2.8.11.2):
cd opencv-2.9.4
mkdir install
cmake -G 'Unix Makefiles' -D WITH_CUDA=ON -D CMAKE_BUILD_TYPE=DEBUG -D BUILD_SHARED_LIBS=NO -D WITH_CUBLAS=YES -D CMAKE_INSTALL_PREFIX=./install .
make -j 8
make install
3) nm -A *.a | c++filt | grep -w T
|
{
"pile_set_name": "Github"
}
|
package request
import (
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/awsutil"
)
// WaiterResourceNotReadyErrorCode is the error code returned by a waiter when
// the waiter's max attempts have been exhausted.
const WaiterResourceNotReadyErrorCode = "ResourceNotReady"
// A WaiterOption is a function that will update the Waiter value's fields to
// configure the waiter.
type WaiterOption func(*Waiter)
// WithWaiterMaxAttempts returns the maximum number of times the waiter should
// attempt to check the resource for the target state.
func WithWaiterMaxAttempts(max int) WaiterOption {
return func(w *Waiter) {
w.MaxAttempts = max
}
}
// WaiterDelay will return a delay the waiter should pause between attempts to
// check the resource state. The passed in attempt is the number of times the
// Waiter has checked the resource state.
//
// Attempt is the number of attempts the Waiter has made checking the resource
// state.
type WaiterDelay func(attempt int) time.Duration
// ConstantWaiterDelay returns a WaiterDelay that will always return a constant
// delay the waiter should use between attempts. It ignores the number of
// attempts made.
func ConstantWaiterDelay(delay time.Duration) WaiterDelay {
return func(attempt int) time.Duration {
return delay
}
}
// WithWaiterDelay will set the Waiter to use the WaiterDelay passed in.
func WithWaiterDelay(delayer WaiterDelay) WaiterOption {
return func(w *Waiter) {
w.Delay = delayer
}
}
// WithWaiterLogger returns a waiter option to set the logger a waiter
// should use to log warnings and errors to.
func WithWaiterLogger(logger aws.Logger) WaiterOption {
return func(w *Waiter) {
w.Logger = logger
}
}
// WithWaiterRequestOptions returns a waiter option setting the request
// options for each request the waiter makes. Appends to waiter's request
// options already set.
func WithWaiterRequestOptions(opts ...Option) WaiterOption {
return func(w *Waiter) {
w.RequestOptions = append(w.RequestOptions, opts...)
}
}
// A Waiter provides the functionality to perform a blocking call which will
// wait for a resource state to be satisfied by a service.
//
// This type should not be used directly. The API operations provided in the
// service packages prefixed with "WaitUntil" should be used instead.
type Waiter struct {
Name string
Acceptors []WaiterAcceptor
Logger aws.Logger
MaxAttempts int
Delay WaiterDelay
RequestOptions []Option
NewRequest func([]Option) (*Request, error)
SleepWithContext func(aws.Context, time.Duration) error
}
// ApplyOptions updates the waiter with the list of waiter options provided.
func (w *Waiter) ApplyOptions(opts ...WaiterOption) {
for _, fn := range opts {
fn(w)
}
}
// WaiterState are states the waiter uses based on WaiterAcceptor definitions
// to identify if the resource state the waiter is waiting on has occurred.
type WaiterState int
// String returns the string representation of the waiter state.
func (s WaiterState) String() string {
switch s {
case SuccessWaiterState:
return "success"
case FailureWaiterState:
return "failure"
case RetryWaiterState:
return "retry"
default:
return "unknown waiter state"
}
}
// States the waiter acceptors will use to identify target resource states.
const (
SuccessWaiterState WaiterState = iota // waiter successful
FailureWaiterState // waiter failed
RetryWaiterState // waiter needs to be retried
)
// WaiterMatchMode is the mode that the waiter will use to match the WaiterAcceptor
// definition's Expected attribute.
type WaiterMatchMode int
// Modes the waiter will use when inspecting API response to identify target
// resource states.
const (
PathAllWaiterMatch WaiterMatchMode = iota // match on all paths
PathWaiterMatch // match on specific path
PathAnyWaiterMatch // match on any path
PathListWaiterMatch // match on list of paths
StatusWaiterMatch // match on status code
ErrorWaiterMatch // match on error
)
// String returns the string representation of the waiter match mode.
func (m WaiterMatchMode) String() string {
switch m {
case PathAllWaiterMatch:
return "pathAll"
case PathWaiterMatch:
return "path"
case PathAnyWaiterMatch:
return "pathAny"
case PathListWaiterMatch:
return "pathList"
case StatusWaiterMatch:
return "status"
case ErrorWaiterMatch:
return "error"
default:
return "unknown waiter match mode"
}
}
// WaitWithContext will make requests for the API operation using NewRequest to
// build API requests. The request's response will be compared against the
// Waiter's Acceptors to determine the successful state of the resource the
// waiter is inspecting.
//
// The passed in context must not be nil. If it is nil a panic will occur. The
// Context will be used to cancel the waiter's pending requests and retry delays.
// Use aws.BackgroundContext if no context is available.
//
// The waiter will continue until the target state defined by the Acceptors,
// or the max attempts expires.
//
// Will return the WaiterResourceNotReadyErrorCode error code if the waiter's
// retryer ShouldRetry returns false. This normally will happen when the max
// wait attempts expires.
func (w Waiter) WaitWithContext(ctx aws.Context) error {
for attempt := 1; ; attempt++ {
req, err := w.NewRequest(w.RequestOptions)
if err != nil {
waiterLogf(w.Logger, "unable to create request %v", err)
return err
}
req.Handlers.Build.PushBack(MakeAddToUserAgentFreeFormHandler("Waiter"))
err = req.Send()
// See if any of the acceptors match the request's response, or error
for _, a := range w.Acceptors {
if matched, matchErr := a.match(w.Name, w.Logger, req, err); matched {
return matchErr
}
}
// The Waiter should only check the resource state MaxAttempts times
// This is here instead of in the for loop above to prevent delaying
// unnecessary when the waiter will not retry.
if attempt == w.MaxAttempts {
break
}
// Delay to wait before inspecting the resource again
delay := w.Delay(attempt)
if sleepFn := req.Config.SleepDelay; sleepFn != nil {
// Support SleepDelay for backwards compatibility and testing
sleepFn(delay)
} else {
sleepCtxFn := w.SleepWithContext
if sleepCtxFn == nil {
sleepCtxFn = aws.SleepWithContext
}
if err := sleepCtxFn(ctx, delay); err != nil {
return awserr.New(CanceledErrorCode, "waiter context canceled", err)
}
}
}
return awserr.New(WaiterResourceNotReadyErrorCode, "exceeded wait attempts", nil)
}
// A WaiterAcceptor provides the information needed to wait for an API operation
// to complete.
type WaiterAcceptor struct {
State WaiterState
Matcher WaiterMatchMode
Argument string
Expected interface{}
}
// match returns if the acceptor found a match with the passed in request
// or error. True is returned if the acceptor made a match, error is returned
// if there was an error attempting to perform the match.
func (a *WaiterAcceptor) match(name string, l aws.Logger, req *Request, err error) (bool, error) {
result := false
var vals []interface{}
switch a.Matcher {
case PathAllWaiterMatch, PathWaiterMatch:
// Require all matches to be equal for result to match
vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument)
if len(vals) == 0 {
break
}
result = true
for _, val := range vals {
if !awsutil.DeepEqual(val, a.Expected) {
result = false
break
}
}
case PathAnyWaiterMatch:
// Only a single match needs to equal for the result to match
vals, _ = awsutil.ValuesAtPath(req.Data, a.Argument)
for _, val := range vals {
if awsutil.DeepEqual(val, a.Expected) {
result = true
break
}
}
case PathListWaiterMatch:
// ignored matcher
case StatusWaiterMatch:
s := a.Expected.(int)
result = s == req.HTTPResponse.StatusCode
case ErrorWaiterMatch:
if aerr, ok := err.(awserr.Error); ok {
result = aerr.Code() == a.Expected.(string)
}
default:
waiterLogf(l, "WARNING: Waiter %s encountered unexpected matcher: %s",
name, a.Matcher)
}
if !result {
// If there was no matching result found there is nothing more to do
// for this response, retry the request.
return false, nil
}
switch a.State {
case SuccessWaiterState:
// waiter completed
return true, nil
case FailureWaiterState:
// Waiter failure state triggered
return true, awserr.New(WaiterResourceNotReadyErrorCode,
"failed waiting for successful resource state", err)
case RetryWaiterState:
// clear the error and retry the operation
return false, nil
default:
waiterLogf(l, "WARNING: Waiter %s encountered unexpected state: %s",
name, a.State)
return false, nil
}
}
func waiterLogf(logger aws.Logger, msg string, args ...interface{}) {
if logger != nil {
logger.Log(fmt.Sprintf(msg, args...))
}
}
|
{
"pile_set_name": "Github"
}
|
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// <complex>
// void real(T val);
// void imag(T val);
#include <complex>
#include <cassert>
#include "test_macros.h"
template <class T>
void
test_constexpr()
{
#if TEST_STD_VER > 11
constexpr std::complex<T> c1;
static_assert(c1.real() == 0, "");
static_assert(c1.imag() == 0, "");
constexpr std::complex<T> c2(3);
static_assert(c2.real() == 3, "");
static_assert(c2.imag() == 0, "");
constexpr std::complex<T> c3(3, 4);
static_assert(c3.real() == 3, "");
static_assert(c3.imag() == 4, "");
#endif
}
template <class T>
void
test()
{
std::complex<T> c;
assert(c.real() == 0);
assert(c.imag() == 0);
c.real(3.5);
assert(c.real() == 3.5);
assert(c.imag() == 0);
c.imag(4.5);
assert(c.real() == 3.5);
assert(c.imag() == 4.5);
c.real(-4.5);
assert(c.real() == -4.5);
assert(c.imag() == 4.5);
c.imag(-5.5);
assert(c.real() == -4.5);
assert(c.imag() == -5.5);
test_constexpr<T> ();
}
int main(int, char**)
{
test<float>();
test<double>();
test<long double>();
test_constexpr<int> ();
return 0;
}
|
{
"pile_set_name": "Github"
}
|
/*
* Created by LuaView.
* Copyright (c) 2017, Alibaba Group. All rights reserved.
*
* This source code is licensed under the MIT.
* For the full copyright and license information,please view the LICENSE file in the root directory of this source tree.
*/
package com.taobao.luaview.view;
import android.support.annotation.NonNull;
import android.view.View;
import android.view.ViewGroup;
import com.taobao.luaview.global.LuaView;
import com.taobao.luaview.userdata.ui.UDCustomPanel;
import com.taobao.luaview.userdata.ui.UDView;
import com.taobao.luaview.userdata.ui.UDViewGroup;
import com.taobao.luaview.util.LuaUtil;
import com.taobao.luaview.util.LuaViewUtil;
import com.taobao.luaview.view.interfaces.ILVNativeViewProvider;
import com.taobao.luaview.view.interfaces.ILVViewGroup;
import org.luaj.vm2.Globals;
import org.luaj.vm2.LuaValue;
import org.luaj.vm2.Varargs;
/**
* LuaView-Container
* 容器类
*
* @author song
* @date 15/8/20
*/
public abstract class LVCustomPanel extends LVViewGroup<UDCustomPanel> implements ILVViewGroup, ILVNativeViewProvider {
public LVCustomPanel(Globals globals, LuaValue metaTable, Varargs varargs) {
super(globals, metaTable, varargs);
initPanel();
}
@NonNull
public UDCustomPanel createUserdata(Globals globals, LuaValue metaTable, Varargs varargs) {
return new UDCustomPanel(this, globals, metaTable, varargs);
}
public void show() {
LVCustomPanel.this.setVisibility(View.VISIBLE);
}
public void hide() {
LVCustomPanel.this.setVisibility(View.GONE);
}
/**
* 初始化Panel
*/
public abstract void initPanel();
/**
* call LuaView 的 global functions
*
* @param objs
*/
public void callLuaFunction(String name, Object... objs) {
UDView userdata = getUserdata();
if (userdata != null) {
Globals globals = userdata.getGlobals();
if (globals != null) {
globals.callLuaFunction(name, objs);
}
}
}
/**
* 子类实现该方法,用于Lua回调该方法
*/
public void callLuaCallback(Object... objs) {
UDView userdata = getUserdata();
if (userdata != null) {
final LuaValue callback = userdata.getCallback();
LuaUtil.callFunction(callback, objs);
}
}
//获取native view
@Override
public View getNativeView() {
if (getChildCount() > 0 && getChildAt(0) != null) {
return getChildAt(0);
}
return null;
}
}
|
{
"pile_set_name": "Github"
}
|
package org.codehaus.jackson.io;
import org.codehaus.jackson.JsonEncoding;
import org.codehaus.jackson.util.BufferRecycler;
import org.codehaus.jackson.util.TextBuffer;
/**
* To limit number of configuration and state objects to pass, all
* contextual objects that need to be passed by the factory to
* readers and writers are combined under this object. One instance
* is created for each reader and writer.
*/
public final class IOContext
{
/*
/**********************************************************
/* Configuration
/**********************************************************
*/
/**
* Reference to the source object, which can be used for displaying
* location information
*/
protected final Object _sourceRef;
/**
* Encoding used by the underlying stream, if known.
*/
protected JsonEncoding _encoding;
/**
* Flag that indicates whether underlying input/output source/target
* object is fully managed by the owner of this context (parser or
* generator). If true, it is, and is to be closed by parser/generator;
* if false, calling application has to do closing (unless auto-closing
* feature is enabled for the parser/generator in question; in which
* case it acts like the owner).
*/
protected final boolean _managedResource;
/*
/**********************************************************
/* Buffer handling, recycling
/**********************************************************
*/
/**
* Recycler used for actual allocation/deallocation/reuse
*/
protected final BufferRecycler _bufferRecycler;
/**
* Reference to the allocated I/O buffer for low-level input reading,
* if any allocated.
*/
protected byte[] _readIOBuffer = null;
/**
* Reference to the allocated I/O buffer used for low-level
* encoding-related buffering.
*/
protected byte[] _writeEncodingBuffer = null;
/**
* Reference to the buffer allocated for tokenization purposes,
* in which character input is read, and from which it can be
* further returned.
*/
protected char[] _tokenCBuffer = null;
/**
* Reference to the buffer allocated for buffering it for
* output, before being encoded: generally this means concatenating
* output, then encoding when buffer fills up.
*/
protected char[] _concatCBuffer = null;
/**
* Reference temporary buffer Parser instances need if calling
* app decides it wants to access name via 'getTextCharacters' method.
* Regular text buffer can not be used as it may contain textual
* representation of the value token.
*/
protected char[] _nameCopyBuffer = null;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
public IOContext(BufferRecycler br, Object sourceRef, boolean managedResource)
{
_bufferRecycler = br;
_sourceRef = sourceRef;
_managedResource = managedResource;
}
public void setEncoding(JsonEncoding enc)
{
_encoding = enc;
}
/*
/**********************************************************
/* Public API, accessors
/**********************************************************
*/
public final Object getSourceReference() { return _sourceRef; }
public final JsonEncoding getEncoding() { return _encoding; }
public final boolean isResourceManaged() { return _managedResource; }
/*
/**********************************************************
/* Public API, buffer management
/**********************************************************
*/
public final TextBuffer constructTextBuffer() {
return new TextBuffer(_bufferRecycler);
}
/**
*<p>
* Note: the method can only be called once during its life cycle.
* This is to protect against accidental sharing.
*/
public final byte[] allocReadIOBuffer()
{
if (_readIOBuffer != null) {
throw new IllegalStateException("Trying to call allocReadIOBuffer() second time");
}
_readIOBuffer = _bufferRecycler.allocByteBuffer(BufferRecycler.ByteBufferType.READ_IO_BUFFER);
return _readIOBuffer;
}
public final byte[] allocWriteEncodingBuffer()
{
if (_writeEncodingBuffer != null) {
throw new IllegalStateException("Trying to call allocWriteEncodingBuffer() second time");
}
_writeEncodingBuffer = _bufferRecycler.allocByteBuffer(BufferRecycler.ByteBufferType.WRITE_ENCODING_BUFFER);
return _writeEncodingBuffer;
}
public final char[] allocTokenBuffer()
{
if (_tokenCBuffer != null) {
throw new IllegalStateException("Trying to call allocTokenBuffer() second time");
}
_tokenCBuffer = _bufferRecycler.allocCharBuffer(BufferRecycler.CharBufferType.TOKEN_BUFFER);
return _tokenCBuffer;
}
public final char[] allocConcatBuffer()
{
if (_concatCBuffer != null) {
throw new IllegalStateException("Trying to call allocConcatBuffer() second time");
}
_concatCBuffer = _bufferRecycler.allocCharBuffer(BufferRecycler.CharBufferType.CONCAT_BUFFER);
return _concatCBuffer;
}
public final char[] allocNameCopyBuffer(int minSize)
{
if (_nameCopyBuffer != null) {
throw new IllegalStateException("Trying to call allocNameCopyBuffer() second time");
}
_nameCopyBuffer = _bufferRecycler.allocCharBuffer(BufferRecycler.CharBufferType.NAME_COPY_BUFFER, minSize);
return _nameCopyBuffer;
}
/**
* Method to call when all the processing buffers can be safely
* recycled.
*/
public final void releaseReadIOBuffer(byte[] buf)
{
if (buf != null) {
/* Let's do sanity checks to ensure once-and-only-once release,
* as well as avoiding trying to release buffers not owned
*/
if (buf != _readIOBuffer) {
throw new IllegalArgumentException("Trying to release buffer not owned by the context");
}
_readIOBuffer = null;
_bufferRecycler.releaseByteBuffer(BufferRecycler.ByteBufferType.READ_IO_BUFFER, buf);
}
}
public final void releaseWriteEncodingBuffer(byte[] buf)
{
if (buf != null) {
/* Let's do sanity checks to ensure once-and-only-once release,
* as well as avoiding trying to release buffers not owned
*/
if (buf != _writeEncodingBuffer) {
throw new IllegalArgumentException("Trying to release buffer not owned by the context");
}
_writeEncodingBuffer = null;
_bufferRecycler.releaseByteBuffer(BufferRecycler.ByteBufferType.WRITE_ENCODING_BUFFER, buf);
}
}
public final void releaseTokenBuffer(char[] buf)
{
if (buf != null) {
if (buf != _tokenCBuffer) {
throw new IllegalArgumentException("Trying to release buffer not owned by the context");
}
_tokenCBuffer = null;
_bufferRecycler.releaseCharBuffer(BufferRecycler.CharBufferType.TOKEN_BUFFER, buf);
}
}
public final void releaseConcatBuffer(char[] buf)
{
if (buf != null) {
if (buf != _concatCBuffer) {
throw new IllegalArgumentException("Trying to release buffer not owned by the context");
}
_concatCBuffer = null;
_bufferRecycler.releaseCharBuffer(BufferRecycler.CharBufferType.CONCAT_BUFFER, buf);
}
}
public final void releaseNameCopyBuffer(char[] buf)
{
if (buf != null) {
if (buf != _nameCopyBuffer) {
throw new IllegalArgumentException("Trying to release buffer not owned by the context");
}
_nameCopyBuffer = null;
_bufferRecycler.releaseCharBuffer(BufferRecycler.CharBufferType.NAME_COPY_BUFFER, buf);
}
}
}
|
{
"pile_set_name": "Github"
}
|
import React, { useState, useEffect } from 'react'
import { auth } from 'lib/Store'
/**
* Sign in with username and password
*
* @param {String} role DRIVER/MANAGER. default as DRIVER
*/
export default function SignIn({ role = "DRIVER" }) {
const [formData, updateFormData] = useState({ role });
const [action, setAction] = useState(null);
function onChange(e) {
updateFormData({
...formData,
// Trimming any whitespace
[e.target.name]: e.target.value.trim()
});
};
async function postAndWait(url, data, options = {}) {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
body: JSON.stringify(data),
...options,
})
const body = await response.json()
return body
}
async function onSubmit(event) {
event.preventDefault();
try {
if (action === "SIGNUP") {
const signupResponse = await postAndWait(`/api/auth/signup`, formData)
await auth.loginWithRefreshToken(signupResponse.refresh_token, true)
window.location.reload();
} else if (action === "LOGIN") {
const loginResponse = await postAndWait(`/api/auth/login`, formData)
await auth.loginWithRefreshToken(loginResponse.refresh_token, true)
window.location.reload();
}
} catch (error) {
console.log('error', error)
alert("Authentication failed. Please check your input.")
}
}
return (
<form className="container" onSubmit={onSubmit}>
<label>
Email
<input name="email" type='email' onChange={onChange} />
</label>
<label>
Password
<input name="password" type='password' onChange={onChange} />
</label>
<button type='submit' onClick={() => setAction("SIGNUP")}>Sign up</button>
<button type='submit' onClick={() => setAction("LOGIN")}>Login</button>
<style jsx>{`
.container {
min-width: 20rem;
padding: 0 0.5rem;
display: flex;
flex-direction: column;
}
label {
display: flex;
flex-direction: column;
margin-bottom: 1rem;
}
input {
margin-top: 0.5rem;
padding: 0.5rem;
font-size: 1rem;
}
button {
margin-top: 0.5rem;
padding: 0.5rem;
font-size: 1rem;
}
`}</style>
</form>
)
}
|
{
"pile_set_name": "Github"
}
|
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
OUT = WallLocationLine.FinishFaceExterior
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon-iPad.png</string>
<string>icon@2x.png</string>
<string>icon.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.sadun.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
|
{
"pile_set_name": "Github"
}
|
/// <reference types="cypress" />
// Copied an example command from https://on.cypress.io/custom-commands
Cypress.Commands.add('clickLink', (label: string | number | RegExp) => {
cy.get('a').contains(label).click()
})
|
{
"pile_set_name": "Github"
}
|
.bd-testimonials
background-color: $background
.bd-testimonial
align-items: flex-start
display: flex
justify-content: center
.bd-testimonial-tweet
background-color: $scheme-main
.bd-more-loves
align-items: center
display: flex
justify-content: center
margin-top: 1.5rem
text-align: center
.button
height: auto
padding: 0.75em 1.5em
span
transform-origin: center center
transition: transform $speed $easing
&:hover
span
transform: scale(1.04)
+mobile
.bd-testimonials
padding: 1.5rem
.bd-testimonial
margin-bottom: 1.5rem
+tablet
.bd-testimonials
padding: 3rem
.bd-testimonial + .bd-testimonial
margin-top: 1.5rem
+desktop
.bd-testimonials
min-height: 595px
+widescreen
.bd-testimonials
min-height: 653px
+fullhd
.bd-testimonials
min-height: 632px
.bd-rainbow
animation: rainbow 8s ease infinite
background-image: linear-gradient(124deg, $orange, $red, $purple, $blue)
background-size: 800% 800%
.hero.bd-is-love
.title,
.subtitle
color: $scheme-main
@keyframes rainbow
0%
background-position: 1% 80%
50%
background-position: 99% 20%
100%
background-position: 1% 80%
.bd-hug
align-items: flex-start
display: flex
justify-content: center
+mobile
.bd-hug
margin: 1.5rem
.bd-embrace
text-align: center
&:not(:first-child)
margin-top: 1.5rem
&:not(:last-child)
margin-bottom: 1.5rem
.bd-embrace-button
margin-top: 0.75rem
+tablet
.bd-embrace
align-items: center
display: flex
justify-content: center
&:not(:first-child)
margin-top: 3rem
&:not(:last-child)
margin-bottom: 3rem
.bd-embrace-button
margin-left: 1.5rem
.bd-hugs
display: flex
flex-wrap: wrap
padding-bottom: 3rem
.bd-hug
margin-top: 1.5rem
width: calc(33.3333% - 1rem)
&:nth-child(1),
&:nth-child(2),
&:nth-child(3)
margin-top: 0
&:nth-child(3n-1),
&:nth-child(3n)
margin-left: 1.5rem
.bd-shoutout
background-color: $background
padding: 2rem
text-align: center
&:not(:last-child)
margin-bottom: 3rem
.bd-shoutout-text
&.title
opacity: 0.8
&.subtitle
opacity: 0.5
.bd-shoutout-button
margin-top: -0.75rem
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: bfa4da7810224e14da943441c756840b
folderAsset: yes
timeCreated: 1479451035
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
|
{
"pile_set_name": "Github"
}
|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing Tests.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
const kPrivateBrowsingNotification = "private-browsing";
const kPrivateBrowsingCancelVoteNotification = "private-browsing-cancel-vote";
const kPrivateBrowsingTransitionCompleteNotification = "private-browsing-transition-complete";
const kEnter = "enter";
const kExit = "exit";
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
const NS_APP_HISTORY_50_FILE = "UHist";
function LOG(aMsg) {
aMsg = ("*** PRIVATEBROWSING TESTS: " + aMsg);
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).
logStringMessage(aMsg);
print(aMsg);
}
function uri(spec) {
return Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService).
newURI(spec, null, null);
}
// If there's no location registered for the profile direcotry, register one now.
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
var profileDir = null;
try {
profileDir = dirSvc.get(NS_APP_USER_PROFILE_50_DIR, Ci.nsIFile);
} catch (e) {}
if (!profileDir) {
// Register our own provider for the profile directory.
// It will simply return the current directory.
var provider = {
getFile: function(prop, persistent) {
persistent.value = true;
if (prop == NS_APP_USER_PROFILE_50_DIR) {
return dirSvc.get("CurProcD", Ci.nsIFile);
}
if (prop == NS_APP_HISTORY_50_FILE) {
var histFile = dirSvc.get("CurProcD", Ci.nsIFile);
histFile.append("history.dat");
return histFile;
}
throw Cr.NS_ERROR_FAILURE;
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIDirectoryServiceProvider) ||
iid.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
dirSvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
}
// Do not attempt to restore any session since we don't have any windows
Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
setBoolPref("browser.privatebrowsing.keep_current_session", true);
/**
* Removes any files that could make our tests fail.
*/
function cleanUp()
{
let files = [
"downloads.sqlite",
"places.sqlite",
"cookies.sqlite",
"signons.sqlite",
"permissions.sqlite"
];
for (let i = 0; i < files.length; i++) {
let file = dirSvc.get("ProfD", Ci.nsIFile);
file.append(files[i]);
if (file.exists())
file.remove(false);
}
}
cleanUp();
/**
* Finalize Places statements during quit-application in order to prevent leaks
*/
function shutdownPlaces() {
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
os.notifyObservers(null, "quit-application", null);
}
var PRIVATEBROWSING_CONTRACT_ID;
function run_test_on_all_services() {
var contractIDs = [
"@mozilla.org/privatebrowsing;1",
"@mozilla.org/privatebrowsing-wrapper;1"
];
for (var i = 0; i < contractIDs.length; ++i) {
PRIVATEBROWSING_CONTRACT_ID = contractIDs[i];
run_test_on_service();
cleanUp();
}
}
|
{
"pile_set_name": "Github"
}
|
package hanging_suite_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)
func TestHangingSuite(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "HangingSuite Suite")
}
|
{
"pile_set_name": "Github"
}
|
package de.zalando.play.controllers
import akka.util.ByteString
import play.api.http.Writeable
import play.api.libs.json._
import play.api.mvc.Results.{ Redirect, Status }
import play.api.mvc.{ AnyContentAsMultipartFormData, RequestHeader, Results }
import scala.language.implicitConversions
case class WriteableWrapper[T](w: Writeable[T], m: Manifest[T])
object WriteableWrapper {
implicit def writeable2wrapper[T](w: Writeable[T])(implicit m: Manifest[T]): WriteableWrapper[T] =
WriteableWrapper(w, m)
implicit val anyContentAsMultipartFormWritable: Writeable[AnyContentAsMultipartFormData] = {
MultipartFormDataWritable.singleton.map(_.mdf)
}
}
/**
* @since 28.02.2016.
*/
object ResponseWriters extends ResponseWritersBase
trait ResponseWritersBase {
type ContentType = String
def custom: Seq[WriteableWrapper[_]] = Seq.empty
case class choose[T](mimeType: ContentType) {
def apply[R <: Any](registry: Seq[WriteableWrapper[_]] = custom)(implicit m: Manifest[R]): Option[Writeable[R]] =
registry filter {
_.w.contentType.exists(_ == mimeType)
} find { p =>
m.runtimeClass.isAssignableFrom(p.m.runtimeClass)
} map {
_.asInstanceOf[WriteableWrapper[R]]
} map (_.w)
}
implicit val jsonTranslatedParsingErrorWrites = Json.writes[TranslatedParsingError]
implicit val jsonTranslatedParsingErrorsContainerWrites = Json.writes[TranslatedParsingErrorsContainer]
}
object WrappedBodyParsers extends WrappedBodyParsersBase
trait WrappedBodyParsersBase {
implicit def parser2parserWrapper[T](p: Parser[T])(implicit m: Manifest[T]): ParserWrapper[T] = ParserWrapper(p, m)
type Parser[T] = ByteString => T
case class ParserWrapper[T](p: Parser[T], m: Manifest[T])
val custom: Seq[(String, ParserWrapper[_])] = Seq.empty
def anyParser[T](implicit manifest: Manifest[T]): Seq[(String, Parser[T])] =
custom.filter(_._2.m.runtimeClass.isAssignableFrom(manifest.runtimeClass)).map { e =>
e.copy(_2 = e._2.asInstanceOf[ParserWrapper[T]].p)
}
def optionParser[T](implicit manifest: Manifest[T]): Seq[(String, Parser[Option[T]])] = anyParser[Option[T]]
}
trait ResultWrapper[ResultT] {
val emptyByteString = akka.util.CompactByteString.empty
def statusCode: Int
def result: ResultT
def toResultWithWriter(implicit writer: Writeable[ResultT]): play.api.mvc.Result =
if (statusCode / 100 == 3)
Redirect(result.toString, statusCode)
else
Status(statusCode)(result)
def writer: String => Option[Writeable[ResultT]]
def toResult(mimeType: String): Option[play.api.mvc.Result] =
if (statusCode / 100 == 3)
Option(Redirect(result.toString, statusCode))
else
writer(mimeType).map(Status(statusCode)(result)(_))
}
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "skip/Type.h"
#include "testutil.h"
#include <gtest/gtest.h>
using namespace skip;
using namespace skip::test;
namespace {
std::vector<size_t> absOffsets(const std::vector<ssize_t>& offsets) {
std::vector<size_t> res(offsets.size());
for (size_t i = 0; i < offsets.size(); ++i)
res[i] = std::abs(offsets[i]);
return res;
}
void skipNegativeOffsets(const std::vector<ssize_t>& offsets, size_t& index) {
while ((index < offsets.size()) && (offsets[index] < 0)) {
++index;
}
}
std::vector<ssize_t> unrollOffsets(
const std::vector<ssize_t>& offsets,
size_t userByteSize,
arraysize_t arraySize) {
std::vector<ssize_t> unrolledOffsets;
for (arraysize_t i = 0; i < arraySize; ++i) {
for (auto offset : offsets) {
bool neg = offset < 0;
unrolledOffsets.push_back(
(std::abs(offset) + userByteSize * i) * (neg ? -1 : 1));
}
}
return unrolledOffsets;
}
void verifyRefs(
Type& t,
const std::vector<ssize_t>& offsets,
arraysize_t arraySize = 1) {
// Purposely create an RObj without a VTable in the hope that if Type
// incorrectly tries to access the VTable (incorrect since we already know the
// Type) it will SEGV.
// A negative offset indicates an offset that should be filled with a fakeptr.
const size_t objUserSize = t.userByteSize() * arraySize;
auto raw = std::unique_ptr<void, decltype(::free)*>(
::calloc(t.uninternedMetadataByteSize() + objUserSize, 1), ::free);
auto robj =
static_cast<RObj*>(mem::add(raw.get(), t.uninternedMetadataByteSize()));
static_cast<AObjMetadata*>(raw.get())->m_arraySize = arraySize;
std::vector<ssize_t> unrolledOffsets =
unrollOffsets(offsets, t.userByteSize(), arraySize);
// Fake up some data that looks sort of like pointers (and not nil)
for (auto offset : unrolledOffsets) {
assert(std::abs(offset) + sizeof(void*) <= objUserSize);
const ssize_t value = (offset + 1) * sizeof(void*);
*((ssize_t*)mem::add(robj, std::abs(offset))) = value;
}
size_t nextOffset = 0;
skipNegativeOffsets(unrolledOffsets, nextOffset);
t.eachValidRef(*robj, [&](RObj*& ref) {
const ssize_t off = unrolledOffsets[nextOffset];
EXPECT_EQ(&ref, mem::add(robj, off));
EXPECT_EQ((size_t)ref, (off + 1) * sizeof(void*));
++nextOffset;
skipNegativeOffsets(unrolledOffsets, nextOffset);
});
EXPECT_EQ(nextOffset, unrolledOffsets.size());
nextOffset = 0;
skipNegativeOffsets(unrolledOffsets, nextOffset);
t.forEachRef(*robj, [&](RObjOrFakePtr& ref) {
if (ref.isPtr()) {
const ssize_t off = unrolledOffsets[nextOffset];
EXPECT_EQ(&ref, mem::add(robj, off));
EXPECT_EQ((size_t)ref.asPtr(), (off + 1) * sizeof(void*));
++nextOffset;
skipNegativeOffsets(unrolledOffsets, nextOffset);
}
});
EXPECT_EQ(nextOffset, unrolledOffsets.size());
nextOffset = 0;
t.forEachRef(*robj, [&](RObjOrFakePtr& ref) {
const ssize_t off = unrolledOffsets[nextOffset];
EXPECT_EQ(&ref, mem::add(robj, std::abs(off)));
EXPECT_EQ((size_t)ref.sbits(), (off + 1) * sizeof(void*));
++nextOffset;
});
EXPECT_EQ(nextOffset, unrolledOffsets.size());
}
TEST(TypeTest, testType1) {
// Test a simple no-ref structure.
std::vector<ssize_t> refs = {};
auto t = Type::classFactory("TypeTest.testType1", 42, absOffsets(refs));
// classFactory() rounds up the byte size
EXPECT_EQ(t->userByteSize(), (size_t)48);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(RObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::refClass);
EXPECT_FALSE(t->hasRefs());
verifyRefs(*t, refs);
}
TEST(TypeTest, testType2) {
// Test a simple structure with refs.
std::vector<ssize_t> refs = {8 * 0, 8 * 1, -8 * 5, 8 * 8};
auto t = Type::classFactory("TypeTest.testType2", 100, absOffsets(refs));
// classFactory() rounds up the byte size
EXPECT_EQ(t->userByteSize(), (size_t)104);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(RObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::refClass);
EXPECT_TRUE(t->hasRefs());
verifyRefs(*t, refs);
}
TEST(TypeTest, testType3) {
// Test a really big structure with ref gaps big enough to skip mask entries.
std::vector<ssize_t> refs = {8 * 0,
8 * 17,
-8 * 67,
-8 * 82,
8 * 199,
8 * 200,
8 * 201,
8 * 254,
8 * 255,
8 * 256,
8 * 257};
auto t = Type::classFactory("TypeTest.testType3", 8 * 260, absOffsets(refs));
EXPECT_EQ(t->userByteSize(), (size_t)8 * 260);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(RObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::refClass);
EXPECT_TRUE(t->hasRefs());
verifyRefs(*t, refs);
}
TEST(TypeTest, testType4) {
// Test a really big structure with ref gaps big enough to skip mask entries.
std::vector<ssize_t> refs = {2648};
auto t = Type::classFactory("TypeTest.testType4", 6656, absOffsets(refs));
verifyRefs(*t, refs);
}
TEST(TypeTest, testType5) {
std::vector<ssize_t> refs = {-2648};
auto t = Type::classFactory("TypeTest.testType5", 6620, absOffsets(refs));
verifyRefs(*t, refs);
}
// TODO: If we add another GC mask stripe this is a reasonable test:
// TEST(TypeTest, testType6) {
// // Test freeze references
// std::vector<ssize_t> refs = {8*0, 8*8, -8*17, 8*67, 8*70, 8*82, 8*98};
// std::vector<ssize_t> freezeRefs = {8*0, -8*17, 8*70, 8*98};
// auto t = Type::classFactory("TypeTest.testType6", 8*100, absOffsets(refs));
// // Muck with the freeze masks so we can test the freeze slots
// SkipRefMaskType* masks = const_cast<SkipRefMaskType*>(t->refMask());
// masks[0].freezeMask = 0x0000000000020001;
// masks[1].freezeMask = 0x0000000400000040;
// verifyRefs(*t, refs, freezeRefs);
// }
TEST(TypeTest, testArray1) {
// Test an array with no pointers.
std::vector<ssize_t> refs = {};
auto t = Type::arrayFactory("TypeTest.testArray1", 32, absOffsets(refs));
EXPECT_EQ(t->userByteSize(), (size_t)32);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(AObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::array);
EXPECT_FALSE(t->hasRefs());
verifyRefs(*t, refs, 3);
}
TEST(TypeTest, testArray2) {
// Test an array with simple pointers.
std::vector<ssize_t> refs = {8 * 1, 8 * 2};
auto t = Type::arrayFactory("TypeTest.testArray2", 32, absOffsets(refs));
EXPECT_EQ(t->userByteSize(), (size_t)32);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(AObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::array);
EXPECT_TRUE(t->hasRefs());
verifyRefs(*t, refs, 4);
}
TEST(TypeTest, testArray3) {
// Test an array of single pointers.
std::vector<ssize_t> refs = {0};
auto t = Type::arrayFactory("TypeTest.testArray3", 8, absOffsets(refs));
EXPECT_EQ(t->userByteSize(), (size_t)8);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(AObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::array);
EXPECT_TRUE(t->hasRefs());
verifyRefs(*t, refs, 5);
verifyRefs(*t, refs, 63);
verifyRefs(*t, refs, 64);
verifyRefs(*t, refs, 65);
verifyRefs(*t, refs, 127);
verifyRefs(*t, refs, 128);
verifyRefs(*t, refs, 129);
}
TEST(TypeTest, testArray4) {
// Test an array of single pointers.
std::vector<ssize_t> refs = {8 * 0, 8 * 1, 8 * 2};
auto t = Type::arrayFactory("TypeTest.testArray4", 8 * 3, absOffsets(refs));
EXPECT_EQ(t->userByteSize(), (size_t)8 * 3);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(AObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::array);
EXPECT_TRUE(t->hasRefs());
verifyRefs(*t, refs, 5);
verifyRefs(*t, refs, 63);
verifyRefs(*t, refs, 64);
verifyRefs(*t, refs, 65);
verifyRefs(*t, refs, 127);
verifyRefs(*t, refs, 128);
verifyRefs(*t, refs, 129);
}
TEST(TypeTest, testArray5) {
// Test an array of single pointers.
std::vector<ssize_t> refs = {8 * 0, 8 * 32};
auto t = Type::arrayFactory("TypeTest.testArray5", 8 * 33, absOffsets(refs));
EXPECT_EQ(t->userByteSize(), (size_t)8 * 33);
EXPECT_EQ(t->uninternedMetadataByteSize(), sizeof(AObjMetadata));
EXPECT_EQ(t->internedMetadataByteSize(), sizeof(IObjMetadata));
EXPECT_EQ(t->kind(), Type::Kind::array);
EXPECT_TRUE(t->hasRefs());
verifyRefs(*t, refs, 1);
verifyRefs(*t, refs, 2);
verifyRefs(*t, refs, 3);
verifyRefs(*t, refs, 4);
verifyRefs(*t, refs, 5);
}
namespace _testBruteForce {
bool incr(std::vector<size_t>& loc, size_t index, size_t userPtrSize) {
++loc[index];
if (loc[index] == userPtrSize) {
if (index == 0)
return false;
if (!incr(loc, index - 1, userPtrSize - 1))
return false;
loc[index] = loc[index - 1] + 1;
}
return true;
}
TEST(TypeTest, testBruteForce) {
const size_t maxBits = 3;
const size_t userPtrSize = 192;
for (size_t bitCount = 0; bitCount <= maxBits; ++bitCount) {
std::vector<size_t> loc(maxBits);
for (size_t i = 0; i < maxBits; ++i)
loc[i] = i;
std::vector<ssize_t> offsets(maxBits);
while (true) {
for (size_t i = 0; i < maxBits; ++i)
offsets[i] = loc[i] * sizeof(void*);
auto t = Type::classFactory(
"TypeTest.testBruteForce",
userPtrSize * sizeof(void*),
absOffsets(offsets));
verifyRefs(*t, offsets);
if (!incr(loc, maxBits - 1, userPtrSize))
break;
}
}
}
} // namespace _testBruteForce
TEST(TypeTest, testTorture) {
LameRandom random(42);
const auto duration = std::chrono::seconds(3);
const auto start = std::chrono::steady_clock::now();
while (std::chrono::steady_clock::now() - start <= duration) {
size_t userByteSize = random.next(8192) + 1;
std::vector<ssize_t> refs;
while (true) {
size_t skip = (random.next(8192 / sizeof(void*)) + 1) * sizeof(void*);
size_t last = std::abs(refs.empty() ? 0 : refs.back());
if (last + skip + sizeof(void*) > userByteSize)
break;
bool fake = random.next(2) != 0;
refs.push_back((last + skip) * (fake ? -1 : 1));
}
bool array = random.next(2) != 0;
if (array) {
auto t = Type::arrayFactory(
"TypeTest.testTorture(array)",
roundUp(userByteSize, sizeof(void*)),
absOffsets(refs));
verifyRefs(*t, refs, random.next(50));
} else {
auto t = Type::classFactory(
"TypeTest.testTorture(class)", userByteSize, absOffsets(refs));
verifyRefs(*t, refs);
}
}
}
} // anonymous namespace
|
{
"pile_set_name": "Github"
}
|
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:/Users/Vikram/Documents/Android/adt-bundle-windows-x86-20130219/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
|
{
"pile_set_name": "Github"
}
|
#
# Copyright © 2012 - 2020 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
"""Tests for char based quality checks."""
from unittest import TestCase
from weblate.checks.chars import (
BeginNewlineCheck,
BeginSpaceCheck,
DoubleSpaceCheck,
EndColonCheck,
EndEllipsisCheck,
EndExclamationCheck,
EndNewlineCheck,
EndQuestionCheck,
EndSemicolonCheck,
EndSpaceCheck,
EndStopCheck,
EscapedNewlineCountingCheck,
KashidaCheck,
MaxLengthCheck,
NewLineCountCheck,
PunctuationSpacingCheck,
ZeroWidthSpaceCheck,
)
from weblate.checks.tests.test_checks import CheckTestCase, MockUnit
class BeginNewlineCheckTest(CheckTestCase):
check = BeginNewlineCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("\nstring", "\nstring", "")
self.test_failure_1 = ("\nstring", " \nstring", "")
self.test_failure_2 = ("string", "\nstring", "")
class EndNewlineCheckTest(CheckTestCase):
check = EndNewlineCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string\n", "string\n", "")
self.test_failure_1 = ("string\n", "string", "")
self.test_failure_2 = ("string", "string\n", "")
class BeginSpaceCheckTest(CheckTestCase):
check = BeginSpaceCheck()
def setUp(self):
super().setUp()
self.test_good_matching = (" string", " string", "")
self.test_good_ignore = (".", " ", "")
self.test_good_none = (" The ", " ", "")
self.test_failure_1 = (" string", " string", "")
self.test_failure_2 = (" string", " string", "")
class EndSpaceCheckTest(CheckTestCase):
check = EndSpaceCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string ", "string ", "")
self.test_good_ignore = (".", " ", "")
self.test_good_none = (" The ", " ", "")
self.test_failure_1 = ("string ", "string", "")
self.test_failure_2 = ("string", "string ", "")
class DoubleSpaceCheckTest(CheckTestCase):
check = DoubleSpaceCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string string", "string string", "")
self.test_good_ignore = (" ", " ", "")
self.test_failure_1 = ("string string", "string string", "")
class EndStopCheckTest(CheckTestCase):
check = EndStopCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string.", "string.", "")
self.test_good_ignore = (".", " ", "")
self.test_failure_1 = ("string.", "string", "")
self.test_failure_2 = ("string", "string.", "")
def test_japanese(self):
self.do_test(False, ("Text:", "Text。", ""), "ja")
self.do_test(True, ("Text:", "Text", ""), "ja")
def test_hindi(self):
self.do_test(False, ("Text.", "Text।", ""), "hi")
self.do_test(True, ("Text.", "Text", ""), "hi")
def test_armenian(self):
self.do_test(False, ("Text:", "Text`", ""), "hy")
self.do_test(False, ("Text:", "Text՝", ""), "hy")
self.do_test(True, ("Text.", "Text", ""), "hy")
class EndColonCheckTest(CheckTestCase):
check = EndColonCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string:", "string:", "")
self.test_failure_1 = ("string:", "string", "")
self.test_failure_2 = ("string", "string:", "")
def test_hy(self):
self.do_test(False, ("Text:", "Texte՝", ""), "hy")
self.do_test(True, ("Text:", "Texte", ""), "hy")
self.do_test(False, ("Text", "Texte:", ""), "hy")
def test_japanese(self):
self.do_test(False, ("Text:", "Texte。", ""), "ja")
def test_japanese_ignore(self):
self.do_test(False, ("Text", "Texte", ""), "ja")
class EndQuestionCheckTest(CheckTestCase):
check = EndQuestionCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string?", "string?", "")
self.test_failure_1 = ("string?", "string", "")
self.test_failure_2 = ("string", "string?", "")
def test_hy(self):
self.do_test(False, ("Text?", "Texte՞", ""), "hy")
self.do_test(True, ("Text?", "Texte", ""), "hy")
self.do_test(False, ("Text", "Texte?", ""), "hy")
def test_greek(self):
self.do_test(False, ("Text?", "Texte;", ""), "el")
self.do_test(False, ("Text?", "Texte;", ""), "el")
def test_greek_ignore(self):
self.do_test(False, ("Text", "Texte", ""), "el")
def test_greek_wrong(self):
self.do_test(True, ("Text?", "Texte", ""), "el")
class EndExclamationCheckTest(CheckTestCase):
check = EndExclamationCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string!", "string!", "")
self.test_failure_1 = ("string!", "string", "")
self.test_failure_2 = ("string", "string!", "")
def test_hy(self):
self.do_test(False, ("Text!", "Texte՜", ""), "hy")
self.do_test(False, ("Text!", "Texte", ""), "hy")
self.do_test(False, ("Text", "Texte!", ""), "hy")
def test_eu(self):
self.do_test(False, ("Text!", "¡Texte!", ""), "eu")
class EndEllipsisCheckTest(CheckTestCase):
check = EndEllipsisCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string…", "string…", "")
self.test_failure_1 = ("string…", "string...", "")
self.test_failure_2 = ("string.", "string…", "")
self.test_failure_3 = ("string..", "string…", "")
def test_translate(self):
self.do_test(False, ("string...", "string…", ""))
class EscapedNewlineCountingCheckTest(CheckTestCase):
check = EscapedNewlineCountingCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string\\nstring", "string\\nstring", "")
self.test_failure_1 = ("string\\nstring", "string\\n\\nstring", "")
self.test_failure_2 = ("string\\n\\nstring", "string\\nstring", "")
class NewLineCountCheckTest(CheckTestCase):
check = NewLineCountCheck()
def setUp(self):
super().setUp()
self.test_single_good_matching = ("string\n\nstring", "string\n\nstring", "")
self.test_failure_1 = ("string\nstring", "string\n\n\nstring", "")
self.test_failure_2 = ("string\nstring\n\nstring", "string\nstring\nstring", "")
class ZeroWidthSpaceCheckTest(CheckTestCase):
check = ZeroWidthSpaceCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("str\u200bing", "str\u200bing", "")
self.test_good_none = ("str\u200bing", "string", "")
self.test_failure_1 = ("string", "str\u200bing", "")
class MaxLengthCheckTest(TestCase):
def setUp(self):
self.check = MaxLengthCheck()
self.test_good_matching = ("strings", "less than 21", "max-length:12")
self.test_good_matching_unicode = ("strings", "less than 21", "max-length:12")
def test_check(self):
self.assertFalse(
self.check.check_target(
[self.test_good_matching[0]],
[self.test_good_matching[1]],
MockUnit(flags=self.test_good_matching[2]),
)
)
def test_unicode_check(self):
self.assertFalse(
self.check.check_target(
[self.test_good_matching_unicode[0]],
[self.test_good_matching_unicode[1]],
MockUnit(flags=self.test_good_matching_unicode[2]),
)
)
def test_failure_check(self):
self.assertTrue(
self.check.check_target(
[self.test_good_matching[0]],
[self.test_good_matching[1]],
MockUnit(flags="max-length:10"),
)
)
def test_failure_unicode_check(self):
self.assertTrue(
self.check.check_target(
[self.test_good_matching_unicode[0]],
[self.test_good_matching_unicode[1]],
MockUnit(flags="max-length:10"),
)
)
def test_replace_check(self):
self.assertFalse(
self.check.check_target(
["hi %s"],
["ahoj %s"],
MockUnit(flags="max-length:10"),
)
)
self.assertTrue(
self.check.check_target(
["hi %s"],
["ahoj %s"],
MockUnit(flags='max-length:10, replacements:%s:"very long text"'),
)
)
class EndSemicolonCheckTest(CheckTestCase):
check = EndSemicolonCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string;", "string;", "")
self.test_failure_1 = ("string;", "string", "")
self.test_failure_2 = ("string:", "string;", "")
self.test_failure_3 = ("string", "string;", "")
def test_greek(self):
self.do_test(False, ("Text?", "Texte;", ""), "el")
class KashidaCheckTest(CheckTestCase):
check = KashidaCheck()
def setUp(self):
super().setUp()
self.test_good_matching = ("string", "string", "")
self.test_failure_1 = ("string", "string\u0640", "")
self.test_failure_2 = ("string", "string\uFE79", "")
self.test_failure_3 = ("string", "string\uFE7F", "")
class PunctuationSpacingCheckTest(CheckTestCase):
check = PunctuationSpacingCheck()
default_lang = "fr"
def setUp(self):
super().setUp()
self.test_good_matching = (
"string? string! string: string;",
"string ? string\u202F! string ; string\u00A0:",
"",
)
self.test_good_none = (
"string &end; http://example.com",
"string &end; & http://example.com",
"",
)
self.test_failure_1 = ("string", "string!", "")
self.test_failure_2 = ("string", "string\u00A0? string;", "")
self.test_failure_3 = ("string", "string\u00A0; string?", "")
def test_fr_ca(self):
self.do_test(True, ("string", "string!", ""), "fr")
self.do_test(False, ("string", "string!", ""), "fr_CA")
|
{
"pile_set_name": "Github"
}
|
package org.w3c.files;
// Downloaded from https://raw.githubusercontent.com/w3c/FileAPI/gh-pages/index.html
[Constructor(optional sequence<BlobPart> blobParts, optional BlobPropertyBag options),
Exposed=(Window,Worker)]
interface Blob {
readonly attribute unsigned long long size;
readonly attribute DOMString type;
readonly attribute boolean isClosed;
//slice Blob into byte-ranged chunks
Blob slice([Clamp] optional long long start,
[Clamp] optional long long end,
optional DOMString contentType);
void close();
};
dictionary BlobPropertyBag {
DOMString type = "";
};
typedef (BufferSource or Blob or USVString) BlobPart;
[Constructor(sequence<BlobPart> fileBits,
[EnsureUTF16] DOMString fileName,
optional FilePropertyBag options),
Exposed=(Window,Worker)]
interface File : Blob {
readonly attribute DOMString name;
readonly attribute long long lastModified;
};
dictionary FilePropertyBag : BlobPropertyBag {
long long lastModified;
};
[Exposed=(Window,Worker)]
interface FileList {
getter File? item(unsigned long index);
readonly attribute unsigned long length;
};
[Constructor, Exposed=(Window,Worker)]
interface FileReader: EventTarget {
// async read methods
void readAsArrayBuffer(Blob blob);
void readAsBinaryString(Blob blob);
void readAsText(Blob blob, optional DOMString label);
void readAsDataURL(Blob blob);
void abort();
// states
const unsigned short EMPTY = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;
// File or Blob data
readonly attribute (DOMString or ArrayBuffer)? result;
readonly attribute DOMError? error;
// event handler content attributes
attribute EventHandler onloadstart;
attribute EventHandler onprogress;
attribute EventHandler onload;
attribute EventHandler onabort;
attribute EventHandler onerror;
attribute EventHandler onloadend;
};
[Constructor, Exposed=Worker]
interface FileReaderSync {
// Synchronously return strings
ArrayBuffer readAsArrayBuffer(Blob blob);
DOMString readAsBinaryString(Blob blob);
DOMString readAsText(Blob blob, optional DOMString label);
DOMString readAsDataURL(Blob blob);
};
[Exposed=(Window,DedicatedWorker,SharedWorker)]
partial interface URL {
static DOMString createObjectURL(Blob blob);
static DOMString createFor(Blob blob);
static void revokeObjectURL(DOMString url);
};
[Constructor(optional sequence<BlobPart> blobParts, optional BlobPropertyBag options),
Exposed=(Window,Worker)]
interface Blob {
readonly attribute unsigned long long size;
readonly attribute DOMString type;
readonly attribute boolean isClosed;
//slice Blob into byte-ranged chunks
Blob slice([Clamp] optional long long start,
[Clamp] optional long long end,
optional DOMString contentType);
void close();
};
dictionary BlobPropertyBag {
DOMString type = "";
};
typedef (BufferSource or Blob or USVString) BlobPart;
[Constructor(sequence<BlobPart> fileBits,
[EnsureUTF16] DOMString fileName,
optional FilePropertyBag options),
Exposed=(Window,Worker)]
interface File : Blob {
readonly attribute DOMString name;
readonly attribute long long lastModified;
};
dictionary FilePropertyBag : BlobPropertyBag {
long long lastModified;
};
[Exposed=(Window,Worker)]
interface FileList {
getter File? item(unsigned long index);
readonly attribute unsigned long length;
};
[Constructor, Exposed=(Window,Worker)]
interface FileReader: EventTarget {
// async read methods
void readAsArrayBuffer(Blob blob);
void readAsBinaryString(Blob blob);
void readAsText(Blob blob, optional DOMString label);
void readAsDataURL(Blob blob);
void abort();
// states
const unsigned short EMPTY = 0;
const unsigned short LOADING = 1;
const unsigned short DONE = 2;
readonly attribute unsigned short readyState;
// File or Blob data
readonly attribute (DOMString or ArrayBuffer)? result;
readonly attribute DOMError? error;
// event handler content attributes
attribute EventHandler onloadstart;
attribute EventHandler onprogress;
attribute EventHandler onload;
attribute EventHandler onabort;
attribute EventHandler onerror;
attribute EventHandler onloadend;
};
[Constructor, Exposed=Worker]
interface FileReaderSync {
// Synchronously return strings
ArrayBuffer readAsArrayBuffer(Blob blob);
DOMString readAsBinaryString(Blob blob);
DOMString readAsText(Blob blob, optional DOMString label);
DOMString readAsDataURL(Blob blob);
};
[Exposed=(Window,DedicatedWorker,SharedWorker)]
partial interface URL {
static DOMString createObjectURL(Blob blob);
static DOMString createFor(Blob blob);
static void revokeObjectURL(DOMString url);
};
|
{
"pile_set_name": "Github"
}
|
<?php
$strings['plugin_title'] = 'Google Maps';
$strings['plugin_comment'] = 'Enable the functionality to show google maps';
$strings['extra_field_name_help'] = "Enter one or many extra user fields name separated by a comma (,) from which you want to obtain the locations, you can get up to 5 geolocation fields (the rest will be ignored) which will be marked with the following icons respectively:
<br><br>
<img src='//maps.google.com/mapfiles/ms/icons/red-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/blue-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/green-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/yellow-dot.png'> <img src='//maps.google.com/mapfiles/ms/icons/purple-dot.png'>
<br><br>
Follow the link below to see the map : <a href='".api_get_path(WEB_PLUGIN_PATH)."google_maps/src/map_coordinates.php'>".api_get_path(WEB_PLUGIN_PATH).'google_maps/src/map_coordinates.php</a>';
$strings['enable_api'] = 'Enable API';
$strings['api_key'] = 'Api Key';
$strings['extra_field_name'] = 'Extra field name';
$strings['UsersCoordinatesMap'] = 'Users location Map';
|
{
"pile_set_name": "Github"
}
|
# 现实可以有多美好?
## 作者: 张晓斐 赞同: 26
十八岁的那一年,高考成绩出来,加上在之前拿到的自主招生加分,幸运了进去了某所985高校读书,之所以说是幸运,是因为学校录取分与专业录取分都刚刚比自己的成绩高
一分,然后又在选专业的过程当中,又到自主招生政策保护,进入本学院最好专业入读。
从高二开始,就喜欢一个女孩儿,视她为学习上的目标,进而慢慢对她有了依赖,有了情感,发展成为喜欢,可是一直没有追上,大学有幸报了同一所大学,当然完全是巧合,同
学校不是同一个校区,但是那份炽热的感情得以延续。
之所以说是炽热,是因为当时的年纪,爱的死去活来。新生开学后的一个月,是她的生日,鲜花,蛋糕,朋友的祝福。往后的每一个节日,总是会孤零零的跑去她的校区,死活让
她收下自己买的东西。数次表白,各种被拒,仍不死心。
一次次的拧着自己,钻牛角尖,质问自己为什么追不上!!生活也陷入了同样的怪圈,事事拧着自己,顶着脑门横冲直撞。生活乱套了,整个人则全乱了。
从来一帆风顺的我开始遇到挫折,学习成绩永远在挂课的边缘,足球场上开始状态迷失,每天起床之后就是一副混混僵僵的样子。开始没有自信,自暴自弃。
生活渴望寻求改变,从大二下开始,就强制自己不再联系,到了大三上,一次偶然的机会,我们两个都带着自己的小伙伴回到一同的家乡,短暂几天快乐的玩耍,让我顿时又燃起
了那颗躁动的心,她的感觉也来的如此之快,瞬间我们俩就突然在一起了。
痛苦的半年,散也散的很突然。在那一刻,回望过去的三年,觉得自己什么都没有了,曾经引以为傲的那些东西,优秀的成绩,健硕的身体,开朗的性格,自信的心态,当然还有
爱情的希望。全都消失了,一贫如洗。
紧接而来的考研是苦行僧一般的半年,那种感觉就是自己一无所有了,然后重新从地下捡起一点点原材料,试着一步步加工出来自己内心所渴望的那些东西,艰难,漫长但是觉得
很幸福。
考研不出意料的失败了,不过并没有觉得自己跌落更深的深渊,而是突然发现,内心平静而又那么充实。开始尝试静下心来做些自己喜欢做的事情。去健身,身体开始恢复,从1
60减肥到了140,精神状态开始变好。然后找工作,尝试从最差的开始,一个个开始挑战,全部拿到offer,最终拿到最心仪企业的录入书。
然后她出现了,毫无预兆,就突然有一天我们两个进去了对方的世界,朋友的介绍网上短暂聊了十天,感觉好好,见面,牵手,表白。我觉得这是我一辈子做的最果断最明智的决
定。遇到她了,就紧紧抓住了,后来我跟她说,我觉得以前遭受的所有苦难,都是为了很好的提升自己,直到遇到你。
遇到她之后,我说我变了,她说她知道,看以前我的照片,她说我眼神中根本无光,现在的我,充满自信,眼神发亮。
现在的我过的好幸福,很知足。感谢幸福来的那么措手不及,却又让我觉得那么倍感珍惜。当然现在的我总包含那么一股子精神劲儿,你来了,我就抓紧你,不让你走了,我得做
好自己,未来的日子给你幸福。
#### 原链接: http://www.zhihu.com/question/24269892/answer/27386055
|
{
"pile_set_name": "Github"
}
|
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Operations for bucketing data into groups.
The classes and functions in this module are used to queue up data into
buckets conditional on side information (e.g. sequence length).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import errors
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_util
from tensorflow.python.layers import utils
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import data_flow_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.summary import summary
from tensorflow.python.training import input as input_py
from tensorflow.python.training import queue_runner
# pylint: disable=protected-access
_as_original_type = input_py._as_original_type
_as_tensor_list = input_py._as_tensor_list
_restore_sparse_tensors = input_py._restore_sparse_tensors
_dtypes = input_py._dtypes
_store_sparse_tensors = input_py._store_sparse_tensors
_validate_keep_input = input_py._validate_keep_input
_shapes = input_py._shapes
_which_queue = input_py._which_queue
# pylint: enable=protected-access
def _validate_bucket(tensor_list):
tensor_list = ops.convert_n_to_tensor_or_indexed_slices(tensor_list)
if not tensor_list:
raise ValueError("Expected at least one tensor in bucket().")
return tensor_list
def bucket(tensors,
which_bucket,
batch_size,
num_buckets,
num_threads=1,
capacity=32,
bucket_capacities=None,
shapes=None,
dynamic_pad=False,
allow_smaller_final_batch=False,
keep_input=True,
shared_name=None,
name=None):
"""Lazy bucketing of input tensors according to `which_bucket`.
The argument `tensors` can be a list or a dictionary of tensors.
The value returned by the function will be of the same type
as `tensors`.
The tensors entering this function are put into the bucket given by
`which_bucket`. Each bucket has its own queue. When a bucket contains
`batch_size` elements, this minibatch is pushed onto a top queue. The
tensors returned from this function are a the result of dequeueing the
next minibatch from this top queue.
This function is implemented using several queues. A `QueueRunner` for the
queues is added to the current `Graph`'s `QUEUE_RUNNER` collection.
As the returned tensors are the result of a dequeue operation, evaluating
them will throw a `tf.errors.OutOfRangeError` when the input queue is
exhausted. If these tensors are feeding another input queue, its queue runner
will catch this exception, however, if they are used in your main thread
you are responsible for catching this yourself.
*N.B.:* If `dynamic_pad` is `False`, you must ensure that either
(i) the `shapes` argument is passed, or (ii) all of the tensors in
`tensors` must have fully-defined shapes. `ValueError` will be
raised if neither of these conditions holds.
If `dynamic_pad` is `True`, it is sufficient that the *rank* of the
tensors is known, but individual dimensions may have shape `None`.
In this case, for each enqueue the dimensions with value `None`
may have a variable length; upon dequeue, the output tensors will be padded
on the right to the maximum shape of the tensors in the current minibatch.
For numbers, this padding takes value 0. For strings, this padding is
the empty string. See `PaddingFIFOQueue` for more info.
If `allow_smaller_final_batch` is `True`, a smaller batch value than
`batch_size` is returned when the queues are closed and there are not enough
elements to fill the batch, otherwise the pending elements are discarded.
In addition, all output tensors' static shapes, as accessed via the
`get_shape()` method will have a 0th `Dimension` value of `None`, and
operations that depend on fixed batch_size would fail.
Args:
tensors: The list or dictionary of tensors, representing a single element,
to bucket. Nested lists are not supported.
which_bucket: An `int32` scalar Tensor taking a value in `[0, num_buckets)`.
batch_size: The new batch size pulled from the queue (all queues will have
the same size). If a list is passed in then each bucket will have a
different batch_size.
(python int, int32 scalar or iterable of integers of length num_buckets).
num_buckets: A python integer, the number of buckets.
num_threads: An integer. The number of threads enqueuing `tensors`.
capacity: An integer. The maximum number of minibatches in the top queue,
and also (by default) the maximum number of elements within each bucket.
bucket_capacities: (Optional) None or a list of integers, the capacities of
each bucket. If None, capacity is used (default). If specified, it must
be a list of integers of length num_buckets: the i-th element is used
as capacity for the i-th bucket queue.
shapes: (Optional) The shapes for each example. Defaults to the
inferred shapes for `tensors`.
dynamic_pad: Boolean. Allow variable dimensions in input shapes.
The given dimensions are padded upon dequeue so that tensors within a
batch have the same shapes.
allow_smaller_final_batch: (Optional) Boolean. If `True`, allow the final
batches to be smaller if there are insufficient items left in the queues.
keep_input: A `bool` scalar Tensor. If provided, this tensor controls
whether the input is added to the queue or not. If it evaluates `True`,
then `tensors` are added to the bucket; otherwise they are dropped. This
tensor essentially acts as a filtering mechanism.
shared_name: (Optional). If set, the queues will be shared under the given
name across multiple sessions.
name: (Optional) A name for the operations.
Returns:
A tuple `(bucket, outputs)` where `bucket` is
a `int32` scalar tensor and `outputs` is a list or
dictionary of batched outputs corresponding to elements of `tensors`.
Every step will receive a new bucket of outputs.
Raises:
ValueError: If the `shapes` are not specified, and cannot be
inferred from the elements of `tensors` or if batch_size is a sequence
but its length != num_buckets. Also if bucket_capacities is not None but
its length != num_buckets.
"""
batch_size_per_bucket = False
if isinstance(batch_size, (list, tuple)):
batch_size_per_bucket = True
if len(batch_size) != num_buckets:
raise ValueError(
"If batch_size is a list it must have num_buckets elements")
else:
batch_size = [batch_size] * num_buckets
if bucket_capacities is None:
bucket_capacities = [capacity] * num_buckets
if len(bucket_capacities) != num_buckets:
raise ValueError(
"The list bucket_capacities (%s) must have exactly num_buckets (%d) "
"elements." % (str(bucket_capacities), num_buckets))
tensor_list = _as_tensor_list(tensors)
with ops.name_scope(name, "bucket", tensor_list) as name:
tensor_list = _validate_bucket(tensor_list)
keep_input = _validate_keep_input(keep_input, enqueue_many=False)
(tensor_list, sparse_info) = _store_sparse_tensors(
tensor_list, enqueue_many=False, keep_input=keep_input)
# Round-trip batch_size to a tensor, and possibly back
for i, bucket_batch_size in enumerate(batch_size):
bucket_batch_size = ops.convert_to_tensor(
bucket_batch_size, dtype=dtypes.int32, name="batch_size")
static_batch_size = tensor_util.constant_value(bucket_batch_size)
batch_size[i] = (static_batch_size if static_batch_size is not None else
bucket_batch_size)
types = _dtypes([tensor_list])
shapes = _shapes([tensor_list], shapes, enqueue_many=False)
which_bucket = ops.convert_to_tensor(
which_bucket, dtype=dtypes.int32, name="which_bucket")
queue_creator = _which_queue(dynamic_pad)
bucket_queues = []
for i in range(num_buckets):
shared_name_i = ("%s_%d" % (shared_name, i) if shared_name is not None
else None)
bucket_queues.append(
queue_creator(
capacity=bucket_capacities[i],
dtypes=types,
shapes=shapes,
shared_name=shared_name_i,
name="bucket_queue_%d" % i))
maybe_static_batch_size = (
None if (allow_smaller_final_batch or batch_size_per_bucket)
else static_batch_size)
bucket_shapes = [
tensor_shape.vector(maybe_static_batch_size).concatenate(s)
for s in bucket_queues[0].shapes
]
# top_queue is a PaddingFIFOQueue even if the bucket queues are regular FIFO
# queues because if we use allow_smaller_final_batch, shapes will
# contain Nones in their first entry; as a result, a regular
# FIFOQueue would die when being passed shapes that are not fully defined.
top_queue = data_flow_ops.PaddingFIFOQueue(
capacity=capacity,
dtypes=[dtypes.int32] + types,
shapes=[tensor_shape.scalar()] + bucket_shapes,
shared_name=shared_name,
name="top_queue")
def enqueue_which():
"""Return an op that enqueues conditionally in one of the queues."""
def enqueue_single(i):
return bucket_queues[i].enqueue(tensor_list)
enqueues = [
control_flow_ops.cond(
math_ops.equal(which_bucket, i),
functools.partial(enqueue_single, i), control_flow_ops.no_op)
for i in range(num_buckets)
]
return control_flow_ops.group(*enqueues, name="group_enqueues")
maybe_enqueue = utils.smart_cond(
keep_input,
enqueue_which,
control_flow_ops.no_op)
bucket_enqueue_ops = [maybe_enqueue] * num_threads
if allow_smaller_final_batch:
which_dequeue = lambda q: q.dequeue_up_to
else:
which_dequeue = lambda q: q.dequeue_many
def make_list(t):
if isinstance(t, (list, tuple)):
return t
else:
return [t]
enqueues_to_top = [
top_queue.enqueue(
[constant_op.constant(i)] + make_list(which_dequeue(q)(
bs, name="read_bucket_%d" % i)),
name="enqueue_from_bucket_%d" % i)
for i, (q, bs) in enumerate(zip(bucket_queues, batch_size))
]
queue_runner.add_queue_runner(
queue_runner.QueueRunner(
bucket_queues[0], enqueues_to_top,
close_op=top_queue.close(),
cancel_op=top_queue.close(cancel_pending_enqueues=True),
queue_closed_exception_types=(errors.OutOfRangeError,
errors.CancelledError)))
queue_runner.add_queue_runner(
queue_runner.QueueRunner(
top_queue,
bucket_enqueue_ops,
close_op=control_flow_ops.group(
*[q.close() for q in bucket_queues]),
cancel_op=control_flow_ops.group(
*[q.close(cancel_pending_enqueues=True)
for q in bucket_queues]),
queue_closed_exception_types=(errors.OutOfRangeError,
errors.CancelledError)))
for q in bucket_queues:
summary.scalar("bucket/%s/size" % q.name,
math_ops.cast(top_queue.size(), dtypes.float32))
summary.scalar("bucket/%s/fraction_of_%d_full" % (top_queue.name, capacity),
math_ops.cast(top_queue.size(), dtypes.float32) *
(1. / capacity))
dequeued = top_queue.dequeue(name="dequeue_top")
which_bucket_dequeued = dequeued[0]
dequeued = dequeued[1:]
if len(dequeued) == 1:
dequeued = dequeued[0]
dequeued = _restore_sparse_tensors(dequeued, sparse_info)
return (which_bucket_dequeued, _as_original_type(tensors, dequeued))
def bucket_by_sequence_length(input_length,
tensors,
batch_size,
bucket_boundaries,
num_threads=1,
capacity=32,
bucket_capacities=None,
shapes=None,
dynamic_pad=False,
allow_smaller_final_batch=False,
keep_input=True,
shared_name=None,
name=None):
"""Lazy bucketing of inputs according to their length.
This method calls `tf.contrib.training.bucket` under the hood, after first
subdividing the bucket boundaries into separate buckets and identifying which
bucket the given `input_length` belongs to. See the documentation for
`which_bucket` for details of the other arguments.
Args:
input_length: `int32` scalar `Tensor`, the sequence length of tensors.
tensors: The list or dictionary of tensors, representing a single element,
to bucket. Nested lists are not supported.
batch_size: The new batch size pulled from the queue (all queues will have
the same size). If a list is passed in then each bucket will have a
different batch_size.
(python int, int32 scalar or iterable of integers of length num_buckets).
bucket_boundaries: int list, increasing non-negative numbers.
The edges of the buckets to use when bucketing tensors. Two extra buckets
are created, one for `input_length < bucket_boundaries[0]` and
one for `input_length >= bucket_boundaries[-1]`.
num_threads: An integer. The number of threads enqueuing `tensors`.
capacity: An integer. The maximum number of minibatches in the top queue,
and also the maximum number of elements within each bucket.
bucket_capacities: (Optional) None or a list of integers, the capacities of
each bucket. If None, capacity is used (default). If specified, it must
be a list of integers of length one larger than bucket_boundaries.
Its i-th element is used as capacity for the i-th bucket queue.
shapes: (Optional) The shapes for each example. Defaults to the
inferred shapes for `tensors`.
dynamic_pad: Boolean. Allow variable dimensions in input shapes.
The given dimensions are padded upon dequeue so that tensors within a
batch have the same shapes.
allow_smaller_final_batch: (Optional) Boolean. If `True`, allow the final
batches to be smaller if there are insufficient items left in the queues.
keep_input: A `bool` scalar Tensor. If provided, this tensor controls
whether the input is added to the queue or not. If it evaluates `True`,
then `tensors` are added to the bucket; otherwise they are dropped. This
tensor essentially acts as a filtering mechanism.
shared_name: (Optional). If set, the queues will be shared under the given
name across multiple sessions.
name: (Optional) A name for the operations.
Returns:
A tuple `(sequence_length, outputs)` where `sequence_length` is
a 1-D `Tensor` of size `batch_size` and `outputs` is a list or dictionary
of batched, bucketed, outputs corresponding to elements of `tensors`.
Raises:
TypeError: if `bucket_boundaries` is not a list of python integers.
ValueError: if `bucket_boundaries` is empty or contains non-increasing
values or if batch_size is a list and it's length doesn't equal the number
of buckets.
"""
tensor_list = _as_tensor_list(tensors)
if not isinstance(bucket_boundaries, (list, tuple)):
raise TypeError(
"bucket_boundaries must be a list or tuple, but received: %s" %
bucket_boundaries)
if not bucket_boundaries:
raise ValueError("bucket_boundaries must not be empty")
for (s, e) in zip(bucket_boundaries[:-1], bucket_boundaries[1:]):
if not isinstance(s, int) or not isinstance(e, int):
raise TypeError("bucket boundaries must be integers, but saw: %s and %s" %
(s, e))
if s >= e:
raise ValueError(
"Buckets must contain sequential increasing lengths, but saw: "
"%d before %d" % (s, e))
with ops.name_scope(name, "bucket_by_sequence_length",
[input_length] + tensor_list) as name:
input_length = ops.convert_to_tensor(
input_length, dtype=dtypes.int32, name="input_length")
# Bucketing conditions are:
# l < b[0]
# b[0] <= l < b[1]
# b[1] <= l < b[2]
# ...
# b[N-2] <= l < b[N-1]
# b[N-1] <= l
# Equivalent to:
# [-inf, b[0], b[1], ..., b[N-1]] <= l < [b[0], b[1], ..., b[N-1], inf]
buckets_min = [np.iinfo(np.int32).min] + list(bucket_boundaries)
buckets_max = list(bucket_boundaries) + [np.iinfo(np.int32).max]
conditions_c = math_ops.logical_and(
math_ops.less_equal(buckets_min, input_length),
math_ops.less(input_length, buckets_max))
which_bucket = math_ops.reduce_min(array_ops.where(conditions_c))
which_bucket = math_ops.to_int32(which_bucket)
if shapes is not None:
shapes = [tensor_shape.scalar()] + shapes
_, dequeued = bucket(
tensors=[input_length] + tensor_list,
which_bucket=which_bucket,
batch_size=batch_size,
num_buckets=len(bucket_boundaries) + 1,
num_threads=num_threads,
capacity=capacity,
bucket_capacities=bucket_capacities,
shapes=shapes,
dynamic_pad=dynamic_pad,
allow_smaller_final_batch=allow_smaller_final_batch,
keep_input=keep_input,
shared_name=shared_name)
return (dequeued[0], _as_original_type(tensors, dequeued[1:]))
__all__ = ["bucket", "bucket_by_sequence_length"]
|
{
"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 `number` mod in crate `core_foundation_sys`."><meta name="keywords" content="rust, rustlang, rust-lang, number"><title>core_foundation_sys::number - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><p class='location'>Module number</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#statics">Statics</a></li><li><a href="#functions">Functions</a></li><li><a href="#types">Type Definitions</a></li></ul></div><p class='location'><a href='../index.html'>core_foundation_sys</a></p><script>window.sidebarCurrent = {name: 'number', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><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"><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><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 class='srclink' href='../../src/core_foundation_sys/number.rs.html#10-59' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>core_foundation_sys</a>::<wbr><a class="mod" href=''>number</a></span></h1><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table>
<tr class=' module-item'>
<td><a class="struct" href="struct.__CFBoolean.html"
title='struct core_foundation_sys::number::__CFBoolean'>__CFBoolean</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="struct" href="struct.__CFNumber.html"
title='struct core_foundation_sys::number::__CFNumber'>__CFNumber</a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='statics' class='section-header'><a href="#statics">Statics</a></h2>
<table>
<tr class=' module-item'>
<td><a class="static" href="static.kCFBooleanFalse.html"
title='static core_foundation_sys::number::kCFBooleanFalse'>kCFBooleanFalse</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="static" href="static.kCFBooleanTrue.html"
title='static core_foundation_sys::number::kCFBooleanTrue'>kCFBooleanTrue</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="static" href="static.kCFNumberFloat64Type.html"
title='static core_foundation_sys::number::kCFNumberFloat64Type'>kCFNumberFloat64Type</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="static" href="static.kCFNumberSInt32Type.html"
title='static core_foundation_sys::number::kCFNumberSInt32Type'>kCFNumberSInt32Type</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="static" href="static.kCFNumberSInt64Type.html"
title='static core_foundation_sys::number::kCFNumberSInt64Type'>kCFNumberSInt64Type</a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
<table>
<tr class=' module-item'>
<td><a class="fn" href="fn.CFBooleanGetTypeID.html"
title='fn core_foundation_sys::number::CFBooleanGetTypeID'>CFBooleanGetTypeID</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="fn" href="fn.CFNumberCreate.html"
title='fn core_foundation_sys::number::CFNumberCreate'>CFNumberCreate</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="fn" href="fn.CFNumberGetTypeID.html"
title='fn core_foundation_sys::number::CFNumberGetTypeID'>CFNumberGetTypeID</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="fn" href="fn.CFNumberGetValue.html"
title='fn core_foundation_sys::number::CFNumberGetValue'>CFNumberGetValue</a><a title='unsafe function' href='#'><sup>⚠</sup></a></td>
<td class='docblock-short'>
</td>
</tr></table><h2 id='types' class='section-header'><a href="#types">Type Definitions</a></h2>
<table>
<tr class=' module-item'>
<td><a class="type" href="type.CFBooleanRef.html"
title='type core_foundation_sys::number::CFBooleanRef'>CFBooleanRef</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="type" href="type.CFNumberRef.html"
title='type core_foundation_sys::number::CFNumberRef'>CFNumberRef</a></td>
<td class='docblock-short'>
</td>
</tr>
<tr class=' module-item'>
<td><a class="type" href="type.CFNumberType.html"
title='type core_foundation_sys::number::CFNumberType'>CFNumberType</a></td>
<td class='docblock-short'>
</td>
</tr></table></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><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</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> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../../";window.currentCrate = "core_foundation_sys";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>
|
{
"pile_set_name": "Github"
}
|
h = 0.1;
Point(1) = {-0.4, -0.4, 0, h};
Point(2) = {8.300000000000001, -0.4, 0, h};
Point(3) = {8.300000000000001, 2.4, 0, h};
Point(4) = {-0.4, 2.4, 0, h};
Point(30) = {0, 0, 0, h};
Point(31) = {0.2, 0, 0, h};
Point(32) = {0.2, 0.9, 0, h};
Point(33) = {0.8, 0.9, 0, h};
Point(34) = {0.8, 1.1, 0, h};
Point(35) = {0.2, 1.1, 0, h};
Point(36) = {0.2, 1.8, 0, h};
Point(37) = {1, 1.8, 0, h};
Point(38) = {1, 2, 0, h};
Point(39) = {0, 2, 0, h};
Point(40) = {1.4, 0, 0, h};
Point(41) = {2.4, 0, 0, h};
Point(42) = {2.4, 0.2, 0, h};
Point(43) = {1.6, 0.2, 0, h};
Point(44) = {1.6, 0.9, 0, h};
Point(45) = {2, 0.9, 0, h};
Point(46) = {2, 1.1, 0, h};
Point(47) = {1.6, 1.1, 0, h};
Point(48) = {1.6, 1.8, 0, h};
Point(49) = {2.4, 1.8, 0, h};
Point(50) = {2.4, 2, 0, h};
Point(51) = {1.4, 2, 0, h};
Point(52) = {2.8, 0, 0, h};
Point(53) = {3.8, 0, 0, h};
Point(54) = {3.8, 0.2, 0, h};
Point(55) = {3, 0.2, 0, h};
Point(56) = {3, 0.9, 0, h};
Point(57) = {3.4, 0.9, 0, h};
Point(58) = {3.4, 1.1, 0, h};
Point(59) = {3, 1.1, 0, h};
Point(60) = {3, 1.8, 0, h};
Point(61) = {3.8, 1.8, 0, h};
Point(62) = {3.8, 2, 0, h};
Point(63) = {2.8, 2, 0, h};
Point(64) = {4.2, 0, 0, h};
Point(65) = {5.2, 0, 0, h};
Point(66) = {5.2, 0.2, 0, h};
Point(67) = {4.4, 0.2, 0, h};
Point(74) = {4.4, 2, 0, h};
Point(75) = {4.2, 2, 0, h};
Point(80) = {5.6, 0.6, 0, h};
Point(81) = {6, 0.6, 0, h};
Point(82) = {6, 0.2, 0, h};
Point(83) = {6.199999999999999, 0.2, 0, h};
Point(84) = {6.199999999999999, 0.6, 0, h};
Point(85) = {6.6, 0.6, 0, h};
Point(86) = {6.6, 0.8, 0, h};
Point(87) = {6.199999999999999, 0.8, 0, h};
Point(88) = {6.199999999999999, 1.2, 0, h};
Point(89) = {6, 1.2, 0, h};
Point(90) = {6, 0.8, 0, h};
Point(91) = {5.6, 0.8, 0, h};
Point(100) = {7, 0.6, 0, h};
Point(101) = {7.4, 0.6, 0, h};
Point(102) = {7.4, 0.2, 0, h};
Point(103) = {7.6, 0.2, 0, h};
Point(104) = {7.6, 0.6, 0, h};
Point(105) = {8, 0.6, 0, h};
Point(106) = {8, 0.8, 0, h};
Point(107) = {7.6, 0.8, 0, h};
Point(108) = {7.6, 1.2, 0, h};
Point(109) = {7.4, 1.2, 0, h};
Point(110) = {7.4, 0.8, 0, h};
Point(111) = {7, 0.8, 0, h};
Point(112) = {8.300000000000001, 2.4, 1, h};
Point(113) = {-0.4, 2.4, 1, h};
Point(117) = {-0.4, -0.4, 1, h};
Point(121) = {8.300000000000001, -0.4, 1, h};
Point(128) = {0, 2, 1, h};
Point(129) = {1, 2, 1, h};
Point(133) = {1, 1.8, 1, h};
Point(137) = {0.2, 1.8, 1, h};
Point(141) = {0.2, 1.1, 1, h};
Point(145) = {0.8, 1.1, 1, h};
Point(149) = {0.8, 0.9, 1, h};
Point(153) = {0.2, 0.9, 1, h};
Point(157) = {0.2, 0, 1, h};
Point(161) = {0, 0, 1, h};
Point(168) = {1.4, 2, 1, h};
Point(169) = {2.4, 2, 1, h};
Point(173) = {2.4, 1.8, 1, h};
Point(177) = {1.6, 1.8, 1, h};
Point(181) = {1.6, 1.1, 1, h};
Point(185) = {2, 1.1, 1, h};
Point(189) = {2, 0.9, 1, h};
Point(193) = {1.6, 0.9, 1, h};
Point(197) = {1.6, 0.2, 1, h};
Point(201) = {2.4, 0.2, 1, h};
Point(205) = {2.4, 0, 1, h};
Point(209) = {1.4, 0, 1, h};
Point(216) = {2.8, 2, 1, h};
Point(217) = {3.8, 2, 1, h};
Point(221) = {3.8, 1.8, 1, h};
Point(225) = {3, 1.8, 1, h};
Point(229) = {3, 1.1, 1, h};
Point(233) = {3.4, 1.1, 1, h};
Point(237) = {3.4, 0.9, 1, h};
Point(241) = {3, 0.9, 1, h};
Point(245) = {3, 0.2, 1, h};
Point(249) = {3.8, 0.2, 1, h};
Point(253) = {3.8, 0, 1, h};
Point(257) = {2.8, 0, 1, h};
Point(264) = {4.2, 2, 1, h};
Point(265) = {4.4, 2, 1, h};
Point(269) = {4.4, 0.2, 1, h};
Point(273) = {5.2, 0.2, 1, h};
Point(277) = {5.2, 0, 1, h};
Point(281) = {4.2, 0, 1, h};
Point(288) = {6, 1.2, 1, h};
Point(289) = {6.199999999999999, 1.2, 1, h};
Point(293) = {6.199999999999999, 0.8, 1, h};
Point(297) = {6.6, 0.8, 1, h};
Point(301) = {6.6, 0.6, 1, h};
Point(305) = {6.199999999999999, 0.6, 1, h};
Point(309) = {6.199999999999999, 0.2, 1, h};
Point(313) = {6, 0.2, 1, h};
Point(317) = {6, 0.6, 1, h};
Point(321) = {5.6, 0.6, 1, h};
Point(325) = {5.6, 0.8, 1, h};
Point(329) = {6, 0.8, 1, h};
Point(336) = {7.4, 1.2, 1, h};
Point(337) = {7.6, 1.2, 1, h};
Point(341) = {7.6, 0.8, 1, h};
Point(345) = {8, 0.8, 1, h};
Point(349) = {8, 0.6, 1, h};
Point(353) = {7.6, 0.6, 1, h};
Point(357) = {7.6, 0.2, 1, h};
Point(361) = {7.4, 0.2, 1, h};
Point(365) = {7.4, 0.6, 1, h};
Point(369) = {7, 0.6, 1, h};
Point(373) = {7, 0.8, 1, h};
Point(377) = {7.4, 0.8, 1, h};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line(5) = {30, 31};
Line(6) = {31, 32};
Line(7) = {32, 33};
Line(8) = {33, 34};
Line(9) = {34, 35};
Line(10) = {35, 36};
Line(11) = {36, 37};
Line(12) = {37, 38};
Line(13) = {38, 39};
Line(14) = {39, 30};
Line(15) = {40, 41};
Line(16) = {41, 42};
Line(17) = {42, 43};
Line(18) = {43, 44};
Line(19) = {44, 45};
Line(20) = {45, 46};
Line(21) = {46, 47};
Line(22) = {47, 48};
Line(23) = {48, 49};
Line(24) = {49, 50};
Line(25) = {50, 51};
Line(26) = {51, 40};
Line(27) = {63, 52};
Line(28) = {52, 53};
Line(29) = {53, 54};
Line(30) = {54, 55};
Line(31) = {55, 56};
Line(32) = {56, 57};
Line(33) = {57, 58};
Line(34) = {58, 59};
Line(35) = {59, 60};
Line(36) = {60, 61};
Line(37) = {61, 62};
Line(38) = {62, 63};
Line(39) = {64, 65};
Line(40) = {65, 66};
Line(41) = {66, 67};
Line(42) = {67, 74};
Line(43) = {74, 75};
Line(44) = {75, 64};
Line(45) = {82, 83};
Line(46) = {83, 84};
Line(47) = {84, 85};
Line(48) = {85, 86};
Line(49) = {86, 87};
Line(50) = {87, 88};
Line(51) = {88, 89};
Line(52) = {89, 90};
Line(53) = {90, 91};
Line(54) = {91, 80};
Line(55) = {80, 81};
Line(56) = {81, 82};
Line(57) = {102, 103};
Line(58) = {103, 104};
Line(59) = {104, 105};
Line(60) = {105, 106};
Line(61) = {106, 107};
Line(62) = {107, 108};
Line(63) = {108, 109};
Line(64) = {109, 110};
Line(65) = {110, 111};
Line(66) = {111, 100};
Line(67) = {100, 101};
Line(68) = {101, 102};
Line(78) = {112, 113};
Line(79) = {113, 117};
Line(80) = {117, 121};
Line(81) = {121, 112};
Line(82) = {128, 129};
Line(83) = {129, 133};
Line(84) = {133, 137};
Line(85) = {137, 141};
Line(86) = {141, 145};
Line(87) = {145, 149};
Line(88) = {149, 153};
Line(89) = {153, 157};
Line(90) = {157, 161};
Line(91) = {161, 128};
Line(92) = {168, 169};
Line(93) = {169, 173};
Line(94) = {173, 177};
Line(95) = {177, 181};
Line(96) = {181, 185};
Line(97) = {185, 189};
Line(98) = {189, 193};
Line(99) = {193, 197};
Line(100) = {197, 201};
Line(101) = {201, 205};
Line(102) = {205, 209};
Line(103) = {209, 168};
Line(104) = {216, 217};
Line(105) = {217, 221};
Line(106) = {221, 225};
Line(107) = {225, 229};
Line(108) = {229, 233};
Line(109) = {233, 237};
Line(110) = {237, 241};
Line(111) = {241, 245};
Line(112) = {245, 249};
Line(113) = {249, 253};
Line(114) = {253, 257};
Line(115) = {257, 216};
Line(116) = {264, 265};
Line(117) = {265, 269};
Line(118) = {269, 273};
Line(119) = {273, 277};
Line(120) = {277, 281};
Line(121) = {281, 264};
Line(122) = {288, 289};
Line(123) = {289, 293};
Line(124) = {293, 297};
Line(125) = {297, 301};
Line(126) = {301, 305};
Line(127) = {305, 309};
Line(128) = {309, 313};
Line(129) = {313, 317};
Line(130) = {317, 321};
Line(131) = {321, 325};
Line(132) = {325, 329};
Line(133) = {329, 288};
Line(134) = {336, 337};
Line(135) = {337, 341};
Line(136) = {341, 345};
Line(137) = {345, 349};
Line(138) = {349, 353};
Line(139) = {353, 357};
Line(140) = {357, 361};
Line(141) = {361, 365};
Line(142) = {365, 369};
Line(143) = {369, 373};
Line(144) = {373, 377};
Line(145) = {377, 336};
Line(147) = {3, 112};
Line(148) = {4, 113};
Line(152) = {1, 117};
Line(156) = {2, 121};
Line(163) = {39, 128};
Line(164) = {38, 129};
Line(168) = {37, 133};
Line(172) = {36, 137};
Line(176) = {35, 141};
Line(180) = {34, 145};
Line(184) = {33, 149};
Line(188) = {32, 153};
Line(192) = {31, 157};
Line(196) = {30, 161};
Line(203) = {51, 168};
Line(204) = {50, 169};
Line(208) = {49, 173};
Line(212) = {48, 177};
Line(216) = {47, 181};
Line(220) = {46, 185};
Line(224) = {45, 189};
Line(228) = {44, 193};
Line(232) = {43, 197};
Line(236) = {42, 201};
Line(240) = {41, 205};
Line(244) = {40, 209};
Line(251) = {63, 216};
Line(252) = {62, 217};
Line(256) = {61, 221};
Line(260) = {60, 225};
Line(264) = {59, 229};
Line(268) = {58, 233};
Line(272) = {57, 237};
Line(276) = {56, 241};
Line(280) = {55, 245};
Line(284) = {54, 249};
Line(288) = {53, 253};
Line(292) = {52, 257};
Line(299) = {75, 264};
Line(300) = {74, 265};
Line(304) = {67, 269};
Line(308) = {66, 273};
Line(312) = {65, 277};
Line(316) = {64, 281};
Line(323) = {89, 288};
Line(324) = {88, 289};
Line(328) = {87, 293};
Line(332) = {86, 297};
Line(336) = {85, 301};
Line(340) = {84, 305};
Line(344) = {83, 309};
Line(348) = {82, 313};
Line(352) = {81, 317};
Line(356) = {80, 321};
Line(360) = {91, 325};
Line(364) = {90, 329};
Line(371) = {109, 336};
Line(372) = {108, 337};
Line(376) = {107, 341};
Line(380) = {106, 345};
Line(384) = {105, 349};
Line(388) = {104, 353};
Line(392) = {103, 357};
Line(396) = {102, 361};
Line(400) = {101, 365};
Line(404) = {100, 369};
Line(408) = {111, 373};
Line(412) = {110, 377};
Line Loop(76) = {3, 4, 1, 2, -13, -12, -11, -10, -9, -8, -7, -6, -5, -14, -25, -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -26, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -43, -42, -41, -40, -39, -44, -51, -50, -49, -48, -47, -46, -45, -56, -55, -54, -53, -52, -63, -62, -61, -60, -59, -58, -57, -68, -67, -66, -65, -64};
Plane Surface(76) = {76};
Line Loop(149) = {3, 148, -78, -147};
Ruled Surface(149) = {149};
Line Loop(153) = {4, 152, -79, -148};
Ruled Surface(153) = {153};
Line Loop(157) = {1, 156, -80, -152};
Ruled Surface(157) = {157};
Line Loop(161) = {2, 147, -81, -156};
Ruled Surface(161) = {161};
Line Loop(165) = {-13, 164, -82, -163};
Ruled Surface(165) = {165};
Line Loop(169) = {-12, 168, -83, -164};
Ruled Surface(169) = {169};
Line Loop(173) = {-11, 172, -84, -168};
Ruled Surface(173) = {173};
Line Loop(177) = {-10, 176, -85, -172};
Ruled Surface(177) = {177};
Line Loop(181) = {-9, 180, -86, -176};
Ruled Surface(181) = {181};
Line Loop(185) = {-8, 184, -87, -180};
Ruled Surface(185) = {185};
Line Loop(189) = {-7, 188, -88, -184};
Ruled Surface(189) = {189};
Line Loop(193) = {-6, 192, -89, -188};
Ruled Surface(193) = {193};
Line Loop(197) = {-5, 196, -90, -192};
Ruled Surface(197) = {197};
Line Loop(201) = {-14, 163, -91, -196};
Ruled Surface(201) = {201};
Line Loop(205) = {-25, 204, -92, -203};
Ruled Surface(205) = {205};
Line Loop(209) = {-24, 208, -93, -204};
Ruled Surface(209) = {209};
Line Loop(213) = {-23, 212, -94, -208};
Ruled Surface(213) = {213};
Line Loop(217) = {-22, 216, -95, -212};
Ruled Surface(217) = {217};
Line Loop(221) = {-21, 220, -96, -216};
Ruled Surface(221) = {221};
Line Loop(225) = {-20, 224, -97, -220};
Ruled Surface(225) = {225};
Line Loop(229) = {-19, 228, -98, -224};
Ruled Surface(229) = {229};
Line Loop(233) = {-18, 232, -99, -228};
Ruled Surface(233) = {233};
Line Loop(237) = {-17, 236, -100, -232};
Ruled Surface(237) = {237};
Line Loop(241) = {-16, 240, -101, -236};
Ruled Surface(241) = {241};
Line Loop(245) = {-15, 244, -102, -240};
Ruled Surface(245) = {245};
Line Loop(249) = {-26, 203, -103, -244};
Ruled Surface(249) = {249};
Line Loop(253) = {-38, 252, -104, -251};
Ruled Surface(253) = {253};
Line Loop(257) = {-37, 256, -105, -252};
Ruled Surface(257) = {257};
Line Loop(261) = {-36, 260, -106, -256};
Ruled Surface(261) = {261};
Line Loop(265) = {-35, 264, -107, -260};
Ruled Surface(265) = {265};
Line Loop(269) = {-34, 268, -108, -264};
Ruled Surface(269) = {269};
Line Loop(273) = {-33, 272, -109, -268};
Ruled Surface(273) = {273};
Line Loop(277) = {-32, 276, -110, -272};
Ruled Surface(277) = {277};
Line Loop(281) = {-31, 280, -111, -276};
Ruled Surface(281) = {281};
Line Loop(285) = {-30, 284, -112, -280};
Ruled Surface(285) = {285};
Line Loop(289) = {-29, 288, -113, -284};
Ruled Surface(289) = {289};
Line Loop(293) = {-28, 292, -114, -288};
Ruled Surface(293) = {293};
Line Loop(297) = {-27, 251, -115, -292};
Ruled Surface(297) = {297};
Line Loop(301) = {-43, 300, -116, -299};
Ruled Surface(301) = {301};
Line Loop(305) = {-42, 304, -117, -300};
Ruled Surface(305) = {305};
Line Loop(309) = {-41, 308, -118, -304};
Ruled Surface(309) = {309};
Line Loop(313) = {-40, 312, -119, -308};
Ruled Surface(313) = {313};
Line Loop(317) = {-39, 316, -120, -312};
Ruled Surface(317) = {317};
Line Loop(321) = {-44, 299, -121, -316};
Ruled Surface(321) = {321};
Line Loop(325) = {-51, 324, -122, -323};
Ruled Surface(325) = {325};
Line Loop(329) = {-50, 328, -123, -324};
Ruled Surface(329) = {329};
Line Loop(333) = {-49, 332, -124, -328};
Ruled Surface(333) = {333};
Line Loop(337) = {-48, 336, -125, -332};
Ruled Surface(337) = {337};
Line Loop(341) = {-47, 340, -126, -336};
Ruled Surface(341) = {341};
Line Loop(345) = {-46, 344, -127, -340};
Ruled Surface(345) = {345};
Line Loop(349) = {-45, 348, -128, -344};
Ruled Surface(349) = {349};
Line Loop(353) = {-56, 352, -129, -348};
Ruled Surface(353) = {353};
Line Loop(357) = {-55, 356, -130, -352};
Ruled Surface(357) = {357};
Line Loop(361) = {-54, 360, -131, -356};
Ruled Surface(361) = {361};
Line Loop(365) = {-53, 364, -132, -360};
Ruled Surface(365) = {365};
Line Loop(369) = {-52, 323, -133, -364};
Ruled Surface(369) = {369};
Line Loop(373) = {-63, 372, -134, -371};
Ruled Surface(373) = {373};
Line Loop(377) = {-62, 376, -135, -372};
Ruled Surface(377) = {377};
Line Loop(381) = {-61, 380, -136, -376};
Ruled Surface(381) = {381};
Line Loop(385) = {-60, 384, -137, -380};
Ruled Surface(385) = {385};
Line Loop(389) = {-59, 388, -138, -384};
Ruled Surface(389) = {389};
Line Loop(393) = {-58, 392, -139, -388};
Ruled Surface(393) = {393};
Line Loop(397) = {-57, 396, -140, -392};
Ruled Surface(397) = {397};
Line Loop(401) = {-68, 400, -141, -396};
Ruled Surface(401) = {401};
Line Loop(405) = {-67, 404, -142, -400};
Ruled Surface(405) = {405};
Line Loop(409) = {-66, 408, -143, -404};
Ruled Surface(409) = {409};
Line Loop(413) = {-65, 412, -144, -408};
Ruled Surface(413) = {413};
Line Loop(417) = {-64, 371, -145, -412};
Ruled Surface(417) = {417};
Line Loop(418) = {78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145};
Plane Surface(418) = {418};
Surface Loop(1) = {76, 418, 149, 153, 157, 161, 165, 169, 173, 177, 181, 185, 189, 193, 197, 201, 205, 209, 213, 217, 221, 225, 229, 233, 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, 281, 285, 289, 293, 297, 301, 305, 309, 313, 317, 321, 325, 329, 333, 337, 341, 345, 349, 353, 357, 361, 365, 369, 373, 377, 381, 385, 389, 393, 397, 401, 405, 409, 413, 417};
Volume(1) = {1};
Physical Surface("letters") = {193, 197, 201, 165, 173, 169, 189, 177, 185, 181, 249, 237, 245, 233, 229, 221, 217, 213, 205, 209, 241, 225, 297, 261, 253, 265, 277, 269, 273, 281, 293, 285, 321, 305, 301, 317, 309, 357, 365, 361, 325, 369, 341, 333, 349, 353, 345, 337, 329, 409, 413, 405, 417, 373, 389, 381, 377, 401, 397, 393, 385, 313, 289,257};
Physical Surface("inlet") = {153};
Physical Surface("outlet") = {161};
Physical Surface("topbottom") = {149, 157};
Physical Volume("feelpp") = {1};
|
{
"pile_set_name": "Github"
}
|
@model IEnumerable<MVCMusicStore.Models.Review>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Album.Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Contents)
</th>
<th>
@Html.DisplayNameFor(model => model.ReviewerEmail)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Album.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.Contents)
</td>
<td>
@Html.DisplayFor(modelItem => item.ReviewerEmail)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) |
@Html.ActionLink("Details", "Details", new { id=item.ReviewID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ReviewID })
</td>
</tr>
}
</table>
|
{
"pile_set_name": "Github"
}
|
/dts-v1/;
#include "bcm6348.dtsi"
#include <dt-bindings/input/input.h>
/ {
model = "Comtrend CT-536+/CT-5621T";
compatible = "comtrend,ct536+", "brcm,bcm6348";
gpio-keys-polled {
compatible = "gpio-keys-polled";
#address-cells = <1>;
#size-cells = <0>;
poll-interval = <20>;
debounce-interval = <60>;
reset {
label = "reset";
gpios = <&gpio1 1 1>;
linux,code = <KEY_RESTART>;
};
};
gpio-leds {
compatible = "gpio-leds";
power_green {
label = "CT536_CT5621:green:power";
gpios = <&gpio0 0 1>;
default-state = "on";
};
adsl_fail_green {
label = "CT536_CT5621:green:adsl-fail";
gpios = <&gpio0 2 1>;
};
};
};
|
{
"pile_set_name": "Github"
}
|
#!/bin/bash
#
# urlmnt - Mount an afp/smb/ftp/webdav url as a volume in Mac OS X
#
# TO DO:
# -
# Reference:
# http://www.macosxhints.com/article.php?story=2001120201020569
# global variables
VERBOSE=0
HELP=0
# print usage instructions (help)
function usage() {
printf "Usage: urlmnt [options] url ...\n"
printf " -v verbose output\n"
printf " -h print these usage instructions\n"
}
# see if any arguments were passed in
if test $# -gt 0 ; then
# if so, step through them all and process them
print "test\n"
else
printf "You did not specify the URL of the volume to mount.\n\n"
usage
fi
|
{
"pile_set_name": "Github"
}
|
@font-face {font-family: "memberfont";
src: url('../icomoon/member/iconfont.eot'); /* IE9*/
src: url('../icomoon/member/iconfont.eot') format('embedded-opentype'), /* IE6-IE8 */
url('../icomoon/member/iconfont.woff') format('woff'), /* chrome, firefox */
url('../icomoon/member/iconfont.ttf') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
url('../icomoon/member/iconfont.svg') format('svg'); /* iOS 4.1- */
}
.memberfont {
font-family:"memberfont" !important;
font-size:20px;
font-style:normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-huiyuan:before { content: "\e604"; }
.icon-gonggaofuzhi:before { content: "\e606"; }
.icon-icon:before { content: "\e6ef"; }
.icon-vip:before { content: "\e60e"; }
.icon-huiyuan1:before { content: "\e60d"; }
.icon-huiyuan2:before { content: "\e605"; }
.icon-huiyuan3:before { content: "\e625"; }
.icon-huiyuan4:before { content: "\e66d"; }
.icon-huiyuan5:before { content: "\e64b"; }
.icon-huiyuan6:before { content: "\e62a"; }
.icon-haoyou-copy:before { content: "\e600"; }
.icon-huiyuan7:before { content: "\e612"; }
.icon-huiyuan8:before { content: "\e664"; }
.icon-my:before { content: "\e601"; }
.icon-huiyuan9:before { content: "\e637"; }
.icon-weibiaoti105:before { content: "\e694"; }
.icon-huiyuan10:before { content: "\e698"; }
.icon-huiyuan11:before { content: "\e602"; }
.icon-huiyuan12:before { content: "\e62b"; }
|
{
"pile_set_name": "Github"
}
|
{
"_from": "kind-of@^3.0.2",
"_id": "kind-of@3.2.2",
"_inBundle": false,
"_integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=",
"_location": "/randomatic/is-number/kind-of",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "kind-of@^3.0.2",
"name": "kind-of",
"escapedName": "kind-of",
"rawSpec": "^3.0.2",
"saveSpec": null,
"fetchSpec": "^3.0.2"
},
"_requiredBy": [
"/randomatic/is-number"
],
"_resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
"_shasum": "31ea21a734bab9bbb0f32466d893aea51e4a3c64",
"_spec": "kind-of@^3.0.2",
"_where": "/Users/toan/Tutorials/stream/api/node_modules/randomatic/node_modules/is-number",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"bugs": {
"url": "https://github.com/jonschlinkert/kind-of/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "David Fox-Powell",
"url": "https://dtothefp.github.io/me"
},
{
"name": "Jon Schlinkert",
"url": "http://twitter.com/jonschlinkert"
},
{
"name": "Ken Sheedlo",
"url": "kensheedlo.com"
},
{
"name": "laggingreflex",
"url": "https://github.com/laggingreflex"
},
{
"name": "Miguel Mota",
"url": "https://miguelmota.com"
},
{
"name": "Peter deHaan",
"url": "http://about.me/peterdehaan"
}
],
"dependencies": {
"is-buffer": "^1.1.5"
},
"deprecated": false,
"description": "Get the native type of a value.",
"devDependencies": {
"ansi-bold": "^0.1.1",
"benchmarked": "^1.0.0",
"browserify": "^14.3.0",
"glob": "^7.1.1",
"gulp-format-md": "^0.1.12",
"mocha": "^3.3.0",
"type-of": "^2.0.1",
"typeof": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/jonschlinkert/kind-of",
"keywords": [
"arguments",
"array",
"boolean",
"check",
"date",
"function",
"is",
"is-type",
"is-type-of",
"kind",
"kind-of",
"number",
"object",
"of",
"regexp",
"string",
"test",
"type",
"type-of",
"typeof",
"types"
],
"license": "MIT",
"main": "index.js",
"name": "kind-of",
"repository": {
"type": "git",
"url": "git+https://github.com/jonschlinkert/kind-of.git"
},
"scripts": {
"prepublish": "browserify -o browser.js -e index.js -s index --bare",
"test": "mocha"
},
"verb": {
"related": {
"list": [
"is-glob",
"is-number",
"is-primitive"
]
},
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"lint": {
"reflinks": true
},
"reflinks": [
"verb"
]
},
"version": "3.2.2"
}
|
{
"pile_set_name": "Github"
}
|
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 by Bart Kiers (original author) and Alexandre Vitorelli (contributor -> ported to CSharp)
* Copyright (c) 2017 by Ivan Kochurkin (Positive Technologies):
added ECMAScript 6 support, cleared and transformed to the universal grammar.
* Copyright (c) 2018 by Juan Alvarez (contributor -> ported to Go)
* Copyright (c) 2019 by Student Main (contributor -> ES2020)
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
lexer grammar JavaScriptLexer;
channels { ERROR }
options { superClass=JavaScriptBaseLexer; }
HashBangLine: { p.IsStartOfFile()}? '#!' ~[\r\n\u2028\u2029]*; // only allowed at start
MultiLineComment: '/*' .*? '*/' -> channel(HIDDEN);
SingleLineComment: '//' ~[\r\n\u2028\u2029]* -> channel(HIDDEN);
RegularExpressionLiteral: '/' RegularExpressionFirstChar RegularExpressionChar* {p.IsRegexPossible()}? '/' IdentifierPart*;
OpenBracket: '[';
CloseBracket: ']';
OpenParen: '(';
CloseParen: ')';
OpenBrace: '{' {l.ProcessOpenBrace();};
CloseBrace: '}' {l.ProcessCloseBrace();};
SemiColon: ';';
Comma: ',';
Assign: '=';
QuestionMark: '?';
Colon: ':';
Ellipsis: '...';
Dot: '.';
PlusPlus: '++';
MinusMinus: '--';
Plus: '+';
Minus: '-';
BitNot: '~';
Not: '!';
Multiply: '*';
Divide: '/';
Modulus: '%';
Power: '**';
NullCoalesce: '??';
Hashtag: '#';
RightShiftArithmetic: '>>';
LeftShiftArithmetic: '<<';
RightShiftLogical: '>>>';
LessThan: '<';
MoreThan: '>';
LessThanEquals: '<=';
GreaterThanEquals: '>=';
Equals_: '==';
NotEquals: '!=';
IdentityEquals: '===';
IdentityNotEquals: '!==';
BitAnd: '&';
BitXOr: '^';
BitOr: '|';
And: '&&';
Or: '||';
MultiplyAssign: '*=';
DivideAssign: '/=';
ModulusAssign: '%=';
PlusAssign: '+=';
MinusAssign: '-=';
LeftShiftArithmeticAssign: '<<=';
RightShiftArithmeticAssign: '>>=';
RightShiftLogicalAssign: '>>>=';
BitAndAssign: '&=';
BitXorAssign: '^=';
BitOrAssign: '|=';
PowerAssign: '**=';
ARROW: '=>';
/// Null Literals
NullLiteral: 'null';
/// Boolean Literals
BooleanLiteral: 'true'
| 'false';
/// Numeric Literals
DecimalLiteral: DecimalIntegerLiteral '.' [0-9] [0-9_]* ExponentPart?
| '.' [0-9] [0-9_]* ExponentPart?
| DecimalIntegerLiteral ExponentPart?
;
/// Numeric Literals
HexIntegerLiteral: '0' [xX] [0-9a-fA-F] HexDigit*;
OctalIntegerLiteral: '0' [0-7]+ {!p.IsStrictMode()}?;
OctalIntegerLiteral2: '0' [oO] [0-7] [_0-7]*;
BinaryIntegerLiteral: '0' [bB] [01] [_01]*;
BigHexIntegerLiteral: '0' [xX] [0-9a-fA-F] HexDigit* 'n';
BigOctalIntegerLiteral: '0' [oO] [0-7] [_0-7]* 'n';
BigBinaryIntegerLiteral: '0' [bB] [01] [_01]* 'n';
BigDecimalIntegerLiteral: DecimalIntegerLiteral 'n';
/// Keywords
Break: 'break';
Do: 'do';
Instanceof: 'instanceof';
Typeof: 'typeof';
Case: 'case';
Else: 'else';
New: 'new';
Var: 'var';
Catch: 'catch';
Finally: 'finally';
Return: 'return';
Void: 'void';
Continue: 'continue';
For: 'for';
Switch: 'switch';
While: 'while';
Debugger: 'debugger';
Function: 'function';
This: 'this';
With: 'with';
Default: 'default';
If: 'if';
Throw: 'throw';
Delete: 'delete';
In: 'in';
Try: 'try';
As: 'as';
From: 'from';
/// Future Reserved Words
Class: 'class';
Enum: 'enum';
Extends: 'extends';
Super: 'super';
Const: 'const';
Export: 'export';
Import: 'import';
Async: 'async';
Await: 'await';
/// The following tokens are also considered to be FutureReservedWords
/// when parsing strict mode
Implements: 'implements' {p.IsStrictMode()}?;
Let: 'let' {p.IsStrictMode()}?;
Private: 'private' {p.IsStrictMode()}?;
Public: 'public' {p.IsStrictMode()}?;
Interface: 'interface' {p.IsStrictMode()}?;
Package: 'package' {p.IsStrictMode()}?;
Protected: 'protected' {p.IsStrictMode()}?;
Static: 'static' {p.IsStrictMode()}?;
Yield: 'yield' {p.IsStrictMode()}?;
/// Identifier Names and Identifiers
Identifier: IdentifierStart IdentifierPart*;
/// String Literals
StringLiteral: ('"' DoubleStringCharacter* '"'
| '\'' SingleStringCharacter* '\'') {l.ProcessStringLiteral();}
;
// TODO: `${`tmp`}`
TemplateStringLiteral: '`' ('\\`' | ~'`')* '`';
WhiteSpaces: [\t\u000B\u000C\u0020\u00A0]+ -> channel(HIDDEN);
LineTerminator: [\r\n\u2028\u2029] -> channel(HIDDEN);
/// Comments
HtmlComment: '<!--' .*? '-->' -> channel(HIDDEN);
CDataComment: '<![CDATA[' .*? ']]>' -> channel(HIDDEN);
UnexpectedCharacter: . -> channel(ERROR);
// Fragment rules
fragment DoubleStringCharacter
: ~["\\\r\n]
| '\\' EscapeSequence
| LineContinuation
;
fragment SingleStringCharacter
: ~['\\\r\n]
| '\\' EscapeSequence
| LineContinuation
;
fragment EscapeSequence
: CharacterEscapeSequence
| '0' // no digit ahead! TODO
| HexEscapeSequence
| UnicodeEscapeSequence
| ExtendedUnicodeEscapeSequence
;
fragment CharacterEscapeSequence
: SingleEscapeCharacter
| NonEscapeCharacter
;
fragment HexEscapeSequence
: 'x' HexDigit HexDigit
;
fragment UnicodeEscapeSequence
: 'u' HexDigit HexDigit HexDigit HexDigit
| 'u' '{' HexDigit HexDigit+ '}'
;
fragment ExtendedUnicodeEscapeSequence
: 'u' '{' HexDigit+ '}'
;
fragment SingleEscapeCharacter
: ['"\\bfnrtv]
;
fragment NonEscapeCharacter
: ~['"\\bfnrtv0-9xu\r\n]
;
fragment EscapeCharacter
: SingleEscapeCharacter
| [0-9]
| [xu]
;
fragment LineContinuation
: '\\' [\r\n\u2028\u2029]
;
fragment HexDigit
: [_0-9a-fA-F]
;
fragment DecimalIntegerLiteral
: '0'
| [1-9] [0-9_]*
;
fragment ExponentPart
: [eE] [+-]? [0-9_]+
;
fragment IdentifierPart
: IdentifierStart
| UnicodeCombiningMark
| UnicodeDigit
| UnicodeConnectorPunctuation
| '\u200C'
| '\u200D'
;
fragment IdentifierStart
: UnicodeLetter
| [$_]
| '\\' UnicodeEscapeSequence
;
fragment UnicodeLetter
: [\u0041-\u005A]
| [\u0061-\u007A]
| [\u00AA]
| [\u00B5]
| [\u00BA]
| [\u00C0-\u00D6]
| [\u00D8-\u00F6]
| [\u00F8-\u021F]
| [\u0222-\u0233]
| [\u0250-\u02AD]
| [\u02B0-\u02B8]
| [\u02BB-\u02C1]
| [\u02D0-\u02D1]
| [\u02E0-\u02E4]
| [\u02EE]
| [\u037A]
| [\u0386]
| [\u0388-\u038A]
| [\u038C]
| [\u038E-\u03A1]
| [\u03A3-\u03CE]
| [\u03D0-\u03D7]
| [\u03DA-\u03F3]
| [\u0400-\u0481]
| [\u048C-\u04C4]
| [\u04C7-\u04C8]
| [\u04CB-\u04CC]
| [\u04D0-\u04F5]
| [\u04F8-\u04F9]
| [\u0531-\u0556]
| [\u0559]
| [\u0561-\u0587]
| [\u05D0-\u05EA]
| [\u05F0-\u05F2]
| [\u0621-\u063A]
| [\u0640-\u064A]
| [\u0671-\u06D3]
| [\u06D5]
| [\u06E5-\u06E6]
| [\u06FA-\u06FC]
| [\u0710]
| [\u0712-\u072C]
| [\u0780-\u07A5]
| [\u0905-\u0939]
| [\u093D]
| [\u0950]
| [\u0958-\u0961]
| [\u0985-\u098C]
| [\u098F-\u0990]
| [\u0993-\u09A8]
| [\u09AA-\u09B0]
| [\u09B2]
| [\u09B6-\u09B9]
| [\u09DC-\u09DD]
| [\u09DF-\u09E1]
| [\u09F0-\u09F1]
| [\u0A05-\u0A0A]
| [\u0A0F-\u0A10]
| [\u0A13-\u0A28]
| [\u0A2A-\u0A30]
| [\u0A32-\u0A33]
| [\u0A35-\u0A36]
| [\u0A38-\u0A39]
| [\u0A59-\u0A5C]
| [\u0A5E]
| [\u0A72-\u0A74]
| [\u0A85-\u0A8B]
| [\u0A8D]
| [\u0A8F-\u0A91]
| [\u0A93-\u0AA8]
| [\u0AAA-\u0AB0]
| [\u0AB2-\u0AB3]
| [\u0AB5-\u0AB9]
| [\u0ABD]
| [\u0AD0]
| [\u0AE0]
| [\u0B05-\u0B0C]
| [\u0B0F-\u0B10]
| [\u0B13-\u0B28]
| [\u0B2A-\u0B30]
| [\u0B32-\u0B33]
| [\u0B36-\u0B39]
| [\u0B3D]
| [\u0B5C-\u0B5D]
| [\u0B5F-\u0B61]
| [\u0B85-\u0B8A]
| [\u0B8E-\u0B90]
| [\u0B92-\u0B95]
| [\u0B99-\u0B9A]
| [\u0B9C]
| [\u0B9E-\u0B9F]
| [\u0BA3-\u0BA4]
| [\u0BA8-\u0BAA]
| [\u0BAE-\u0BB5]
| [\u0BB7-\u0BB9]
| [\u0C05-\u0C0C]
| [\u0C0E-\u0C10]
| [\u0C12-\u0C28]
| [\u0C2A-\u0C33]
| [\u0C35-\u0C39]
| [\u0C60-\u0C61]
| [\u0C85-\u0C8C]
| [\u0C8E-\u0C90]
| [\u0C92-\u0CA8]
| [\u0CAA-\u0CB3]
| [\u0CB5-\u0CB9]
| [\u0CDE]
| [\u0CE0-\u0CE1]
| [\u0D05-\u0D0C]
| [\u0D0E-\u0D10]
| [\u0D12-\u0D28]
| [\u0D2A-\u0D39]
| [\u0D60-\u0D61]
| [\u0D85-\u0D96]
| [\u0D9A-\u0DB1]
| [\u0DB3-\u0DBB]
| [\u0DBD]
| [\u0DC0-\u0DC6]
| [\u0E01-\u0E30]
| [\u0E32-\u0E33]
| [\u0E40-\u0E46]
| [\u0E81-\u0E82]
| [\u0E84]
| [\u0E87-\u0E88]
| [\u0E8A]
| [\u0E8D]
| [\u0E94-\u0E97]
| [\u0E99-\u0E9F]
| [\u0EA1-\u0EA3]
| [\u0EA5]
| [\u0EA7]
| [\u0EAA-\u0EAB]
| [\u0EAD-\u0EB0]
| [\u0EB2-\u0EB3]
| [\u0EBD-\u0EC4]
| [\u0EC6]
| [\u0EDC-\u0EDD]
| [\u0F00]
| [\u0F40-\u0F6A]
| [\u0F88-\u0F8B]
| [\u1000-\u1021]
| [\u1023-\u1027]
| [\u1029-\u102A]
| [\u1050-\u1055]
| [\u10A0-\u10C5]
| [\u10D0-\u10F6]
| [\u1100-\u1159]
| [\u115F-\u11A2]
| [\u11A8-\u11F9]
| [\u1200-\u1206]
| [\u1208-\u1246]
| [\u1248]
| [\u124A-\u124D]
| [\u1250-\u1256]
| [\u1258]
| [\u125A-\u125D]
| [\u1260-\u1286]
| [\u1288]
| [\u128A-\u128D]
| [\u1290-\u12AE]
| [\u12B0]
| [\u12B2-\u12B5]
| [\u12B8-\u12BE]
| [\u12C0]
| [\u12C2-\u12C5]
| [\u12C8-\u12CE]
| [\u12D0-\u12D6]
| [\u12D8-\u12EE]
| [\u12F0-\u130E]
| [\u1310]
| [\u1312-\u1315]
| [\u1318-\u131E]
| [\u1320-\u1346]
| [\u1348-\u135A]
| [\u13A0-\u13B0]
| [\u13B1-\u13F4]
| [\u1401-\u1676]
| [\u1681-\u169A]
| [\u16A0-\u16EA]
| [\u1780-\u17B3]
| [\u1820-\u1877]
| [\u1880-\u18A8]
| [\u1E00-\u1E9B]
| [\u1EA0-\u1EE0]
| [\u1EE1-\u1EF9]
| [\u1F00-\u1F15]
| [\u1F18-\u1F1D]
| [\u1F20-\u1F39]
| [\u1F3A-\u1F45]
| [\u1F48-\u1F4D]
| [\u1F50-\u1F57]
| [\u1F59]
| [\u1F5B]
| [\u1F5D]
| [\u1F5F-\u1F7D]
| [\u1F80-\u1FB4]
| [\u1FB6-\u1FBC]
| [\u1FBE]
| [\u1FC2-\u1FC4]
| [\u1FC6-\u1FCC]
| [\u1FD0-\u1FD3]
| [\u1FD6-\u1FDB]
| [\u1FE0-\u1FEC]
| [\u1FF2-\u1FF4]
| [\u1FF6-\u1FFC]
| [\u207F]
| [\u2102]
| [\u2107]
| [\u210A-\u2113]
| [\u2115]
| [\u2119-\u211D]
| [\u2124]
| [\u2126]
| [\u2128]
| [\u212A-\u212D]
| [\u212F-\u2131]
| [\u2133-\u2139]
| [\u2160-\u2183]
| [\u3005-\u3007]
| [\u3021-\u3029]
| [\u3031-\u3035]
| [\u3038-\u303A]
| [\u3041-\u3094]
| [\u309D-\u309E]
| [\u30A1-\u30FA]
| [\u30FC-\u30FE]
| [\u3105-\u312C]
| [\u3131-\u318E]
| [\u31A0-\u31B7]
| [\u3400-\u4DBF]
| [\u4E00-\u9FFF]
| [\uA000-\uA48C]
| [\uAC00]
| [\uD7A3]
| [\uF900-\uFA2D]
| [\uFB00-\uFB06]
| [\uFB13-\uFB17]
| [\uFB1D]
| [\uFB1F-\uFB28]
| [\uFB2A-\uFB36]
| [\uFB38-\uFB3C]
| [\uFB3E]
| [\uFB40-\uFB41]
| [\uFB43-\uFB44]
| [\uFB46-\uFBB1]
| [\uFBD3-\uFD3D]
| [\uFD50-\uFD8F]
| [\uFD92-\uFDC7]
| [\uFDF0-\uFDFB]
| [\uFE70-\uFE72]
| [\uFE74]
| [\uFE76-\uFEFC]
| [\uFF21-\uFF3A]
| [\uFF41-\uFF5A]
| [\uFF66-\uFFBE]
| [\uFFC2-\uFFC7]
| [\uFFCA-\uFFCF]
| [\uFFD2-\uFFD7]
| [\uFFDA-\uFFDC]
;
fragment UnicodeCombiningMark
: [\u0300-\u034E]
| [\u0360-\u0362]
| [\u0483-\u0486]
| [\u0591-\u05A1]
| [\u05A3-\u05B9]
| [\u05BB-\u05BD]
| [\u05BF]
| [\u05C1-\u05C2]
| [\u05C4]
| [\u064B-\u0655]
| [\u0670]
| [\u06D6-\u06DC]
| [\u06DF-\u06E4]
| [\u06E7-\u06E8]
| [\u06EA-\u06ED]
| [\u0711]
| [\u0730-\u074A]
| [\u07A6-\u07B0]
| [\u0901-\u0903]
| [\u093C]
| [\u093E-\u094D]
| [\u0951-\u0954]
| [\u0962-\u0963]
| [\u0981-\u0983]
| [\u09BC-\u09C4]
| [\u09C7-\u09C8]
| [\u09CB-\u09CD]
| [\u09D7]
| [\u09E2-\u09E3]
| [\u0A02]
| [\u0A3C]
| [\u0A3E-\u0A42]
| [\u0A47-\u0A48]
| [\u0A4B-\u0A4D]
| [\u0A70-\u0A71]
| [\u0A81-\u0A83]
| [\u0ABC]
| [\u0ABE-\u0AC5]
| [\u0AC7-\u0AC9]
| [\u0ACB-\u0ACD]
| [\u0B01-\u0B03]
| [\u0B3C]
| [\u0B3E-\u0B43]
| [\u0B47-\u0B48]
| [\u0B4B-\u0B4D]
| [\u0B56-\u0B57]
| [\u0B82-\u0B83]
| [\u0BBE-\u0BC2]
| [\u0BC6-\u0BC8]
| [\u0BCA-\u0BCD]
| [\u0BD7]
| [\u0C01-\u0C03]
| [\u0C3E-\u0C44]
| [\u0C46-\u0C48]
| [\u0C4A-\u0C4D]
| [\u0C55-\u0C56]
| [\u0C82-\u0C83]
| [\u0CBE-\u0CC4]
| [\u0CC6-\u0CC8]
| [\u0CCA-\u0CCD]
| [\u0CD5-\u0CD6]
| [\u0D02-\u0D03]
| [\u0D3E-\u0D43]
| [\u0D46-\u0D48]
| [\u0D4A-\u0D4D]
| [\u0D57]
| [\u0D82-\u0D83]
| [\u0DCA]
| [\u0DCF-\u0DD4]
| [\u0DD6]
| [\u0DD8-\u0DDF]
| [\u0DF2-\u0DF3]
| [\u0E31]
| [\u0E34-\u0E3A]
| [\u0E47-\u0E4E]
| [\u0EB1]
| [\u0EB4-\u0EB9]
| [\u0EBB-\u0EBC]
| [\u0EC8-\u0ECD]
| [\u0F18-\u0F19]
| [\u0F35]
| [\u0F37]
| [\u0F39]
| [\u0F3E-\u0F3F]
| [\u0F71-\u0F84]
| [\u0F86-\u0F87]
| [\u0F90-\u0F97]
| [\u0F99-\u0FBC]
| [\u0FC6]
| [\u102C-\u1032]
| [\u1036-\u1039]
| [\u1056-\u1059]
| [\u17B4-\u17D3]
| [\u18A9]
| [\u20D0-\u20DC]
| [\u20E1]
| [\u302A-\u302F]
| [\u3099-\u309A]
| [\uFB1E]
| [\uFE20-\uFE23]
;
fragment UnicodeDigit
: [\u0030-\u0039]
| [\u0660-\u0669]
| [\u06F0-\u06F9]
| [\u0966-\u096F]
| [\u09E6-\u09EF]
| [\u0A66-\u0A6F]
| [\u0AE6-\u0AEF]
| [\u0B66-\u0B6F]
| [\u0BE7-\u0BEF]
| [\u0C66-\u0C6F]
| [\u0CE6-\u0CEF]
| [\u0D66-\u0D6F]
| [\u0E50-\u0E59]
| [\u0ED0-\u0ED9]
| [\u0F20-\u0F29]
| [\u1040-\u1049]
| [\u1369-\u1371]
| [\u17E0-\u17E9]
| [\u1810-\u1819]
| [\uFF10-\uFF19]
;
fragment UnicodeConnectorPunctuation
: [\u005F]
| [\u203F-\u2040]
| [\u30FB]
| [\uFE33-\uFE34]
| [\uFE4D-\uFE4F]
| [\uFF3F]
| [\uFF65]
;
fragment RegularExpressionFirstChar
: ~[*\r\n\u2028\u2029\\/[]
| RegularExpressionBackslashSequence
| '[' RegularExpressionClassChar* ']'
;
fragment RegularExpressionChar
: ~[\r\n\u2028\u2029\\/[]
| RegularExpressionBackslashSequence
| '[' RegularExpressionClassChar* ']'
;
fragment RegularExpressionClassChar
: ~[\r\n\u2028\u2029\]\\]
| RegularExpressionBackslashSequence
;
fragment RegularExpressionBackslashSequence
: '\\' ~[\r\n\u2028\u2029]
;
|
{
"pile_set_name": "Github"
}
|
#pragma once
#include <switch.h>
#include <string>
#include <vector>
class Language
{
public:
enum class Type : u8
{
None,
en,
cs,
da,
de,
el,
es,
es_CO,
es_AR,
es_CL,
es_PE,
es_MX,
es_US,
fi,
fr,
fr_CA,
fr_BE,
hu,
it,
ja,
ko,
nl,
no,
pl,
pt,
pt_BR,
sv,
ru,
zh,
vi,
tr,
hi,
he,
id,
tl,
ar,
fa,
uk,
hr
};
Language() : m_type(Type::en)
{
}
Language(const Language& c)
{
m_type = c.m_type;
}
Language(const Type type)
{
m_type = type;
}
static std::vector<std::string>& list() {
static std::vector<std::string> r;
r.resize(0);
for (int i = (int)Type::en; i <= (int)Type::zh; i++) {
r.push_back(lookup(i));
}
return r;
}
Language(const std::string& s)
{
if (s == "en") { m_type = Type::en; }
else if (s == "de") { m_type = Type::de; }
else if (s == "es") { m_type = Type::es; }
else if (s == "fr") { m_type = Type::fr; }
else if (s == "it") { m_type = Type::it; }
else if (s == "ja") { m_type = Type::ja; }
else if (s == "ko") { m_type = Type::ko; }
else if (s == "nl") { m_type = Type::nl; }
else if (s == "pt") { m_type = Type::pt; }
else if (s == "ru") { m_type = Type::ru; }
else if (s == "zh") { m_type = Type::zh; }
else if (s == "sv") { m_type = Type::sv; }
else if (s == "pl") { m_type = Type::pl; }
else if (s == "no") { m_type = Type::no; }
else if (s == "hu") { m_type = Type::hu; }
else if (s == "fi") { m_type = Type::fi; }
else if (s == "el") { m_type = Type::el; }
else if (s == "da") { m_type = Type::da; }
else if (s == "cs") { m_type = Type::cs; }
else if (s == "es-CO") { m_type = Type::es_CO; }
else if (s == "es-AR") { m_type = Type::es_AR; }
else if (s == "es-CL") { m_type = Type::es_CL; }
else if (s == "es-PE") { m_type = Type::es_PE; }
else if (s == "es-MX") { m_type = Type::es_MX; }
else if (s == "es-US") { m_type = Type::es_US; }
else if (s == "fr-CA") { m_type = Type::fr_CA; }
else if (s == "fr-BE") { m_type = Type::fr_BE; }
else if (s == "pt-BR") { m_type = Type::pt_BR; }
else if (s == "vi") { m_type = Type::vi; }
else if (s == "tr") { m_type = Type::tr; }
else if (s == "hi") { m_type = Type::hi; }
else if (s == "he") { m_type = Type::he; }
else if (s == "id") { m_type = Type::id; }
else if (s == "tl") { m_type = Type::tl; }
else if (s == "ar") { m_type = Type::ar; }
else if (s == "fa") { m_type = Type::fa; }
else if (s == "uk") { m_type = Type::uk; }
else if (s == "hr") { m_type = Type::hr; }
else m_type = Type::None;
}
operator u8() const { return (u8)m_type; }
const char* c_str() const {
return lookup((int)m_type);
}
static const char* lookup(int i) {
switch (i)
{
case (int)Type::en: return "en";
case (int)Type::de: return "de";
case (int)Type::es: return "es";
case (int)Type::fr: return "fr";
case (int)Type::it: return "it";
case (int)Type::ja: return "ja";
case (int)Type::ko: return "ko";
case (int)Type::nl: return "nl";
case (int)Type::pt: return "pt";
case (int)Type::ru: return "ru";
case (int)Type::zh: return "zh";
case (int)Type::sv: return "sv";
case (int)Type::pl: return "pl";
case (int)Type::no: return "no";
case (int)Type::hu: return "hu";
case (int)Type::fi: return "fi";
case (int)Type::el: return "el";
case (int)Type::da: return "da";
case (int)Type::cs: return "cs";
case (int)Type::es_CO: return "es-CO";
case (int)Type::es_AR: return "es-AR";
case (int)Type::es_CL: return "es-CL";
case (int)Type::es_PE: return "es-PE";
case (int)Type::es_MX: return "es-MX";
case (int)Type::es_US: return "es-US";
case (int)Type::fr_CA: return "fr-CA";
case (int)Type::fr_BE: return "fr-BE";
case (int)Type::pt_BR: return "pt-BR";
case (int)Type::vi: return "vi";
case (int)Type::tr: return "tr";
case (int)Type::hi: return "hi";
case (int)Type::he: return "he";
case (int)Type::id: return "id";
case (int)Type::tl: return "tl";
case (int)Type::ar: return "ar";
case (int)Type::fa: return "fa";
case (int)Type::uk: return "uk";
case (int)Type::hr: return "hr";
}
return "";
}
std::string str() {
return std::string(c_str());
}
protected:
Type m_type;
};
#include "translate_defs.h"
const char* translate(const Translate& key);
void setCurrentLanguage(const Language& languageId);
|
{
"pile_set_name": "Github"
}
|
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#ifndef SOFA_COMPONENT_COLLISION_RIGIDCONTACTMAPPER_H
#define SOFA_COMPONENT_COLLISION_RIGIDCONTACTMAPPER_H
#include "config.h"
#include <sofa/helper/Factory.h>
#include <SofaBaseMechanics/BarycentricMapping.h>
#include <SofaBaseMechanics/IdentityMapping.h>
#include <SofaRigid/RigidMapping.h>
#include <SofaBaseMechanics/SubsetMapping.h>
#include <SofaBaseMechanics/MechanicalObject.h>
#include <sofa/simulation/Node.h>
#include <sofa/simulation/Simulation.h>
#include <SofaBaseCollision/BaseContactMapper.h>
#include <SofaBaseCollision/SphereModel.h>
#include <SofaMeshCollision/TriangleModel.h>
#include <SofaMeshCollision/LineModel.h>
#include <SofaMeshCollision/PointModel.h>
#include <SofaBaseCollision/OBBModel.h>
#include <SofaBaseCollision/RigidCapsuleModel.h>
#include <SofaBaseCollision/CylinderModel.h>
#include <SofaBaseMechanics/IdentityMapping.h>
#include <sofa/core/VecId.h>
#include <iostream>
namespace sofa
{
namespace component
{
namespace collision
{
/// Base class for all mappers using RigidMapping
template < class TCollisionModel, class DataTypes >
class RigidContactMapper : public BaseContactMapper<DataTypes>
{
public:
typedef typename DataTypes::Real Real;
typedef typename DataTypes::Coord Coord;
typedef typename DataTypes::VecCoord VecCoord;
typedef typename DataTypes::VecDeriv VecDeriv;
typedef TCollisionModel MCollisionModel;
typedef typename MCollisionModel::InDataTypes InDataTypes;
typedef core::behavior::MechanicalState<InDataTypes> InMechanicalState;
typedef core::behavior::MechanicalState<typename RigidContactMapper::DataTypes> MMechanicalState;
typedef component::container::MechanicalObject<typename RigidContactMapper::DataTypes> MMechanicalObject;
typedef mapping::RigidMapping< InDataTypes, typename RigidContactMapper::DataTypes > MMapping;
using index_type = sofa::defaulttype::index_type;
MCollisionModel* model;
simulation::Node::SPtr child;
typename MMapping::SPtr mapping;
typename MMechanicalState::SPtr outmodel;
int nbp;
protected:
RigidContactMapper();
public:
void setCollisionModel(MCollisionModel* model)
{
this->model = model;
}
void cleanup();
MMechanicalState* createMapping(const char* name="contactPoints");
void resize(std::size_t size)
{
if (mapping != nullptr)
mapping->clear(size);
if (outmodel != nullptr)
outmodel->resize(size);
nbp = 0;
}
index_type addPoint(const Coord& P, index_type index, Real&)
{
int i = nbp++;
if ((int)outmodel->getSize() <= i)
outmodel->resize(i+1);
if (mapping)
{
i = mapping->addPoint(P,index);
}
else
{
helper::WriteAccessor<Data<VecCoord> > xData = *outmodel->write(core::VecCoordId::position());
xData.wref()[i] = P;
}
return i;
}
void update()
{
if (mapping != nullptr)
{
core::BaseMapping* map = mapping.get();
map->apply(core::MechanicalParams::defaultInstance(), core::VecCoordId::position(), core::ConstVecCoordId::position());
map->applyJ(core::MechanicalParams::defaultInstance(), core::VecDerivId::velocity(), core::ConstVecDerivId::velocity());
}
}
void updateXfree()
{
if (mapping != nullptr)
{
core::BaseMapping* map = mapping.get();
map->apply(core::MechanicalParams::defaultInstance(), core::VecCoordId::freePosition(), core::ConstVecCoordId::freePosition());
map->applyJ(core::MechanicalParams::defaultInstance(), core::VecDerivId::freeVelocity(), core::ConstVecDerivId::freeVelocity());
}
}
};
template <class TVec3Types>
class ContactMapper<RigidSphereModel,TVec3Types > : public RigidContactMapper<RigidSphereModel, TVec3Types >{
public:
sofa::defaulttype::index_type addPoint(const typename TVec3Types::Coord & P, sofa::defaulttype::index_type index,typename TVec3Types::Real & r)
{
RigidSphere e(this->model, index);
const typename SphereCollisionModel<sofa::defaulttype::Rigid3Types>::DataTypes::Coord & rCenter = e.rigidCenter();
const typename TVec3Types::Coord & cP = P - rCenter.getCenter();
const defaulttype::Quaternion & ori = rCenter.getOrientation();
//r = e.r();
return RigidContactMapper<RigidSphereModel,TVec3Types >::addPoint(ori.inverseRotate(cP),index,r);
}
};
template <class TVec3Types>
class ContactMapper<OBBCollisionModel<sofa::defaulttype::Rigid3Types>,TVec3Types > : public RigidContactMapper<OBBCollisionModel<sofa::defaulttype::Rigid3Types>, TVec3Types >{
public:
sofa::defaulttype::index_type addPoint(const typename TVec3Types::Coord & P, sofa::defaulttype::index_type index,typename TVec3Types::Real & r)
{
const typename TVec3Types::Coord & cP = P - this->model->center(index);
const defaulttype::Quaternion & ori = this->model->orientation(index);
return RigidContactMapper<OBBCollisionModel<sofa::defaulttype::Rigid3Types>,TVec3Types >::addPoint(ori.inverseRotate(cP),index,r);
}
};
template <class TVec3Types>
class ContactMapper<CapsuleCollisionModel<sofa::defaulttype::Rigid3Types>,TVec3Types > : public RigidContactMapper<CapsuleCollisionModel<sofa::defaulttype::Rigid3Types>, TVec3Types >{
public:
sofa::defaulttype::index_type addPoint(const typename TVec3Types::Coord & P, sofa::defaulttype::index_type index,typename TVec3Types::Real & r)
{
const typename TVec3Types::Coord & cP = P - this->model->center(index);
const defaulttype::Quaternion & ori = this->model->orientation(index);
return RigidContactMapper<CapsuleCollisionModel<sofa::defaulttype::Rigid3Types>,TVec3Types >::addPoint(ori.inverseRotate(cP),index,r);
}
};
template <class TVec3Types>
class ContactMapper<CylinderCollisionModel<sofa::defaulttype::Rigid3Types>,TVec3Types > : public RigidContactMapper<CylinderCollisionModel<sofa::defaulttype::Rigid3Types>, TVec3Types >{
public:
sofa::defaulttype::index_type addPoint(const typename TVec3Types::Coord & P, sofa::defaulttype::index_type index,typename TVec3Types::Real & r)
{
const typename TVec3Types::Coord & cP = P - this->model->center(index);
const defaulttype::Quaternion & ori = this->model->orientation(index);
return RigidContactMapper<CylinderCollisionModel<sofa::defaulttype::Rigid3Types>,TVec3Types >::addPoint(ori.inverseRotate(cP),index,r);
}
};
#if !defined(SOFA_COMPONENT_COLLISION_RIGIDCONTACTMAPPER_CPP)
extern template class SOFA_MESH_COLLISION_API ContactMapper<CylinderCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>;
extern template class SOFA_MESH_COLLISION_API ContactMapper<CapsuleCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>;
extern template class SOFA_MESH_COLLISION_API ContactMapper<RigidSphereModel, defaulttype::Vec3Types>;
extern template class SOFA_MESH_COLLISION_API ContactMapper<OBBCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>;
// Manual declaration of non-specialized members, to avoid warnings from MSVC.
extern template SOFA_MESH_COLLISION_API void RigidContactMapper<CylinderCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>::cleanup();
extern template SOFA_MESH_COLLISION_API core::behavior::MechanicalState<defaulttype::Vec3Types>* RigidContactMapper<CylinderCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>::createMapping(const char*);
extern template SOFA_MESH_COLLISION_API void RigidContactMapper<CapsuleCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>::cleanup();
extern template SOFA_MESH_COLLISION_API core::behavior::MechanicalState<defaulttype::Vec3Types>* RigidContactMapper<CapsuleCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>::createMapping(const char*);
extern template SOFA_MESH_COLLISION_API void RigidContactMapper<RigidSphereModel, defaulttype::Vec3Types>::cleanup();
extern template SOFA_MESH_COLLISION_API core::behavior::MechanicalState<defaulttype::Vec3Types>* RigidContactMapper<RigidSphereModel, defaulttype::Vec3Types>::createMapping(const char*);
extern template SOFA_MESH_COLLISION_API void RigidContactMapper<OBBCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>::cleanup();
extern template SOFA_MESH_COLLISION_API core::behavior::MechanicalState<defaulttype::Vec3Types>* RigidContactMapper<OBBCollisionModel<sofa::defaulttype::Rigid3Types>, defaulttype::Vec3Types>::createMapping(const char*);
#endif
} // namespace collision
} // namespace component
} // namespace sofa
#endif /* SOFA_COMPONENT_COLLISION_RIGIDCONTACTMAPPER_H */
|
{
"pile_set_name": "Github"
}
|
/* - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. */
%include ../shared.inc
%include ../../../shared/in-content/common.inc.css
xul|tabs {
padding-right: 0;
padding-left: 0;
}
xul|tab[selected] {
text-shadow: none;
}
xul|button,
xul|colorpicker[type="button"],
xul|menulist {
margin-top: 3px;
}
xul|menulist:not([editable="true"]) > xul|menupopup > xul|menuitem[checked="true"]::before,
xul|menulist:not([editable="true"]) > xul|menupopup > xul|menuitem[selected="true"]::before {
display: none;
}
xul|menulist:not([editable="true"]) > xul|*.menulist-dropmarker {
display: -moz-box;
margin-top: 1px;
margin-bottom: 1px;
}
xul|menulist > xul|menupopup xul|menu,
xul|menulist > xul|menupopup xul|menuitem,
xul|button[type="menu"] > xul|menupopup xul|menu,
xul|button[type="menu"] > xul|menupopup xul|menuitem {
-moz-padding-end: 34px;
}
xul|*.help-button > xul|*.button-box > xul|*.button-icon {
-moz-margin-start: 0;
}
xul|*.checkbox-icon {
margin-right: 0;
}
xul|*.radio-icon {
-moz-margin-end: 0;
}
xul|*.numberbox-input-box {
-moz-appearance: none;
border-width: 0;
}
xul|description {
font-size: 1.25rem;
line-height: 22px;
}
html|a:-moz-focusring,
xul|*.text-link:-moz-focusring,
xul|*.inline-link:-moz-focusring {
outline-width: 0;
box-shadow: @focusRingShadow@;
}
|
{
"pile_set_name": "Github"
}
|
import React from 'react'
import { Grid, Image } from 'semantic-ui-react'
const GridExampleRelaxedVery = () => (
<Grid relaxed='very' columns={4}>
<Grid.Column>
<Image src='/images/wireframe/image.png' />
</Grid.Column>
<Grid.Column>
<Image src='/images/wireframe/image.png' />
</Grid.Column>
<Grid.Column>
<Image src='/images/wireframe/image.png' />
</Grid.Column>
<Grid.Column>
<Image src='/images/wireframe/image.png' />
</Grid.Column>
</Grid>
)
export default GridExampleRelaxedVery
|
{
"pile_set_name": "Github"
}
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Perform A/B Test using REST Endpoints"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can test and deploy new models behind a single SageMaker Endpoint with a concept called “production variants.” These variants can differ by hardware (CPU/GPU), by data (comedy/drama movies), or by region (US West or Germany North). You can shift traffic between the models in your endpoint for canary rollouts and blue/green deployments. You can split traffic for A/B tests. And you can configure your endpoint to automatically scale your endpoints out or in based on a given metric like requests per second. As more requests come in, SageMaker will automatically scale the model prediction API to meet the demand."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<img src=\"img/model_ab.png\" width=\"80%\" align=\"left\">"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can use traffic splitting to direct subsets of users to different model variants for the purpose of comparing and testing different models in live production. The goal is to see which variants perform better. Often, these tests need to run for a long period of time (weeks) to be statistically significant. The figure shows 2 different recommendation models deployed using a random 50-50 traffic split between the 2 variants."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import boto3\n",
"import sagemaker\n",
"import pandas as pd\n",
"\n",
"sess = sagemaker.Session()\n",
"bucket = sess.default_bucket()\n",
"role = sagemaker.get_execution_role()\n",
"region = boto3.Session().region_name\n",
"\n",
"sm = boto3.Session().client(service_name='sagemaker', region_name=region)\n",
"cw = boto3.Session().client(service_name='cloudwatch', region_name=region)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Clean Up Previous Endpoints to Save Resources"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r autopilot_endpoint_name"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"try: \n",
" autopilot_endpoint_name\n",
" sm.delete_endpoint(\n",
" EndpointName=autopilot_endpoint_name\n",
" )\n",
" print('Autopilot Endpoint has been deleted to save resources. This is good.') \n",
"except:\n",
" print('Endpoints are cleaned up. This is good. Keep moving forward!')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r training_job_name"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(training_job_name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Copy the Model to the Notebook"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"!aws s3 cp s3://$bucket/$training_job_name/output/model.tar.gz ./model.tar.gz"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!mkdir -p ./model/\n",
"!tar -xvzf ./model.tar.gz -C ./model/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Show the Prediction Signature"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!saved_model_cli show --all --dir ./model/tensorflow/saved_model/0/"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Show `inference.py`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pygmentize ./model/code/inference.py"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create Variant A Model From the Training Job in a Previous Section\n",
"\n",
"Notes:\n",
"* `primary_container_image` is required because the inference and training images are different.\n",
"* By default, the training image will be used, so we need to override it. \n",
"* See https://github.com/aws/sagemaker-python-sdk/issues/1379\n",
"* If you are not using a US-based region, you may need to adapt the container image to your current region using the following table:\n",
"\n",
"https://docs.aws.amazon.com/deep-learning-containers/latest/devguide/deep-learning-containers-images.html"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"timestamp = '{}'.format(int(time.time()))\n",
"\n",
"model_a_name = '{}-{}-{}'.format(training_job_name, 'varianta', timestamp)\n",
"\n",
"sess.create_model_from_job(name=model_a_name,\n",
" training_job_name=training_job_name,\n",
" role=role,\n",
" image_uri='763104351884.dkr.ecr.{}.amazonaws.com/tensorflow-inference:2.3.0-cpu-py37-ubuntu18.04'.format(region))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Create Variant B Model From the Training Job in a Previous Section\n",
"Notes:\n",
"* `primary_container_image` is required because the inference and training images are different.\n",
"* By default, the training image will be used, so we need to override it. See https://github.com/aws/sagemaker-python-sdk/issues/1379\n",
"* If you are not using a US-based region, you may need to adapt the container image to your current region using the following table:\n",
"\n",
"https://docs.aws.amazon.com/deep-learning-containers/latest/devguide/deep-learning-containers-images.html"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model_b_name = '{}-{}-{}'.format(training_job_name, 'variantb', timestamp)\n",
"\n",
"sess.create_model_from_job(name=model_b_name,\n",
" training_job_name=training_job_name,\n",
" role=role,\n",
" image_uri='763104351884.dkr.ecr.{}.amazonaws.com/tensorflow-inference:2.3.0-cpu-py37-ubuntu18.04'.format(region))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Canary Rollouts and A/B Testing"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Canary rollouts are used to release new models safely to only a small subset of users such as 5%. They are useful if you want to test in live production without affecting the entire user base. Since the majority of traffic goes to the existing model, the cluster size of the canary model can be relatively small since it’s only receiving 5% traffic."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Instead of `deploy()`, we can create an `Endpoint Configuration` with multiple variants for canary rollouts and A/B testing."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sagemaker.session import production_variant\n",
"\n",
"timestamp = '{}'.format(int(time.time()))\n",
"\n",
"endpoint_config_name = '{}-{}-{}'.format(training_job_name, 'abtest', timestamp)\n",
"\n",
"variantA = production_variant(model_name=model_a_name,\n",
" instance_type='ml.m5.4xlarge',\n",
" initial_instance_count=1,\n",
" variant_name='VariantA',\n",
" initial_weight=50)\n",
"\n",
"variantB = production_variant(model_name=model_b_name,\n",
" instance_type='ml.m5.4xlarge',\n",
" initial_instance_count=1,\n",
" variant_name='VariantB',\n",
" initial_weight=50)\n",
"\n",
"endpoint_config = sm.create_endpoint_config(\n",
" EndpointConfigName=endpoint_config_name,\n",
" ProductionVariants=[variantA, variantB]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"\n",
"display(HTML('<b>Review <a target=\"blank\" href=\"https://console.aws.amazon.com/sagemaker/home?region={}#/endpointConfig/{}\">REST Endpoint Configuration</a></b>'.format(region, endpoint_config_name)))\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model_ab_endpoint_name = '{}-{}-{}'.format(training_job_name, 'abtest', timestamp)\n",
"\n",
"endpoint_response = sm.create_endpoint(\n",
" EndpointName=model_ab_endpoint_name,\n",
" EndpointConfigName=endpoint_config_name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Store Endpoint Name for Next Notebook(s)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store model_ab_endpoint_name"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Track the Deployment Within our Experiment"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r experiment_name"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(experiment_name)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -r trial_name"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(trial_name)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from smexperiments.trial import Trial\n",
"\n",
"timestamp = '{}'.format(int(time.time()))\n",
"\n",
"trial = Trial.load(trial_name=trial_name)\n",
"print(trial)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from smexperiments.tracker import Tracker\n",
"\n",
"tracker_deploy = Tracker.create(display_name='deploy', \n",
" sagemaker_boto_client=sm)\n",
"\n",
"deploy_trial_component_name = tracker_deploy.trial_component.trial_component_name\n",
"print('Deploy trial component name {}'.format(deploy_trial_component_name))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Attach the `deploy` Trial Component and Tracker as a Component to the Trial"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"trial.add_trial_component(tracker_deploy.trial_component)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Track the Endpoint Name"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tracker_deploy.log_parameters({\n",
" 'endpoint_name': model_ab_endpoint_name,\n",
"})\n",
"\n",
"# must save after logging\n",
"tracker_deploy.trial_component.save()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sagemaker.analytics import ExperimentAnalytics\n",
"\n",
"lineage_table = ExperimentAnalytics(\n",
" sagemaker_session=sess,\n",
" experiment_name=experiment_name,\n",
" metric_names=['validation:accuracy'],\n",
" sort_by=\"CreationTime\",\n",
" sort_order=\"Ascending\",\n",
")\n",
"\n",
"lineage_df = lineage_table.dataframe()\n",
"lineage_df.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"lineage_df"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"\n",
"display(HTML('<b>Review <a target=\"blank\" href=\"https://console.aws.amazon.com/sagemaker/home?region={}#/endpoints/{}\">REST Endpoint</a></b>'.format(region, model_ab_endpoint_name)))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _Wait Until the Endpoint is Deployed_"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"waiter = sm.get_waiter('endpoint_in_service')\n",
"waiter.wait(EndpointName=model_ab_endpoint_name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _Wait Until the ^^ Endpoint ^^ is Deployed_"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Simulate a Prediction from an Application"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from sagemaker.tensorflow.model import TensorFlowPredictor\n",
"\n",
"predictor = TensorFlowPredictor(endpoint_name=model_ab_endpoint_name,\n",
" sagemaker_session=sess,\n",
" model_name='saved_model',\n",
" model_version=0)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Waiting for the Endpoint to be ready to Serve Predictions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"time.sleep(30)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Predict the `star_rating` with `review_body` Samples from our TSV's"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import csv\n",
"\n",
"df_reviews = pd.read_csv('./data/amazon_reviews_us_Digital_Software_v1_00.tsv.gz', \n",
" delimiter='\\t', \n",
" quoting=csv.QUOTE_NONE,\n",
" compression='gzip')\n",
"df_sample_reviews = df_reviews[['review_body', 'star_rating']].sample(n=50)\n",
"df_sample_reviews = df_sample_reviews.reset_index()\n",
"df_sample_reviews.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def predict(review_body):\n",
" return predictor.predict([review_body])[0]\n",
"\n",
"df_sample_reviews['predicted_class'] = df_sample_reviews['review_body'].map(predict)\n",
"df_sample_reviews.head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Predict the `star_rating` with Ad Hoc `review_body` Samples"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"reviews = [\"This is great!\", \n",
" \"This is not good.\"]\n",
"\n",
"predicted_classes = predictor.predict(reviews)\n",
"\n",
"for predicted_class, review in zip(predicted_classes, reviews):\n",
" print('[Predicted Star Rating: {}]'.format(predicted_class), review)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Review the REST Endpoint Performance Metrics in CloudWatch"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"\n",
"display(HTML('<b>Review <a target=\"blank\" href=\"https://console.aws.amazon.com/sagemaker/home?region={}#/endpoints/{}\">REST Endpoint Performance Metrics</a></b>'.format(region, model_ab_endpoint_name)))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Review the REST Endpoint Performance Metrics in a Dataframe\n",
"\n",
"Amazon SageMaker emits metrics such as Latency and Invocations (full list of metrics [here](https://alpha-docs-aws.amazon.com/sagemaker/latest/dg/monitoring-cloudwatch.html)) for each variant in Amazon CloudWatch. Let’s query CloudWatch to get the InvocationsPerVariant to show how invocations are split across variants."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from datetime import datetime, timedelta\n",
"\n",
"import boto3\n",
"import pandas as pd\n",
"\n",
"def get_invocation_metrics_for_endpoint_variant(endpoint_name,\n",
" namespace_name,\n",
" metric_name,\n",
" variant_name,\n",
" start_time,\n",
" end_time):\n",
" metrics = cw.get_metric_statistics(\n",
" Namespace=namespace_name,\n",
" MetricName=metric_name,\n",
" StartTime=start_time,\n",
" EndTime=end_time,\n",
" Period=60,\n",
" Statistics=[\"Sum\"],\n",
" Dimensions=[\n",
" {\n",
" \"Name\": \"EndpointName\",\n",
" \"Value\": endpoint_name\n",
" },\n",
" {\n",
" \"Name\": \"VariantName\",\n",
" \"Value\": variant_name\n",
" }\n",
" ]\n",
" )\n",
"\n",
" if metrics['Datapoints']:\n",
" return pd.DataFrame(metrics[\"Datapoints\"])\\\n",
" .sort_values(\"Timestamp\")\\\n",
" .set_index(\"Timestamp\")\\\n",
" .drop(\"Unit\", axis=1)\\\n",
" .rename(columns={\"Sum\": variant_name})\n",
" else:\n",
" return pd.DataFrame()\n",
"\n",
"\n",
"def plot_endpoint_metrics_for_variants(endpoint_name,\n",
" namespace_name,\n",
" metric_name,\n",
" start_time=None):\n",
" try:\n",
" start_time = start_time or datetime.now() - timedelta(minutes=60)\n",
" end_time = datetime.now()\n",
"\n",
" metrics_variantA = get_invocation_metrics_for_endpoint_variant(endpoint_name=model_ab_endpoint_name, \n",
" namespace_name=namespace_name,\n",
" metric_name=metric_name,\n",
" variant_name=variantA[\"VariantName\"], \n",
" start_time=start_time, \n",
" end_time=end_time)\n",
"\n",
" metrics_variantB = get_invocation_metrics_for_endpoint_variant(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name=namespace_name,\n",
" metric_name=metric_name, \n",
" variant_name=variantB[\"VariantName\"], \n",
" start_time=start_time, \n",
" end_time=end_time)\n",
"\n",
" metrics_variants = metrics_variantA.join(metrics_variantB, how=\"outer\")\n",
" metrics_variants.plot()\n",
" except:\n",
" pass\n",
" "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Show the Metrics for Each Variant\n",
"If you see `Metrics not yet available`, please be patient as metrics may take a few mins to appear in CloudWatch.\n",
"\n",
"Also, make sure the predictions ran successfully above."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(20)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='/aws/sagemaker/Endpoints',\n",
" metric_name='CPUUtilization')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='Invocations')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='InvocationsPerInstance')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='ModelLatency')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Shift All Traffic to Variant B\n",
"_**No downtime** occurs during this traffic-shift activity._\n",
"\n",
"This may take a few minutes. Please be patient."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"updated_endpoint_config = [\n",
" {\n",
" 'VariantName': variantA['VariantName'],\n",
" 'DesiredWeight': 0,\n",
" },\n",
" {\n",
" 'VariantName': variantB['VariantName'],\n",
" 'DesiredWeight': 100,\n",
" }\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sm.update_endpoint_weights_and_capacities(\n",
" EndpointName=model_ab_endpoint_name,\n",
" DesiredWeightsAndCapacities=updated_endpoint_config\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"\n",
"display(HTML('<b>Review <a target=\"blank\" href=\"https://console.aws.amazon.com/sagemaker/home?region={}#/endpoints/{}\">REST Endpoint</a></b>'.format(region, model_ab_endpoint_name)))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _Wait for the ^^ Endpoint Update ^^ to Complete Above_\n",
"This may take a few minutes. Please be patient."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"waiter = sm.get_waiter('endpoint_in_service')\n",
"waiter.wait(EndpointName=model_ab_endpoint_name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Run Some More Predictions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def predict(review_body):\n",
" return predictor.predict([review_body])[0]\n",
"\n",
"df_sample_reviews['predicted_class'] = df_sample_reviews['review_body'].map(predict)\n",
"df_sample_reviews"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Show the Metrics for Each Variant\n",
"If you see `Metrics not yet available`, please be patient as metrics may take a few mins to appear in CloudWatch.\n",
"\n",
"Also, make sure the predictions ran successfully above."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(20)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='/aws/sagemaker/Endpoints',\n",
" metric_name='CPUUtilization')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='Invocations')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='InvocationsPerInstance')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='ModelLatency')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Remove Variant A to Reduce Cost\n",
"Modify the Endpoint Configuration to only use variant B.\n",
"\n",
"_**No downtime** occurs during this scale-down activity._\n",
"\n",
"This may take a few mins. Please be patient."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"timestamp = '{}'.format(int(time.time()))\n",
"\n",
"updated_endpoint_config_name = '{}-{}'.format(training_job_name, timestamp)\n",
"\n",
"updated_endpoint_config = sm.create_endpoint_config(\n",
" EndpointConfigName=updated_endpoint_config_name,\n",
" ProductionVariants=[\n",
" {\n",
" 'VariantName': variantB['VariantName'],\n",
" 'ModelName': model_b_name, # Only specify variant B to remove variant A\n",
" 'InstanceType':'ml.m5.4xlarge',\n",
" 'InitialInstanceCount': 1,\n",
" 'InitialVariantWeight': 100\n",
" }\n",
" ])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"sm.update_endpoint(\n",
" EndpointName=model_ab_endpoint_name,\n",
" EndpointConfigName=updated_endpoint_config_name\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _If You See An ^^ Error ^^ Above, Please Wait Until the Endpoint is Updated_"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.core.display import display, HTML\n",
"\n",
"display(HTML('<b>Review <a target=\"blank\" href=\"https://console.aws.amazon.com/sagemaker/home?region={}#/endpoints/{}\">REST Endpoint</a></b>'.format(region, model_ab_endpoint_name)))\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# _Wait for the ^^ Endpoint Update ^^ to Complete Above_\n",
"This may take a few minutes. Please be patient."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"waiter = sm.get_waiter('endpoint_in_service')\n",
"waiter.wait(EndpointName=model_ab_endpoint_name)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Run Some More Predictions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def predict(review_body):\n",
" return predictor.predict([review_body])[0]\n",
"\n",
"df_sample_reviews['predicted_class'] = df_sample_reviews['review_body'].map(predict)\n",
"df_sample_reviews"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Show the Metrics for Each Variant\n",
"If you see `Metrics not yet available`, please be patient as metrics may take a few mins to appear in CloudWatch.\n",
"\n",
"Also, make sure the predictions ran successfully above."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(20)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='/aws/sagemaker/Endpoints',\n",
" metric_name='CPUUtilization')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='Invocations')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='InvocationsPerInstance')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'\n",
"\n",
"time.sleep(5)\n",
"plot_endpoint_metrics_for_variants(endpoint_name=model_ab_endpoint_name,\n",
" namespace_name='AWS/SageMaker', \n",
" metric_name='ModelLatency')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Delete Endpoint\n",
"To save money, we should delete the endpoint."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sm.delete_endpoint(\n",
" EndpointName=model_ab_endpoint_name\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# More Links\n",
"* Optimize Cost with TensorFlow and Elastic Inference\n",
"https://aws.amazon.com/blogs/machine-learning/optimizing-costs-in-amazon-elastic-inference-with-amazon-tensorflow/\n",
"\n",
"* Using API Gateway with SageMaker Endpoints\n",
"https://aws.amazon.com/blogs/machine-learning/creating-a-machine-learning-powered-rest-api-with-amazon-api-gateway-mapping-templates-and-amazon-sagemaker/"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%%javascript\n",
"Jupyter.notebook.save_checkpoint();\n",
"Jupyter.notebook.session.delete();"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "conda_python3",
"language": "python",
"name": "conda_python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="cn.crap.dao.mybatis.ErrorDao" >
<resultMap id="BaseResultMap" type="cn.crap.model.Error" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="errorCode" property="errorCode" jdbcType="VARCHAR" />
<result column="errorMsg" property="errorMsg" jdbcType="VARCHAR" />
<result column="projectId" property="projectId" jdbcType="VARCHAR" />
<result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="sequence" property="sequence" jdbcType="INTEGER" />
</resultMap>
<sql id="Example_Where_Clause" >
<where >
<foreach collection="oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause" >
<where >
<foreach collection="example.oredCriteria" item="criteria" separator="or" >
<if test="criteria.valid" >
<trim prefix="(" suffix=")" prefixOverrides="and" >
<foreach collection="criteria.criteria" item="criterion" >
<choose >
<when test="criterion.noValue" >
and ${criterion.condition}
</when>
<when test="criterion.singleValue" >
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue" >
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue" >
and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List" >
id, errorCode, errorMsg, projectId, createTime, status, sequence
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="cn.crap.model.ErrorCriteria" >
select
<if test="distinct" >
distinct
</if>
<include refid="Base_Column_List" />
from error
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null" >
order by ${orderByClause}
</if>
<choose >
<when test="limitStart != null and limitStart != -1 and maxResults != null and maxResults != -1" >
limit ${limitStart} , ${maxResults}
</when>
<when test="limitStart != null and limitStart != -1" >
limit ${limitStart}
</when>
</choose>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from error
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from error
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="cn.crap.model.ErrorCriteria" >
delete from error
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="cn.crap.model.Error" >
insert into error (id, errorCode, errorMsg,
projectId, createTime, status,
sequence)
values (#{id,jdbcType=VARCHAR}, #{errorCode,jdbcType=VARCHAR}, #{errorMsg,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT},
#{sequence,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="cn.crap.model.Error" >
insert into error
<trim prefix="(" suffix=")" suffixOverrides="," >
id,
<if test="errorCode != null" >
errorCode,
</if>
<if test="errorMsg != null" >
errorMsg,
</if>
<if test="projectId != null" >
projectId,
</if>
<if test="createTime != null" >
createTime,
</if>
<if test="status != null" >
status,
</if>
<if test="sequence != null" >
sequence,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
#{id,jdbcType=VARCHAR},
<if test="errorCode != null" >
#{errorCode,jdbcType=VARCHAR},
</if>
<if test="errorMsg != null" >
#{errorMsg,jdbcType=VARCHAR},
</if>
<if test="projectId != null" >
#{projectId,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="sequence != null" >
#{sequence,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cn.crap.model.ErrorCriteria" resultType="java.lang.Integer" >
select count(*) from error
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update error
<set >
<if test="record.id != null" >
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.errorCode != null" >
errorCode = #{record.errorCode,jdbcType=VARCHAR},
</if>
<if test="record.errorMsg != null" >
errorMsg = #{record.errorMsg,jdbcType=VARCHAR},
</if>
<if test="record.projectId != null" >
projectId = #{record.projectId,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null" >
createTime = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null" >
status = #{record.status,jdbcType=TINYINT},
</if>
<if test="record.sequence != null" >
sequence = #{record.sequence,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map" >
update error
set id = #{record.id,jdbcType=VARCHAR},
errorCode = #{record.errorCode,jdbcType=VARCHAR},
errorMsg = #{record.errorMsg,jdbcType=VARCHAR},
projectId = #{record.projectId,jdbcType=VARCHAR},
createTime = #{record.createTime,jdbcType=TIMESTAMP},
status = #{record.status,jdbcType=TINYINT},
sequence = #{record.sequence,jdbcType=INTEGER}
<if test="_parameter != null" >
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="cn.crap.model.Error" >
update error
<set >
<if test="errorCode != null" >
errorCode = #{errorCode,jdbcType=VARCHAR},
</if>
<if test="errorMsg != null" >
errorMsg = #{errorMsg,jdbcType=VARCHAR},
</if>
<if test="projectId != null" >
projectId = #{projectId,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
createTime = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
status = #{status,jdbcType=TINYINT},
</if>
<if test="sequence != null" >
sequence = #{sequence,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cn.crap.model.Error" >
update error
set errorCode = #{errorCode,jdbcType=VARCHAR},
errorMsg = #{errorMsg,jdbcType=VARCHAR},
projectId = #{projectId,jdbcType=VARCHAR},
createTime = #{createTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=TINYINT},
sequence = #{sequence,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
|
{
"pile_set_name": "Github"
}
|
[Scheme]
Name=Whimsy
ColorForeground=#b3b0d6
ColorBackground=#29283b
ColorCursor=#b3b0d6
ColorPalette=#535178;#ef6487;#5eca89;#fdd877;#65aef7;#aa7ff0;#43c1be;#ffffff;#535178;#ef6487;#5eca89;#fdd877;#65aef7;#aa7ff0;#43c1be;#ffffff
|
{
"pile_set_name": "Github"
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "../source/codegen_source_base.h"
namespace tvm {
namespace runtime {
Module HexagonModuleCreate(std::string data, std::string fmt,
std::unordered_map<std::string, FunctionInfo> fmap, std::string asm_str,
std::string obj_str, std::string ir_str, std::string bc_str,
const std::set<std::string>& packed_c_abi) {
LOG(WARNING) << "Hexagon runtime is not enabled, return a source module...";
return codegen::DeviceSourceModuleCreate(data, fmt, fmap, "hex");
}
} // namespace runtime
} // namespace tvm
|
{
"pile_set_name": "Github"
}
|
K 13
svn:eol-style
V 6
native
END
|
{
"pile_set_name": "Github"
}
|
/**
* Converts `iterator` to an array.
*
* @private
* @param {Object} iterator The iterator to convert.
* @returns {Array} Returns the converted array.
*/
function iteratorToArray(iterator) {
var data,
result = [];
while (!(data = iterator.next()).done) {
result.push(data.value);
}
return result;
}
module.exports = iteratorToArray;
|
{
"pile_set_name": "Github"
}
|
package me.corriekay.pokegoutil.data.managers;
import java.lang.reflect.Field;
import java.nio.charset.Charset;
import me.corriekay.pokegoutil.gui.controller.LogController;
import me.corriekay.pokegoutil.utils.logging.ConsolePrintStream;
/**
* Global controller to access all settings controllers.
*/
public final class GlobalSettingsController {
private static GlobalSettingsController instance;
private LogController logController;
/**
* Instantiate a GlobalSettingsController.
*/
private GlobalSettingsController() {
consoleSetup();
}
/**
* Setup the GlobalSettingController if it has not been initialized.
*/
public static void setup() {
if (instance == null) {
instance = new GlobalSettingsController();
}
}
/**
* Get instance of GlobalSettingController.
*
* @return instance of GlobalSettingController
*/
public static GlobalSettingsController getGlobalSettingsController() {
if (instance == null) {
setup();
}
return instance;
}
/**
* Setup of console.
*/
private void consoleSetup() {
logController = new LogController();
ConsolePrintStream.setup(logController);
}
/**
* Get the log controller instance.
*
* @return log controller instance
*/
public LogController getLogController() {
return logController;
}
}
|
{
"pile_set_name": "Github"
}
|
#
# (C) Copyright 2000-2006
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# SPDX-License-Identifier: GPL-2.0+
#
obj-y := conxs.o eeprom.o
|
{
"pile_set_name": "Github"
}
|
/* Tajiki (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Abdurahmon Saidov (saidovab@gmail.com). */
(function( factory ) {
if ( typeof define === "function" && define.amd ) {
// AMD. Register as an anonymous module.
define([ "../datepicker" ], factory );
} else {
// Browser globals
factory( jQuery.datepicker );
}
}(function( datepicker ) {
datepicker.regional['tj'] = {
closeText: 'Идома',
prevText: '<Қафо',
nextText: 'Пеш>',
currentText: 'Имрӯз',
monthNames: ['Январ','Феврал','Март','Апрел','Май','Июн',
'Июл','Август','Сентябр','Октябр','Ноябр','Декабр'],
monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
'Июл','Авг','Сен','Окт','Ноя','Дек'],
dayNames: ['якшанбе','душанбе','сешанбе','чоршанбе','панҷшанбе','ҷумъа','шанбе'],
dayNamesShort: ['якш','душ','сеш','чор','пан','ҷум','шан'],
dayNamesMin: ['Як','Дш','Сш','Чш','Пш','Ҷм','Шн'],
weekHeader: 'Хф',
dateFormat: 'dd.mm.yy',
firstDay: 1,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
datepicker.setDefaults(datepicker.regional['tj']);
return datepicker.regional['tj'];
}));
|
{
"pile_set_name": "Github"
}
|
# About Application.cr File
#
# This is Amber application main entry point. This file is responsible for loading
# initializers, classes, and all application related code in order to have
# Amber::Server boot up.
#
# > We recommend not modifying the order of the requires since the order will
# affect the behavior of the application.
require "amber"
require "./settings"
require "./logger"
require "./i18n"
require "./database"
require "./initializers/**"
# Start Generator Dependencies: Don't modify.
# End Generator Dependencies
require "../src/controllers/application_controller"
require "../src/controllers/**"
require "./routes"
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
Name="Tuple"
Version="8.00"
ProjectType="Visual C++"
ProjectGUID="{F143DA5A-221A-3737-BCBA-F5BFD977038F}"
RootNamespace="Tuple"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<ToolFiles/>
<Configurations>
<Configuration
Name="debug_shared|Win32"
OutputDirectory="obj\$(ConfigurationName)"
IntermediateDirectory="obj\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings=""
AdditionalOptions=""/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib"
OutputFile="bin\Tupled.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin\Tupled.pdb"
SubSystem="1"
TargetMachine="1"
AdditionalOptions=""/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="VCPostBuildEventTool"/>
</Configuration>
<Configuration
Name="release_shared|Win32"
OutputDirectory="obj\$(ConfigurationName)"
IntermediateDirectory="obj\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="0"
DisableSpecificWarnings=""
AdditionalOptions=""/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib"
OutputFile="bin\Tuple.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
AdditionalOptions=""/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="VCPostBuildEventTool"/>
</Configuration>
<Configuration
Name="debug_static_mt|Win32"
OutputDirectory="obj\$(ConfigurationName)"
IntermediateDirectory="obj\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings=""
AdditionalOptions=""/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib winmm.lib iphlpapi.lib"
OutputFile="bin\static_mt\Tupled.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin\static_mt\Tupled.pdb"
SubSystem="1"
TargetMachine="1"
AdditionalOptions=""/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="VCPostBuildEventTool"/>
</Configuration>
<Configuration
Name="release_static_mt|Win32"
OutputDirectory="obj\$(ConfigurationName)"
IntermediateDirectory="obj\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;"
StringPooling="true"
RuntimeLibrary="0"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="0"
DisableSpecificWarnings=""
AdditionalOptions=""/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib winmm.lib iphlpapi.lib"
OutputFile="bin\static_mt\Tuple.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
AdditionalOptions=""/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="VCPostBuildEventTool"/>
</Configuration>
<Configuration
Name="debug_static_md|Win32"
OutputDirectory="obj\$(ConfigurationName)"
IntermediateDirectory="obj\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;"
StringPooling="true"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
CompileAs="0"
DisableSpecificWarnings=""
AdditionalOptions=""/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib winmm.lib iphlpapi.lib"
OutputFile="bin\static_md\Tupled.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin\static_md\Tupled.pdb"
SubSystem="1"
TargetMachine="1"
AdditionalOptions=""/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="VCPostBuildEventTool"/>
</Configuration>
<Configuration
Name="release_static_md|Win32"
OutputDirectory="obj\$(ConfigurationName)"
IntermediateDirectory="obj\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCCLCompilerTool"
Optimization="4"
InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Data\include;..\..\..\Data\SQLite\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;WINVER=0x0500;POCO_STATIC;"
StringPooling="true"
RuntimeLibrary="2"
BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
CompileAs="0"
DisableSpecificWarnings=""
AdditionalOptions=""/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="iphlpapi.lib winmm.lib iphlpapi.lib"
OutputFile="bin\static_md\Tuple.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
AdditionalOptions=""/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="VCBscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="VCPostBuildEventTool"/>
</Configuration>
</Configurations>
<References/>
<Files>
<Filter
Name="Header Files"/>
<Filter
Name="Source Files">
<File
RelativePath=".\src\Tuple.cpp"/>
</Filter>
</Files>
<Globals/>
</VisualStudioProject>
|
{
"pile_set_name": "Github"
}
|
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
// container
#include <boost/container/allocator_traits.hpp>
// container/detail
#include <boost/container/detail/iterator.hpp>
#include <boost/container/detail/iterator_to_raw_pointer.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/type_traits.hpp>
// move
#include <boost/move/adl_move_swap.hpp>
#include <boost/move/iterator.hpp>
#include <boost/move/utility_core.hpp>
// other
#include <boost/core/no_exceptions_support.hpp>
// std
#include <cstring> //for emmove/memcpy
namespace boost {
namespace container {
namespace container_detail {
template<class I>
struct are_elements_contiguous
{
static const bool value = false;
};
/////////////////////////
// raw pointers
/////////////////////////
template<class T>
struct are_elements_contiguous<T*>
{
static const bool value = true;
};
/////////////////////////
// move iterators
/////////////////////////
template<class It>
struct are_elements_contiguous< ::boost::move_iterator<It> >
: are_elements_contiguous<It>
{};
/////////////////////////
// predeclarations
/////////////////////////
#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
template<class Pointer>
class vector_iterator;
template<class Pointer>
class vector_const_iterator;
#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
} //namespace container_detail {
} //namespace container {
namespace interprocess {
template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
class offset_ptr;
} //namespace interprocess {
namespace container {
namespace container_detail {
/////////////////////////
//vector_[const_]iterator
/////////////////////////
#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
template<class Pointer>
struct are_elements_contiguous<boost::container::container_detail::vector_iterator<Pointer> >
{
static const bool value = true;
};
template<class Pointer>
struct are_elements_contiguous<boost::container::container_detail::vector_const_iterator<Pointer> >
{
static const bool value = true;
};
#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
/////////////////////////
// offset_ptr
/////////////////////////
template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
struct are_elements_contiguous< ::boost::interprocess::offset_ptr<PointedType, DifferenceType, OffsetType, OffsetAlignment> >
{
static const bool value = true;
};
template <typename I, typename O>
struct are_contiguous_and_same
: boost::move_detail::and_
< are_elements_contiguous<I>
, are_elements_contiguous<O>
, is_same< typename remove_const< typename ::boost::container::iterator_traits<I>::value_type >::type
, typename ::boost::container::iterator_traits<O>::value_type
>
>
{};
template <typename I, typename O>
struct is_memtransfer_copy_assignable
: boost::move_detail::and_
< are_contiguous_and_same<I, O>
, container_detail::is_trivially_copy_assignable< typename ::boost::container::iterator_traits<I>::value_type >
>
{};
template <typename I, typename O>
struct is_memtransfer_copy_constructible
: boost::move_detail::and_
< are_contiguous_and_same<I, O>
, container_detail::is_trivially_copy_constructible< typename ::boost::container::iterator_traits<I>::value_type >
>
{};
template <typename I, typename O, typename R>
struct enable_if_memtransfer_copy_constructible
: enable_if<container_detail::is_memtransfer_copy_constructible<I, O>, R>
{};
template <typename I, typename O, typename R>
struct disable_if_memtransfer_copy_constructible
: disable_if<container_detail::is_memtransfer_copy_constructible<I, O>, R>
{};
template <typename I, typename O, typename R>
struct enable_if_memtransfer_copy_assignable
: enable_if<container_detail::is_memtransfer_copy_assignable<I, O>, R>
{};
template <typename I, typename O, typename R>
struct disable_if_memtransfer_copy_assignable
: disable_if<container_detail::is_memtransfer_copy_assignable<I, O>, R>
{};
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F memmove(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
{
typedef typename boost::container::iterator_traits<I>::value_type value_type;
typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l);
if(n){
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
boost::container::iterator_advance(r, n);
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F memmove_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{
typedef typename boost::container::iterator_traits<I>::value_type value_type;
if(n){
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
boost::container::iterator_advance(r, n);
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
I memmove_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{
if(n){
typedef typename boost::container::iterator_traits<I>::value_type value_type;
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
boost::container::iterator_advance(f, n);
}
return f;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
I memmove_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
{
typedef typename boost::container::iterator_traits<I>::value_type value_type;
if(n){
std::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
boost::container::iterator_advance(f, n);
boost::container::iterator_advance(r, n);
}
return f;
}
template <typename O>
struct is_memzero_initializable
{
typedef typename ::boost::container::iterator_traits<O>::value_type value_type;
static const bool value = are_elements_contiguous<O>::value &&
( container_detail::is_integral<value_type>::value || container_detail::is_enum<value_type>::value
#if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL)
|| container_detail::is_pointer<value_type>::value
#endif
#if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO)
|| container_detail::is_floating_point<value_type>::value
#endif
#if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) && defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL)
|| container_detail::is_pod<value_type>::value
#endif
);
};
template <typename O, typename R>
struct enable_if_memzero_initializable
: enable_if_c<container_detail::is_memzero_initializable<O>::value, R>
{};
template <typename O, typename R>
struct disable_if_memzero_initializable
: enable_if_c<!container_detail::is_memzero_initializable<O>::value, R>
{};
template <typename I, typename R>
struct enable_if_trivially_destructible
: enable_if_c < container_detail::is_trivially_destructible
<typename boost::container::iterator_traits<I>::value_type>::value
, R>
{};
template <typename I, typename R>
struct disable_if_trivially_destructible
: enable_if_c <!container_detail::is_trivially_destructible
<typename boost::container::iterator_traits<I>::value_type>::value
, R>
{};
} //namespace container_detail {
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move_alloc
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; f != l; ++r, ++f)
//! allocator_traits::construct(a, &*r, boost::move(*f));
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_move_alloc(Allocator &a, I f, I l, F r)
{
F back = r;
BOOST_TRY{
while (f != l) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_move_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove(f, l, r); }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r, boost::move(*f));
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move_alloc_n_source
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r, boost::move(*f));
//! \endcode
//!
//! <b>Returns</b>: f (after incremented)
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type
uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return f;
}
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type
uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n_source(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_alloc
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; f != l; ++r, ++f)
//! allocator_traits::construct(a, &*r, *f);
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_copy_alloc(Allocator &a, I f, I l, F r)
{
F back = r;
BOOST_TRY{
while (f != l) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_copy_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove(f, l, r); }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r, *f);
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_alloc_n_source
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r, *f);
//! \endcode
//!
//! <b>Returns</b>: f (after incremented)
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type
uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return f;
}
template
<typename Allocator,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type
uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n_source(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_value_init_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r);
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memzero_initializable<F, F>::type
uninitialized_value_init_alloc_n(Allocator &a, typename allocator_traits<Allocator>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r));
++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
template
<typename Allocator,
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memzero_initializable<F, F>::type
uninitialized_value_init_alloc_n(Allocator &, typename allocator_traits<Allocator>::difference_type n, F r)
{
typedef typename boost::container::iterator_traits<F>::value_type value_type;
std::memset((void*)container_detail::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n);
boost::container::iterator_advance(r, n);
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_default_init_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r);
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename F> // F models ForwardIterator
inline F uninitialized_default_init_alloc_n(Allocator &a, typename allocator_traits<Allocator>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), default_init);
++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_fill_alloc
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; f != l; ++r, ++f)
//! allocator_traits::construct(a, &*r, *f);
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename F, // F models ForwardIterator
typename T>
inline void uninitialized_fill_alloc(Allocator &a, F f, F l, const T &t)
{
F back = f;
BOOST_TRY{
while (f != l) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(f), t);
++f;
}
}
BOOST_CATCH(...){
for (; back != l; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
}
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_fill_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++r, ++f)
//! allocator_traits::construct(a, &*r, v);
//! \endcode
//!
//! <b>Returns</b>: r
template
<typename Allocator,
typename T,
typename F> // F models ForwardIterator
inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename allocator_traits<Allocator>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<Allocator>::construct(a, container_detail::iterator_to_raw_pointer(r), v);
++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// copy
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
copy(I f, I l, F r)
{
while (f != l) {
*r = *f;
++f; ++r;
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
copy(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove(f, l, r); }
//////////////////////////////////////////////////////////////////////////////
//
// copy_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
copy_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
while (n--) {
*r = *f;
++f; ++r;
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
copy_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// copy_n_source
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
copy_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
while (n--) {
*r = *f;
++f; ++r;
}
return f;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
copy_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n_source(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// copy_n_source_dest
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
copy_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r)
{
while (n--) {
*r = *f;
++f; ++r;
}
return f;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
copy_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n_source_dest(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// move
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
move(I f, I l, F r)
{
while (f != l) {
*r = ::boost::move(*f);
++f; ++r;
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
move(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove(f, l, r); }
//////////////////////////////////////////////////////////////////////////////
//
// move_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
move_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
while (n--) {
*r = ::boost::move(*f);
++f; ++r;
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
move_n(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// move_backward
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models BidirectionalIterator
typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
move_backward(I f, I l, F r)
{
while (f != l) {
--l; --r;
*r = ::boost::move(*l);
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
move_backward(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW
{
typedef typename boost::container::iterator_traits<I>::value_type value_type;
const typename boost::container::iterator_traits<I>::difference_type n = boost::container::iterator_distance(f, l);
r -= n;
std::memmove((container_detail::iterator_to_raw_pointer)(r), (container_detail::iterator_to_raw_pointer)(f), sizeof(value_type)*n);
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// move_n_source_dest
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I // I models InputIterator
,typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
move_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r)
{
while (n--) {
*r = ::boost::move(*f);
++f; ++r;
}
return f;
}
template
<typename I // I models InputIterator
,typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
move_n_source_dest(I f, typename boost::container::iterator_traits<I>::difference_type n, F &r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n_source_dest(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// move_n_source
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I // I models InputIterator
,typename F> // F models ForwardIterator
inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
move_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r)
{
while (n--) {
*r = ::boost::move(*f);
++f; ++r;
}
return f;
}
template
<typename I // I models InputIterator
,typename F> // F models ForwardIterator
inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
move_n_source(I f, typename boost::container::iterator_traits<I>::difference_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW
{ return container_detail::memmove_n_source(f, n, r); }
//////////////////////////////////////////////////////////////////////////////
//
// destroy_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename Allocator
,typename I // I models InputIterator
,typename U> // U models unsigned integral constant
inline typename container_detail::disable_if_trivially_destructible<I, void>::type
destroy_alloc_n(Allocator &a, I f, U n)
{
while(n--){
allocator_traits<Allocator>::destroy(a, container_detail::iterator_to_raw_pointer(f));
++f;
}
}
template
<typename Allocator
,typename I // I models InputIterator
,typename U> // U models unsigned integral constant
inline typename container_detail::enable_if_trivially_destructible<I, void>::type
destroy_alloc_n(Allocator &, I, U)
{}
//////////////////////////////////////////////////////////////////////////////
//
// deep_swap_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
template
<std::size_t MaxTmpBytes
,typename Allocator
,typename F // F models ForwardIterator
,typename G // G models ForwardIterator
>
inline typename container_detail::disable_if_memtransfer_copy_assignable<F, G, void>::type
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
{
typename allocator_traits<Allocator>::size_type n = 0;
for (; n != n_i ; ++short_range_f, ++large_range_f, ++n){
boost::adl_move_swap(*short_range_f, *large_range_f);
}
boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
}
static const std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes
template
<std::size_t MaxTmpBytes
,typename Allocator
,typename F // F models ForwardIterator
,typename G // G models ForwardIterator
>
inline typename container_detail::enable_if_c
< container_detail::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false
, void>::type
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
{
typedef typename allocator_traits<Allocator>::value_type value_type;
typedef typename container_detail::aligned_storage
<MaxTmpBytes, container_detail::alignment_of<value_type>::value>::type storage_type;
storage_type storage;
const std::size_t n_i_bytes = sizeof(value_type)*n_i;
void *const large_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f));
void *const short_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f));
void *const stora_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(storage));
std::memcpy(stora_ptr, large_ptr, n_i_bytes);
std::memcpy(large_ptr, short_ptr, n_i_bytes);
std::memcpy(short_ptr, stora_ptr, n_i_bytes);
boost::container::iterator_advance(large_range_f, n_i);
boost::container::iterator_advance(short_range_f, n_i);
boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
}
template
<std::size_t MaxTmpBytes
,typename Allocator
,typename F // F models ForwardIterator
,typename G // G models ForwardIterator
>
inline typename container_detail::enable_if_c
< container_detail::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage)
, void>::type
deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits<Allocator>::size_type n_i
, G large_range_f, typename allocator_traits<Allocator>::size_type n_j)
{
typedef typename allocator_traits<Allocator>::value_type value_type;
typedef typename container_detail::aligned_storage
<DeepSwapAllocNMaxStorage, container_detail::alignment_of<value_type>::value>::type storage_type;
storage_type storage;
const std::size_t sizeof_storage = sizeof(storage);
std::size_t n_i_bytes = sizeof(value_type)*n_i;
char *large_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f)));
char *short_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f)));
char *stora_ptr = static_cast<char*>(static_cast<void*>(&storage));
std::size_t szt_times = n_i_bytes/sizeof_storage;
const std::size_t szt_rem = n_i_bytes%sizeof_storage;
//Loop unrolling using Duff's device, as it seems it helps on some architectures
const std::size_t Unroll = 4;
std::size_t n = (szt_times + (Unroll-1))/Unroll;
const std::size_t branch_number = (!szt_times)*Unroll + (szt_times % Unroll);
switch(branch_number){
case 4:
break;
case 0: do{
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
std::memcpy(large_ptr, short_ptr, sizeof_storage);
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
large_ptr += sizeof_storage;
short_ptr += sizeof_storage;
BOOST_CONTAINER_FALLTHOUGH
case 3:
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
std::memcpy(large_ptr, short_ptr, sizeof_storage);
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
large_ptr += sizeof_storage;
short_ptr += sizeof_storage;
BOOST_CONTAINER_FALLTHOUGH
case 2:
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
std::memcpy(large_ptr, short_ptr, sizeof_storage);
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
large_ptr += sizeof_storage;
short_ptr += sizeof_storage;
BOOST_CONTAINER_FALLTHOUGH
case 1:
std::memcpy(stora_ptr, large_ptr, sizeof_storage);
std::memcpy(large_ptr, short_ptr, sizeof_storage);
std::memcpy(short_ptr, stora_ptr, sizeof_storage);
large_ptr += sizeof_storage;
short_ptr += sizeof_storage;
} while(--n);
}
std::memcpy(stora_ptr, large_ptr, szt_rem);
std::memcpy(large_ptr, short_ptr, szt_rem);
std::memcpy(short_ptr, stora_ptr, szt_rem);
boost::container::iterator_advance(large_range_f, n_i);
boost::container::iterator_advance(short_range_f, n_i);
boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
}
//////////////////////////////////////////////////////////////////////////////
//
// copy_assign_range_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename Allocator
,typename I // F models InputIterator
,typename O // G models OutputIterator
>
void copy_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_traits<Allocator>::size_type n_i
, O out_start, typename allocator_traits<Allocator>::size_type n_o )
{
if (n_o < n_i){
inp_start = boost::container::copy_n_source_dest(inp_start, n_o, out_start); // may throw
boost::container::uninitialized_copy_alloc_n(a, inp_start, n_i - n_o, out_start);// may throw
}
else{
out_start = boost::container::copy_n(inp_start, n_i, out_start); // may throw
boost::container::destroy_alloc_n(a, out_start, n_o - n_i);
}
}
//////////////////////////////////////////////////////////////////////////////
//
// move_assign_range_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename Allocator
,typename I // F models InputIterator
,typename O // G models OutputIterator
>
void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_traits<Allocator>::size_type n_i
, O out_start, typename allocator_traits<Allocator>::size_type n_o )
{
if (n_o < n_i){
inp_start = boost::container::move_n_source_dest(inp_start, n_o, out_start); // may throw
boost::container::uninitialized_move_alloc_n(a, inp_start, n_i - n_o, out_start); // may throw
}
else{
out_start = boost::container::move_n(inp_start, n_i, out_start); // may throw
boost::container::destroy_alloc_n(a, out_start, n_o - n_i);
}
}
} //namespace container {
} //namespace boost {
#endif //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
|
{
"pile_set_name": "Github"
}
|
package com.mph.retrofitutils.http;
import com.mph.retrofitutils.RetrofitService;
import retrofit2.Call;
/**
* 文件上传基类
* Created by:hcs on 2016/10/20 11:29
* e_mail:aaron1539@163.com
*/
public abstract class BaseFileUpload {
public abstract Call getFileUploadCall(RetrofitService retrofitService);
}
|
{
"pile_set_name": "Github"
}
|
{% extends "reports/standard/partials/filter_panel.html" %}
{% load hq_shared_tags %}
{% load i18n %}
{% block report_filter_actions %}
<div id="savedReports"
class="{{ report_filter_form_action_css_class }}">
<button id="apply-filters" type="submit" class="filters btn disabled"
disabled="disabled"
data-loading-text="{% trans 'Generating Report...' %}"
data-standard-text="{% trans 'Apply' %}">
{% trans 'Apply' %}
</button>
{% if not report.is_admin %}
<div class="btn-group">
<button type="button" class="btn dropdown-toggle btn-default" data-toggle="dropdown">
{% trans 'Favorites' %} <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li data-bind="ifnot: reportConfigs().length">
<a href="#">{% trans "You don't have any favorites" %}</a>
</li>
<!-- ko foreach: reportConfigs -->
<li>
<a href="#" tabindex="-1"
data-bind="text: name, attr: { title: description }, click: $root.setConfigBeingViewed">
</a>
</li>
<!-- /ko -->
</ul>
</div>
<button class="btn btn-default" data-bind="click: setConfigBeingEdited">
{% trans "Save" %}...
</button>
{% endif %}
{% if report.is_emailable %}
<div style="display: inline-block; margin-left:0.5em;" class="label label-info" id="email-enabled">
<i class="fa fa-info-circle"></i> {% trans "Email Supported" %}
</div>
{% endif %}
{% include "reports/partials/save_reports_modal.html" %}
</div>
{% endblock %}
|
{
"pile_set_name": "Github"
}
|
-- Merging decision tree log ---
manifest
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:1:1-22:12
xmlns:android
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:1:11-69
package
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:2:5-25
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
android:versionName
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
android:versionCode
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
uses-permission#android.permission.INTERNET
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:4:5-67
android:name
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:4:22-64
application
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:6:5-20:19
MERGED from [com.android.support:appcompat-v7:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/AndroidManifest.xml:22:5-20
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:22:5-20
MERGED from [com.facebook.react:react-native:0.13.0] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.13.0/AndroidManifest.xml:13:5-20
MERGED from [org.webkit:android-jsc:r174650] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/org.webkit/android-jsc/r174650/AndroidManifest.xml:2:3-17
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:22:5-20
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:22:5-20
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:22:5-20
MERGED from [com.android.support:appcompat-v7:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/AndroidManifest.xml:22:5-20
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:22:5-20
android:label
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:8:7-39
android:allowBackup
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:7:7-33
android:icon
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:9:7-41
android:theme
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:10:7-38
activity#com.abcddd.MainActivity
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:11:7-18:18
android:label
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:13:9-41
android:name
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:12:9-37
intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:14:9-17:25
action#android.intent.action.MAIN
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:15:13-65
android:name
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:15:21-62
category#android.intent.category.LAUNCHER
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:16:13-73
android:name
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:16:23-70
activity#com.facebook.react.devsupport.DevSettingsActivity
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:19:7-84
android:name
ADDED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:19:17-81
uses-sdk
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml reason: use-sdk injection requested
MERGED from [com.android.support:appcompat-v7:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/AndroidManifest.xml:20:5-43
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:20:5-43
MERGED from [com.facebook.react:react-native:0.13.0] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.13.0/AndroidManifest.xml:7:5-9:41
MERGED from [com.facebook.fresco:fresco:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/fresco/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.facebook.fresco:drawee:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/drawee/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.facebook.fresco:fbcore:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/fbcore/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:20:5-43
MERGED from [com.facebook.fresco:imagepipeline:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.facebook.fresco:fbcore:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/fbcore/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:20:5-43
MERGED from [com.facebook.fresco:fbcore:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/fbcore/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.facebook.fresco:imagepipeline-okhttp:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline-okhttp/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.facebook.fresco:imagepipeline:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/imagepipeline/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.facebook.fresco:fbcore:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/fbcore/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:20:5-43
MERGED from [com.facebook.fresco:fbcore:0.6.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.fresco/fbcore/0.6.1/AndroidManifest.xml:5:5-7:41
MERGED from [com.android.support:appcompat-v7:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/AndroidManifest.xml:20:5-43
MERGED from [com.android.support:support-v4:23.0.1] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.android.support/support-v4/23.0.1/AndroidManifest.xml:20:5-43
android:targetSdkVersion
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
android:minSdkVersion
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
INJECTED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml
uses-permission#android.permission.SYSTEM_ALERT_WINDOW
ADDED from [com.facebook.react:react-native:0.13.0] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.13.0/AndroidManifest.xml:11:5-78
android:name
ADDED from [com.facebook.react:react-native:0.13.0] /Users/hugo/github/react-native-demo/android/app/build/intermediates/exploded-aar/com.facebook.react/react-native/0.13.0/AndroidManifest.xml:11:22-75
android:uses-permission#android.permission.WRITE_EXTERNAL_STORAGE
IMPLIED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:1:1-22:12 reason: org.webkit.android_jsc has a targetSdkVersion < 4
android:uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:1:1-22:12 reason: org.webkit.android_jsc has a targetSdkVersion < 4
android:uses-permission#android.permission.READ_EXTERNAL_STORAGE
IMPLIED from /Users/hugo/github/react-native-demo/android/app/src/main/AndroidManifest.xml:1:1-22:12 reason: org.webkit.android_jsc requested WRITE_EXTERNAL_STORAGE
|
{
"pile_set_name": "Github"
}
|
/*
* eXist-db Open Source Native XML Database
* Copyright (C) 2001 The eXist-db Authors
*
* info@exist-db.org
* http://www.exist-db.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.exist.util.serializer;
import java.io.IOException;
import java.io.Writer;
import java.util.*;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.TransformerException;
import com.evolvedbinary.j8fu.lazy.LazyVal;
import org.exist.dom.QName;
import org.exist.storage.serializers.EXistOutputKeys;
import org.exist.util.CharSlice;
import org.exist.util.serializer.encodings.CharacterSet;
/**
* Write XML to a writer. This class defines methods similar to SAX. It deals
* with opening and closing tags, writing attributes and so on.
*
* @author wolf
*/
public class XMLWriter {
private final static IllegalStateException EX_CHARSET_NULL = new IllegalStateException("Charset should never be null!");
protected final static Properties defaultProperties = new Properties();
static {
defaultProperties.setProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
defaultProperties.setProperty(EXistOutputKeys.XDM_SERIALIZATION, "no");
}
protected Writer writer = null;
protected CharacterSet charSet = null;
protected boolean tagIsOpen = false;
protected boolean tagIsEmpty = true;
protected boolean declarationWritten = false;
protected boolean doctypeWritten = false;
protected Properties outputProperties;
private char[] charref = new char[10];
private static boolean[] textSpecialChars;
private static boolean[] attrSpecialChars;
private String defaultNamespace = "";
/**
* When serializing an XDM this should be true,
* otherwise false.
*
* XDM has different serialization rules
* compared to retrieving resources from the database.
*/
private boolean xdmSerialization = false;
private final Deque<QName> elementName = new ArrayDeque<>();
private LazyVal<Set<QName>> cdataSectionElements = new LazyVal<>(this::parseCdataSectionElementNames);
private boolean cdataSetionElement = false;
static {
textSpecialChars = new boolean[128];
Arrays.fill(textSpecialChars, false);
textSpecialChars['<'] = true;
textSpecialChars['>'] = true;
// textSpecialChars['\r'] = true;
textSpecialChars['&'] = true;
attrSpecialChars = new boolean[128];
Arrays.fill(attrSpecialChars, false);
attrSpecialChars['<'] = true;
attrSpecialChars['>'] = true;
attrSpecialChars['\r'] = true;
attrSpecialChars['\n'] = true;
attrSpecialChars['\t'] = true;
attrSpecialChars['&'] = true;
attrSpecialChars['"'] = true;
}
public XMLWriter() {
charSet = CharacterSet.getCharacterSet("UTF-8");
if(charSet == null) {
throw EX_CHARSET_NULL;
}
}
public XMLWriter(final Writer writer) {
this();
this.writer = writer;
}
/**
* Set the output properties.
*
* @param properties outputProperties
*/
public void setOutputProperties(final Properties properties) {
if(properties == null) {
outputProperties = defaultProperties;
} else {
outputProperties = properties;
}
final String encoding = outputProperties.getProperty(OutputKeys.ENCODING, "UTF-8");
this.charSet = CharacterSet.getCharacterSet(encoding);
if(this.charSet == null) {
throw EX_CHARSET_NULL;
}
this.xdmSerialization = outputProperties.getProperty(EXistOutputKeys.XDM_SERIALIZATION, "no").equals("yes");
}
private Set<QName> parseCdataSectionElementNames() {
final String s = outputProperties.getProperty(OutputKeys.CDATA_SECTION_ELEMENTS);
if (s == null || s.isEmpty()) {
return Collections.EMPTY_SET;
}
final Set<QName> qnames = new HashSet<>();
for (final String uriQualifiedName : s.split("\\s")) {
qnames.add(QName.fromURIQualifiedName(uriQualifiedName));
}
return qnames;
}
protected void reset() {
writer = null;
resetObjectState();
}
protected void resetObjectState() {
tagIsOpen = false;
tagIsEmpty = true;
declarationWritten = false;
doctypeWritten = false;
defaultNamespace = "";
cdataSectionElements = new LazyVal<>(this::parseCdataSectionElementNames);
}
/**
* Set a new writer. Calling this method will reset the state of the object.
*
* @param writer the writer
*/
public void setWriter(final Writer writer) {
this.writer = writer;
resetObjectState();
}
protected Writer getWriter() {
return writer;
}
public String getDefaultNamespace() {
return defaultNamespace.isEmpty() ? null : defaultNamespace;
}
public void setDefaultNamespace(final String namespace) {
defaultNamespace = namespace == null ? "" : namespace;
}
public void startDocument() throws TransformerException {
resetObjectState();
}
public void endDocument() throws TransformerException {
}
public void startElement(final String namespaceUri, final String localName, final String qname) throws TransformerException {
if(!declarationWritten) {
writeDeclaration();
}
if(!doctypeWritten) {
writeDoctype(qname);
}
try {
if(tagIsOpen) {
closeStartTag(false);
}
writer.write('<');
writer.write(qname);
tagIsOpen = true;
try {
elementName.push(QName.parse(namespaceUri, qname));
} catch (final QName.IllegalQNameException e) {
throw new TransformerException(e.getMessage(), e);
}
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void startElement(final QName qname) throws TransformerException {
if(!declarationWritten) {
writeDeclaration();
}
if(!doctypeWritten) {
writeDoctype(qname.getStringValue());
}
try {
if(tagIsOpen) {
closeStartTag(false);
}
writer.write('<');
if(qname.getPrefix() != null && qname.getPrefix().length() > 0) {
writer.write(qname.getPrefix());
writer.write(':');
}
writer.write(qname.getLocalPart());
tagIsOpen = true;
elementName.push(qname);
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void endElement(final String namespaceURI, final String localName, final String qname) throws TransformerException {
try {
if (tagIsOpen) {
closeStartTag(true);
} else {
writer.write("</");
writer.write(qname);
writer.write('>');
}
elementName.pop();
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void endElement(final QName qname) throws TransformerException {
try {
if(tagIsOpen) {
closeStartTag(true);
} else {
writer.write("</");
if(qname.getPrefix() != null && qname.getPrefix().length() > 0) {
writer.write(qname.getPrefix());
writer.write(':');
}
writer.write(qname.getLocalPart());
writer.write('>');
}
elementName.pop();
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void namespace(final String prefix, final String nsURI) throws TransformerException {
if((nsURI == null) && (prefix == null || prefix.length() == 0)) {
return;
}
try {
if(!tagIsOpen) {
throw new TransformerException("Found a namespace declaration outside an element");
}
if(prefix != null && prefix.length() > 0) {
writer.write(' ');
writer.write("xmlns");
writer.write(':');
writer.write(prefix);
writer.write("=\"");
writeChars(nsURI, true);
writer.write('"');
} else {
if(defaultNamespace.equals(nsURI)) {
return;
}
writer.write(' ');
writer.write("xmlns");
writer.write("=\"");
writeChars(nsURI, true);
writer.write('"');
defaultNamespace= nsURI;
}
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void attribute(String qname, String value) throws TransformerException {
try {
if(!tagIsOpen) {
characters(value);
return;
// throw new TransformerException("Found an attribute outside an
// element");
}
writer.write(' ');
writer.write(qname);
writer.write("=\"");
writeChars(value, true);
writer.write('"');
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void attribute(final QName qname, final String value) throws TransformerException {
try {
if(!tagIsOpen) {
characters(value);
return;
// throw new TransformerException("Found an attribute outside an
// element");
}
writer.write(' ');
if(qname.getPrefix() != null && qname.getPrefix().length() > 0) {
writer.write(qname.getPrefix());
writer.write(':');
}
writer.write(qname.getLocalPart());
writer.write("=\"");
writeChars(value, true);
writer.write('"');
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void characters(final CharSequence chars) throws TransformerException {
if(!declarationWritten) {
writeDeclaration();
}
try {
if(tagIsOpen) {
closeStartTag(false);
}
writeChars(chars, false);
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void characters(final char[] ch, final int start, final int len) throws TransformerException {
if(!declarationWritten) {
writeDeclaration();
}
if (cdataSetionElement) {
try {
writer.write(ch, start, len);
} catch (final IOException e) {
throw new TransformerException(e.getMessage(), e);
}
} else {
characters(new CharSlice(ch, start, len));
}
}
public void processingInstruction(final String target, final String data) throws TransformerException {
if(!declarationWritten) {
writeDeclaration();
}
try {
if(tagIsOpen) {
closeStartTag(false);
}
writer.write("<?");
writer.write(target);
if(data != null && data.length() > 0) {
writer.write(' ');
writer.write(data);
}
writer.write("?>");
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void comment(final CharSequence data) throws TransformerException {
if (!declarationWritten) {
writeDeclaration();
}
try {
if(tagIsOpen) {
closeStartTag(false);
}
writer.write("<!--");
writer.write(data.toString());
writer.write("-->");
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void startCdataSection() throws TransformerException {
if(tagIsOpen) {
closeStartTag(false);
}
if ((!xdmSerialization) || cdataSectionElements.get().contains(elementName.peek())) {
try {
writer.write("<![CDATA[");
this.cdataSetionElement = true;
} catch (final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
}
public void endCdataSection() throws TransformerException {
if ((!xdmSerialization) || cdataSectionElements.get().contains(elementName.peek())) {
try {
writer.write("]]>");
this.cdataSetionElement = false;
} catch (final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
}
public void cdataSection(final char[] ch, final int start, final int len) throws TransformerException {
startCdataSection();
try {
writer.write(ch, start, len);
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
endCdataSection();
}
public void startDocumentType(final String name, final String publicId, final String systemId) throws TransformerException {
if(!declarationWritten) {
writeDeclaration();
}
try {
writer.write("<!DOCTYPE ");
writer.write(name);
if(publicId != null) {
//writer.write(" PUBLIC \"" + publicId + "\"");
writer.write(" PUBLIC \"" + publicId.replaceAll(" ", " ") + "\""); //workaround for XHTML doctype, declare does not allow spaces so use   instead and then replace each   with a space here - Adam
}
if(systemId != null) {
if(publicId == null) {
writer.write(" SYSTEM");
}
writer.write(" \"" + systemId + "\"");
}
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void endDocumentType() throws TransformerException {
try {
writer.write(">");
doctypeWritten = true;
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
public void documentType(final String name, final String publicId, final String systemId) throws TransformerException {
startDocumentType(name, publicId, systemId);
endDocumentType();
}
protected void closeStartTag(final boolean isEmpty) throws TransformerException {
try {
if(tagIsOpen) {
if(isEmpty) {
writer.write("/>");
} else {
writer.write('>');
}
tagIsOpen = false;
}
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
protected void writeDeclaration() throws TransformerException {
if(declarationWritten) {
return;
}
if(outputProperties == null) {
outputProperties = defaultProperties;
}
declarationWritten = true;
final String omitXmlDecl = outputProperties.getProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
if("no".equals(omitXmlDecl)) {
final String version = outputProperties.getProperty(OutputKeys.VERSION, "1.0");
final String standalone = outputProperties.getProperty(OutputKeys.STANDALONE);
final String encoding = outputProperties.getProperty(OutputKeys.ENCODING, "UTF-8");
try {
writer.write("<?xml version=\"");
writer.write(version);
writer.write("\" encoding=\"");
writer.write(encoding);
writer.write('"');
if(standalone != null) {
writer.write(" standalone=\"");
writer.write(standalone);
writer.write('"');
}
writer.write("?>\n");
} catch(final IOException ioe) {
throw new TransformerException(ioe.getMessage(), ioe);
}
}
}
protected void writeDoctype(final String rootElement) throws TransformerException {
if(doctypeWritten) {
return;
}
final String publicId = outputProperties.getProperty(OutputKeys.DOCTYPE_PUBLIC);
final String systemId = outputProperties.getProperty(OutputKeys.DOCTYPE_SYSTEM);
if(publicId != null || systemId != null) {
documentType(rootElement, publicId, systemId);
}
doctypeWritten = true;
}
protected boolean needsEscape(final char ch) {
return true;
}
protected void writeChars(final CharSequence s, final boolean inAttribute) throws IOException {
final boolean[] specialChars = inAttribute ? attrSpecialChars : textSpecialChars;
char ch = 0;
final int len = s.length();
int pos = 0, i;
while(pos < len) {
i = pos;
while(i < len) {
ch = s.charAt(i);
if(ch < 128) {
if(specialChars[ch]) {
break;
} else {
i++;
}
} else if(!charSet.inCharacterSet(ch)) {
break;
} else {
i++;
}
}
writeCharSeq(s, pos, i);
// writer.write(s.subSequence(pos, i).toString());
if (i >= len) {
return;
}
if(needsEscape(ch)) {
switch(ch) {
case '<':
writer.write("<");
break;
case '>':
writer.write(">");
break;
case '&':
writer.write("&");
break;
case '\r':
writer.write("
");
break;
case '\n':
writer.write("
");
break;
case '\t':
writer.write("	");
break;
case '"':
writer.write(""");
break;
default:
writeCharacterReference(ch);
}
} else {
writer.write(ch);
}
pos = ++i;
}
}
private void writeCharSeq(final CharSequence ch, final int start, final int end) throws IOException {
for(int i = start; i < end; i++) {
writer.write(ch.charAt(i));
}
}
protected void writeCharacterReference(final char charval) throws IOException {
int o = 0;
charref[o++] = '&';
charref[o++] = '#';
charref[o++] = 'x';
final String code = Integer.toHexString(charval);
final int len = code.length();
for(int k = 0; k < len; k++) {
charref[o++] = code.charAt(k);
}
charref[o++] = ';';
writer.write(charref, 0, o);
}
}
|
{
"pile_set_name": "Github"
}
|
FROM ubuntu:18.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common \
unzip
RUN curl -o /tmp/go.tgz https://dl.google.com/go/go1.14.linux-amd64.tar.gz && \
tar -xvzf /tmp/go.tgz -C /tmp && \
mv /tmp/go /usr/local && \
rm -rf /tmp/go*
USER root
ENV HOME /root
ENV GOROOT /usr/local/go
ENV GOPATH $HOME/go
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
# RUN PROTOC_ZIP=protoc-3.7.1-linux-x86_64.zip && \
# curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/$PROTOC_ZIP && \
# unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \
# unzip -o $PROTOC_ZIP -d /usr/local 'include/*' && \
# rm -f $PROTOC_ZIP
RUN apt-get update && \
apt-get install -y --no-install-recommends git
COPY get_dependencies.sh get_dependencies.sh
RUN ./get_dependencies.sh
RUN apt-get update && \
apt-get install -y --no-install-recommends python3-pip python3-setuptools
# RUN pip3 install protobuf==3.11.3
RUN pip3 install grpcio-tools==1.27.2 grpcio==1.27.2
RUN apt-get update && \
apt-get install -y --no-install-recommends jq
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
RUN pip3 install pystache==0.5.4 Click==7.0
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) by James Courtier-Dutton <James@superbug.demon.co.uk>
* Driver p16v chips
* Version: 0.25
*
* FEATURES currently supported:
* Output fixed at S32_LE, 2 channel to hw:0,0
* Rates: 44.1, 48, 96, 192.
*
* Changelog:
* 0.8
* Use separate card based buffer for periods table.
* 0.9
* Use 2 channel output streams instead of 8 channel.
* (8 channel output streams might be good for ASIO type output)
* Corrected speaker output, so Front -> Front etc.
* 0.10
* Fixed missed interrupts.
* 0.11
* Add Sound card model number and names.
* Add Analog volume controls.
* 0.12
* Corrected playback interrupts. Now interrupt per period, instead of half period.
* 0.13
* Use single trigger for multichannel.
* 0.14
* Mic capture now works at fixed: S32_LE, 96000Hz, Stereo.
* 0.15
* Force buffer_size / period_size == INTEGER.
* 0.16
* Update p16v.c to work with changed alsa api.
* 0.17
* Update p16v.c to work with changed alsa api. Removed boot_devs.
* 0.18
* Merging with snd-emu10k1 driver.
* 0.19
* One stereo channel at 24bit now works.
* 0.20
* Added better register defines.
* 0.21
* Integrated with snd-emu10k1 driver.
* 0.22
* Removed #if 0 ... #endif
* 0.23
* Implement different capture rates.
* 0.24
* Implement different capture source channels.
* e.g. When HD Capture source is set to SPDIF,
* setting HD Capture channel to 0 captures from CDROM digital input.
* setting HD Capture channel to 1 captures from SPDIF in.
* 0.25
* Include capture buffer sizes.
*
* BUGS:
* Some stability problems when unloading the snd-p16v kernel module.
* --
*
* TODO:
* SPDIF out.
* Find out how to change capture sample rates. E.g. To record SPDIF at 48000Hz.
* Currently capture fixed at 48000Hz.
*
* --
* GENERAL INFO:
* Model: SB0240
* P16V Chip: CA0151-DBS
* Audigy 2 Chip: CA0102-IAT
* AC97 Codec: STAC 9721
* ADC: Philips 1361T (Stereo 24bit)
* DAC: CS4382-K (8-channel, 24bit, 192Khz)
*
* This code was initially based on code from ALSA's emu10k1x.c which is:
* Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/info.h>
#include <sound/tlv.h>
#include <sound/emu10k1.h>
#include "p16v.h"
#define SET_CHANNEL 0 /* Testing channel outputs 0=Front, 1=Center/LFE, 2=Unknown, 3=Rear */
#define PCM_FRONT_CHANNEL 0
#define PCM_REAR_CHANNEL 1
#define PCM_CENTER_LFE_CHANNEL 2
#define PCM_SIDE_CHANNEL 3
#define CONTROL_FRONT_CHANNEL 0
#define CONTROL_REAR_CHANNEL 3
#define CONTROL_CENTER_LFE_CHANNEL 1
#define CONTROL_SIDE_CHANNEL 2
/* Card IDs:
* Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2002 -> Audigy2 ZS 7.1 Model:SB0350
* Class 0401: 1102:0004 (rev 04) Subsystem: 1102:1007 -> Audigy2 6.1 Model:SB0240
* Class 0401: 1102:0004 (rev 04) Subsystem: 1102:1002 -> Audigy2 Platinum Model:SB msb0240230009266
* Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2007 -> Audigy4 Pro Model:SB0380 M1SB0380472001901E
*
*/
/* hardware definition */
static struct snd_pcm_hardware snd_p16v_playback_hw = {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_SYNC_START,
.formats = SNDRV_PCM_FMTBIT_S32_LE, /* Only supports 24-bit samples padded to 32 bits. */
.rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100,
.rate_min = 44100,
.rate_max = 192000,
.channels_min = 8,
.channels_max = 8,
.buffer_bytes_max = ((65536 - 64) * 8),
.period_bytes_min = 64,
.period_bytes_max = (65536 - 64),
.periods_min = 2,
.periods_max = 8,
.fifo_size = 0,
};
static struct snd_pcm_hardware snd_p16v_capture_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = SNDRV_PCM_FMTBIT_S32_LE,
.rates = SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100,
.rate_min = 44100,
.rate_max = 192000,
.channels_min = 2,
.channels_max = 2,
.buffer_bytes_max = (65536 - 64),
.period_bytes_min = 64,
.period_bytes_max = (65536 - 128) >> 1, /* size has to be N*64 bytes */
.periods_min = 2,
.periods_max = 2,
.fifo_size = 0,
};
static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime)
{
struct snd_emu10k1_pcm *epcm = runtime->private_data;
if (epcm) {
/* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */
kfree(epcm);
}
}
/* open_playback callback */
static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substream, int channel_id)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_emu10k1_voice *channel = &(emu->p16v_voices[channel_id]);
struct snd_emu10k1_pcm *epcm;
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
/* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
epcm->substream = substream;
/*
snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n",
substream->pcm->device, channel_id);
*/
runtime->private_data = epcm;
runtime->private_free = snd_p16v_pcm_free_substream;
runtime->hw = snd_p16v_playback_hw;
channel->emu = emu;
channel->number = channel_id;
channel->use=1;
#if 0 /* debug */
snd_printk(KERN_DEBUG
"p16v: open channel_id=%d, channel=%p, use=0x%x\n",
channel_id, channel, channel->use);
printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n",
channel_id, chip, channel);
#endif /* debug */
/* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
channel->epcm = epcm;
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err;
runtime->sync.id32[0] = substream->pcm->card->number;
runtime->sync.id32[1] = 'P';
runtime->sync.id32[2] = 16;
runtime->sync.id32[3] = 'V';
return 0;
}
/* open_capture callback */
static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream, int channel_id)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_emu10k1_voice *channel = &(emu->p16v_capture_voice);
struct snd_emu10k1_pcm *epcm;
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
/* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */
if (epcm == NULL)
return -ENOMEM;
epcm->emu = emu;
epcm->substream = substream;
/*
snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n",
substream->pcm->device, channel_id);
*/
runtime->private_data = epcm;
runtime->private_free = snd_p16v_pcm_free_substream;
runtime->hw = snd_p16v_capture_hw;
channel->emu = emu;
channel->number = channel_id;
channel->use=1;
#if 0 /* debug */
snd_printk(KERN_DEBUG
"p16v: open channel_id=%d, channel=%p, use=0x%x\n",
channel_id, channel, channel->use);
printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n",
channel_id, chip, channel);
#endif /* debug */
/* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
channel->epcm = epcm;
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
return err;
return 0;
}
/* close callback */
static int snd_p16v_pcm_close_playback(struct snd_pcm_substream *substream)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
//struct snd_pcm_runtime *runtime = substream->runtime;
//struct snd_emu10k1_pcm *epcm = runtime->private_data;
emu->p16v_voices[substream->pcm->device - emu->p16v_device_offset].use = 0;
/* FIXME: maybe zero others */
return 0;
}
/* close callback */
static int snd_p16v_pcm_close_capture(struct snd_pcm_substream *substream)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
//struct snd_pcm_runtime *runtime = substream->runtime;
//struct snd_emu10k1_pcm *epcm = runtime->private_data;
emu->p16v_capture_voice.use = 0;
/* FIXME: maybe zero others */
return 0;
}
static int snd_p16v_pcm_open_playback_front(struct snd_pcm_substream *substream)
{
return snd_p16v_pcm_open_playback_channel(substream, PCM_FRONT_CHANNEL);
}
static int snd_p16v_pcm_open_capture(struct snd_pcm_substream *substream)
{
// Only using channel 0 for now, but the card has 2 channels.
return snd_p16v_pcm_open_capture_channel(substream, 0);
}
/* hw_params callback */
static int snd_p16v_pcm_hw_params_playback(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
int result;
result = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
return result;
}
/* hw_params callback */
static int snd_p16v_pcm_hw_params_capture(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
int result;
result = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
return result;
}
/* hw_free callback */
static int snd_p16v_pcm_hw_free_playback(struct snd_pcm_substream *substream)
{
int result;
result = snd_pcm_lib_free_pages(substream);
return result;
}
/* hw_free callback */
static int snd_p16v_pcm_hw_free_capture(struct snd_pcm_substream *substream)
{
int result;
result = snd_pcm_lib_free_pages(substream);
return result;
}
/* prepare playback callback */
static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
int channel = substream->pcm->device - emu->p16v_device_offset;
u32 *table_base = (u32 *)(emu->p16v_buffer.area+(8*16*channel));
u32 period_size_bytes = frames_to_bytes(runtime, runtime->period_size);
int i;
u32 tmp;
#if 0 /* debug */
snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, "
"format=0x%x, channels=%d, buffer_size=%ld, "
"period_size=%ld, periods=%u, frames_to_bytes=%d\n",
channel, runtime->rate, runtime->format, runtime->channels,
runtime->buffer_size, runtime->period_size,
runtime->periods, frames_to_bytes(runtime, 1));
snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n",
runtime->dma_addr, runtime->dma_area, table_base);
snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
emu->p16v_buffer.addr, emu->p16v_buffer.area,
emu->p16v_buffer.bytes);
#endif /* debug */
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
switch (runtime->rate) {
case 44100:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x8080);
break;
case 96000:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x4040);
break;
case 192000:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x2020);
break;
case 48000:
default:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x0000);
break;
}
/* FIXME: Check emu->buffer.size before actually writing to it. */
for(i = 0; i < runtime->periods; i++) {
table_base[i*2]=runtime->dma_addr+(i*period_size_bytes);
table_base[(i*2)+1]=period_size_bytes<<16;
}
snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_ADDR, channel, emu->p16v_buffer.addr+(8*16*channel));
snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_SIZE, channel, (runtime->periods - 1) << 19);
snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_PTR, channel, 0);
snd_emu10k1_ptr20_write(emu, PLAYBACK_DMA_ADDR, channel, runtime->dma_addr);
//snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); // buffer size in bytes
snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, 0); // buffer size in bytes
snd_emu10k1_ptr20_write(emu, PLAYBACK_POINTER, channel, 0);
snd_emu10k1_ptr20_write(emu, 0x07, channel, 0x0);
snd_emu10k1_ptr20_write(emu, 0x08, channel, 0);
return 0;
}
/* prepare capture callback */
static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
int channel = substream->pcm->device - emu->p16v_device_offset;
u32 tmp;
/*
printk(KERN_DEBUG "prepare capture:channel_number=%d, rate=%d, "
"format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, "
"frames_to_bytes=%d\n",
channel, runtime->rate, runtime->format, runtime->channels,
runtime->buffer_size, runtime->period_size,
frames_to_bytes(runtime, 1));
*/
tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
switch (runtime->rate) {
case 44100:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0800);
break;
case 96000:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0400);
break;
case 192000:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0200);
break;
case 48000:
default:
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0000);
break;
}
/* FIXME: Check emu->buffer.size before actually writing to it. */
snd_emu10k1_ptr20_write(emu, 0x13, channel, 0);
snd_emu10k1_ptr20_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr);
snd_emu10k1_ptr20_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size) << 16); // buffer size in bytes
snd_emu10k1_ptr20_write(emu, CAPTURE_POINTER, channel, 0);
//snd_emu10k1_ptr20_write(emu, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC or Line in */
//snd_emu10k1_ptr20_write(emu, EXTENDED_INT_MASK, 0, snd_emu10k1_ptr20_read(emu, EXTENDED_INT_MASK, 0) | (0x110000<<channel));
return 0;
}
static void snd_p16v_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb)
{
unsigned long flags;
unsigned int enable;
spin_lock_irqsave(&emu->emu_lock, flags);
enable = inl(emu->port + INTE2) | intrenb;
outl(enable, emu->port + INTE2);
spin_unlock_irqrestore(&emu->emu_lock, flags);
}
static void snd_p16v_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb)
{
unsigned long flags;
unsigned int disable;
spin_lock_irqsave(&emu->emu_lock, flags);
disable = inl(emu->port + INTE2) & (~intrenb);
outl(disable, emu->port + INTE2);
spin_unlock_irqrestore(&emu->emu_lock, flags);
}
/* trigger_playback callback */
static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
int cmd)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime;
struct snd_emu10k1_pcm *epcm;
int channel;
int result = 0;
struct snd_pcm_substream *s;
u32 basic = 0;
u32 inte = 0;
int running = 0;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
running=1;
break;
case SNDRV_PCM_TRIGGER_STOP:
default:
running = 0;
break;
}
snd_pcm_group_for_each_entry(s, substream) {
if (snd_pcm_substream_chip(s) != emu ||
s->stream != SNDRV_PCM_STREAM_PLAYBACK)
continue;
runtime = s->runtime;
epcm = runtime->private_data;
channel = substream->pcm->device-emu->p16v_device_offset;
/* snd_printk(KERN_DEBUG "p16v channel=%d\n", channel); */
epcm->running = running;
basic |= (0x1<<channel);
inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel);
snd_pcm_trigger_done(s, substream);
}
/* snd_printk(KERN_DEBUG "basic=0x%x, inte=0x%x\n", basic, inte); */
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
snd_p16v_intr_enable(emu, inte);
snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0)| (basic));
break;
case SNDRV_PCM_TRIGGER_STOP:
snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & ~(basic));
snd_p16v_intr_disable(emu, inte);
break;
default:
result = -EINVAL;
break;
}
return result;
}
/* trigger_capture callback */
static int snd_p16v_pcm_trigger_capture(struct snd_pcm_substream *substream,
int cmd)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_emu10k1_pcm *epcm = runtime->private_data;
int channel = 0;
int result = 0;
u32 inte = INTE2_CAPTURE_CH_0_LOOP | INTE2_CAPTURE_CH_0_HALF_LOOP;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
snd_p16v_intr_enable(emu, inte);
snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0)|(0x100<<channel));
epcm->running = 1;
break;
case SNDRV_PCM_TRIGGER_STOP:
snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & ~(0x100<<channel));
snd_p16v_intr_disable(emu, inte);
//snd_emu10k1_ptr20_write(emu, EXTENDED_INT_MASK, 0, snd_emu10k1_ptr20_read(emu, EXTENDED_INT_MASK, 0) & ~(0x110000<<channel));
epcm->running = 0;
break;
default:
result = -EINVAL;
break;
}
return result;
}
/* pointer_playback callback */
static snd_pcm_uframes_t
snd_p16v_pcm_pointer_playback(struct snd_pcm_substream *substream)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_emu10k1_pcm *epcm = runtime->private_data;
snd_pcm_uframes_t ptr, ptr1, ptr2,ptr3,ptr4 = 0;
int channel = substream->pcm->device - emu->p16v_device_offset;
if (!epcm->running)
return 0;
ptr3 = snd_emu10k1_ptr20_read(emu, PLAYBACK_LIST_PTR, channel);
ptr1 = snd_emu10k1_ptr20_read(emu, PLAYBACK_POINTER, channel);
ptr4 = snd_emu10k1_ptr20_read(emu, PLAYBACK_LIST_PTR, channel);
if (ptr3 != ptr4) ptr1 = snd_emu10k1_ptr20_read(emu, PLAYBACK_POINTER, channel);
ptr2 = bytes_to_frames(runtime, ptr1);
ptr2+= (ptr4 >> 3) * runtime->period_size;
ptr=ptr2;
if (ptr >= runtime->buffer_size)
ptr -= runtime->buffer_size;
return ptr;
}
/* pointer_capture callback */
static snd_pcm_uframes_t
snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
{
struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_emu10k1_pcm *epcm = runtime->private_data;
snd_pcm_uframes_t ptr, ptr1, ptr2 = 0;
int channel = 0;
if (!epcm->running)
return 0;
ptr1 = snd_emu10k1_ptr20_read(emu, CAPTURE_POINTER, channel);
ptr2 = bytes_to_frames(runtime, ptr1);
ptr=ptr2;
if (ptr >= runtime->buffer_size) {
ptr -= runtime->buffer_size;
printk(KERN_WARNING "buffer capture limited!\n");
}
/*
printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, "
"buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n",
ptr1, ptr2, ptr, (int)runtime->buffer_size,
(int)runtime->period_size, (int)runtime->frame_bits,
(int)runtime->rate);
*/
return ptr;
}
/* operators */
static struct snd_pcm_ops snd_p16v_playback_front_ops = {
.open = snd_p16v_pcm_open_playback_front,
.close = snd_p16v_pcm_close_playback,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_p16v_pcm_hw_params_playback,
.hw_free = snd_p16v_pcm_hw_free_playback,
.prepare = snd_p16v_pcm_prepare_playback,
.trigger = snd_p16v_pcm_trigger_playback,
.pointer = snd_p16v_pcm_pointer_playback,
};
static struct snd_pcm_ops snd_p16v_capture_ops = {
.open = snd_p16v_pcm_open_capture,
.close = snd_p16v_pcm_close_capture,
.ioctl = snd_pcm_lib_ioctl,
.hw_params = snd_p16v_pcm_hw_params_capture,
.hw_free = snd_p16v_pcm_hw_free_capture,
.prepare = snd_p16v_pcm_prepare_capture,
.trigger = snd_p16v_pcm_trigger_capture,
.pointer = snd_p16v_pcm_pointer_capture,
};
int snd_p16v_free(struct snd_emu10k1 *chip)
{
// release the data
if (chip->p16v_buffer.area) {
snd_dma_free_pages(&chip->p16v_buffer);
/*
snd_printk(KERN_DEBUG "period lables free: %p\n",
&chip->p16v_buffer);
*/
}
return 0;
}
int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
{
struct snd_pcm *pcm;
struct snd_pcm_substream *substream;
int err;
int capture=1;
/* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d\n", device); */
emu->p16v_device_offset = device;
if (rpcm)
*rpcm = NULL;
if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0)
return err;
pcm->private_data = emu;
// Single playback 8 channel device.
// Single capture 2 channel device.
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_p16v_playback_front_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_p16v_capture_ops);
pcm->info_flags = 0;
pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
strcpy(pcm->name, "p16v");
emu->pcm_p16v = pcm;
for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
substream;
substream = substream->next) {
if ((err = snd_pcm_lib_preallocate_pages(substream,
SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(emu->pci),
((65536 - 64) * 8), ((65536 - 64) * 8))) < 0)
return err;
/*
snd_printk(KERN_DEBUG
"preallocate playback substream: err=%d\n", err);
*/
}
for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
substream;
substream = substream->next) {
if ((err = snd_pcm_lib_preallocate_pages(substream,
SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(emu->pci),
65536 - 64, 65536 - 64)) < 0)
return err;
/*
snd_printk(KERN_DEBUG
"preallocate capture substream: err=%d\n", err);
*/
}
if (rpcm)
*rpcm = pcm;
return 0;
}
static int snd_p16v_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 255;
return 0;
}
static int snd_p16v_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
int high_low = (kcontrol->private_value >> 8) & 0xff;
int reg = kcontrol->private_value & 0xff;
u32 value;
value = snd_emu10k1_ptr20_read(emu, reg, high_low);
if (high_low) {
ucontrol->value.integer.value[0] = 0xff - ((value >> 24) & 0xff); /* Left */
ucontrol->value.integer.value[1] = 0xff - ((value >> 16) & 0xff); /* Right */
} else {
ucontrol->value.integer.value[0] = 0xff - ((value >> 8) & 0xff); /* Left */
ucontrol->value.integer.value[1] = 0xff - ((value >> 0) & 0xff); /* Right */
}
return 0;
}
static int snd_p16v_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
int high_low = (kcontrol->private_value >> 8) & 0xff;
int reg = kcontrol->private_value & 0xff;
u32 value, oval;
oval = value = snd_emu10k1_ptr20_read(emu, reg, 0);
if (high_low == 1) {
value &= 0xffff;
value |= ((0xff - ucontrol->value.integer.value[0]) << 24) |
((0xff - ucontrol->value.integer.value[1]) << 16);
} else {
value &= 0xffff0000;
value |= ((0xff - ucontrol->value.integer.value[0]) << 8) |
((0xff - ucontrol->value.integer.value[1]) );
}
if (value != oval) {
snd_emu10k1_ptr20_write(emu, reg, 0, value);
return 1;
}
return 0;
}
static int snd_p16v_capture_source_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
static char *texts[8] = {
"SPDIF", "I2S", "SRC48", "SRCMulti_SPDIF", "SRCMulti_I2S",
"CDIF", "FX", "AC97"
};
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = 8;
if (uinfo->value.enumerated.item > 7)
uinfo->value.enumerated.item = 7;
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0;
}
static int snd_p16v_capture_source_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
ucontrol->value.enumerated.item[0] = emu->p16v_capture_source;
return 0;
}
static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change = 0;
u32 mask;
u32 source;
val = ucontrol->value.enumerated.item[0] ;
if (val > 7)
return -EINVAL;
change = (emu->p16v_capture_source != val);
if (change) {
emu->p16v_capture_source = val;
source = (val << 28) | (val << 24) | (val << 20) | (val << 16);
mask = snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & 0xffff;
snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, source | mask);
}
return change;
}
static int snd_p16v_capture_channel_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
static char *texts[4] = { "0", "1", "2", "3", };
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = 4;
if (uinfo->value.enumerated.item > 3)
uinfo->value.enumerated.item = 3;
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
return 0;
}
static int snd_p16v_capture_channel_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
ucontrol->value.enumerated.item[0] = emu->p16v_capture_channel;
return 0;
}
static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
unsigned int val;
int change = 0;
u32 tmp;
val = ucontrol->value.enumerated.item[0] ;
if (val > 3)
return -EINVAL;
change = (emu->p16v_capture_channel != val);
if (change) {
emu->p16v_capture_channel = val;
tmp = snd_emu10k1_ptr20_read(emu, CAPTURE_P16V_SOURCE, 0) & 0xfffc;
snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, tmp | val);
}
return change;
}
static const DECLARE_TLV_DB_SCALE(snd_p16v_db_scale1, -5175, 25, 1);
#define P16V_VOL(xname,xreg,xhl) { \
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
.info = snd_p16v_volume_info, \
.get = snd_p16v_volume_get, \
.put = snd_p16v_volume_put, \
.tlv = { .p = snd_p16v_db_scale1 }, \
.private_value = ((xreg) | ((xhl) << 8)) \
}
static struct snd_kcontrol_new p16v_mixer_controls[] __devinitdata = {
P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0),
P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1),
P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1),
P16V_VOL("HD Analog Side Playback Volume", PLAYBACK_VOLUME_MIXER10, 0),
P16V_VOL("HD SPDIF Front Playback Volume", PLAYBACK_VOLUME_MIXER7, 0),
P16V_VOL("HD SPDIF Rear Playback Volume", PLAYBACK_VOLUME_MIXER8, 1),
P16V_VOL("HD SPDIF Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER7, 1),
P16V_VOL("HD SPDIF Side Playback Volume", PLAYBACK_VOLUME_MIXER8, 0),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "HD source Capture",
.info = snd_p16v_capture_source_info,
.get = snd_p16v_capture_source_get,
.put = snd_p16v_capture_source_put
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "HD channel Capture",
.info = snd_p16v_capture_channel_info,
.get = snd_p16v_capture_channel_get,
.put = snd_p16v_capture_channel_put
},
};
int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu)
{
int i, err;
struct snd_card *card = emu->card;
for (i = 0; i < ARRAY_SIZE(p16v_mixer_controls); i++) {
if ((err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i],
emu))) < 0)
return err;
}
return 0;
}
#ifdef CONFIG_PM
#define NUM_CHS 1 /* up to 4, but only first channel is used */
int __devinit snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu)
{
emu->p16v_saved = vmalloc(NUM_CHS * 4 * 0x80);
if (! emu->p16v_saved)
return -ENOMEM;
return 0;
}
void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu)
{
vfree(emu->p16v_saved);
}
void snd_p16v_suspend(struct snd_emu10k1 *emu)
{
int i, ch;
unsigned int *val;
val = emu->p16v_saved;
for (ch = 0; ch < NUM_CHS; ch++)
for (i = 0; i < 0x80; i++, val++)
*val = snd_emu10k1_ptr20_read(emu, i, ch);
}
void snd_p16v_resume(struct snd_emu10k1 *emu)
{
int i, ch;
unsigned int *val;
val = emu->p16v_saved;
for (ch = 0; ch < NUM_CHS; ch++)
for (i = 0; i < 0x80; i++, val++)
snd_emu10k1_ptr20_write(emu, i, ch, *val);
}
#endif
|
{
"pile_set_name": "Github"
}
|
// HD
@screen-xl: (@screen-md * @line-height-base);
@screen-xl-min: @screen-xl;
@container-xl: (@container-md * @line-height-base);
@component-padding: @line-height-computed;
.make-xl-column(@columns; @gutter: @grid-gutter-width) {
position: relative;
min-height: 1px;
padding-left: (@gutter / 2);
padding-right: (@gutter / 2);
@media (min-width: @screen-lg-min) {
float: left;
width: percentage((@columns / @grid-columns));
}
}
.make-xl-column-offset(@columns) {
@media (min-width: @screen-lg-min) {
margin-left: percentage((@columns / @grid-columns));
}
}
.make-xl-column-push(@columns) {
@media (min-width: @screen-lg-min) {
left: percentage((@columns / @grid-columns));
}
}
.make-xl-column-pull(@columns) {
@media (min-width: @screen-lg-min) {
right: percentage((@columns / @grid-columns));
}
}
@media (min-width: @screen-xl-min) {
.make-grid(xl);
}
.container {
@media (min-width: @screen-xl-min) {
width: @container-xl;
}
}
|
{
"pile_set_name": "Github"
}
|
import widget from '../mixins/widget'
import {extend} from '../utils/core'
export default {
name: 'LaLegend',
mixins: [widget],
props: {
selectable: Boolean,
/**
* ^(top|bottom|left|right)(-(start|center|end))?$
*/
placement: {
type: String,
default: 'bottom'
},
color: String
},
preload({data, parent}) {
const {placement = 'bottom'} = data
let space = [0, 0, 0, 0]
switch (placement.match(/^(\w+)-?/)[1]) {
case 'bottom':
space[2] = 50
break
case 'top':
space[0] = 50
break
case 'left':
space[3] = 100
break
case 'right':
space[1] = 100
break
default:
break
}
parent.addSpace(space)
},
computed: {
curColor() {
return this.color || this.Plane.textColor
},
position() {
return this.placement.match(/^(\w+)(-(\w+))?$/)[1]
},
align() {
return this.placement.match(/^(\w+)(-(\w+))?$/)[3]
},
pos() {
const {position, align} = this
const pos = {}
if (position === 'top' || position === 'bottom') {
switch (align) {
case 'start':
pos.left = 0
break
case 'end':
pos.right = 0
break
default:
pos.left = '50%'
pos.transform = 'translateX(-50%)'
break
}
if (position === 'top') {
pos.top = 0
} else {
pos.bottom = 0
}
} else {
switch (align) {
case 'start':
pos.top = 0
break
case 'end':
pos.bottom = 0
break
default:
pos.top = '50%'
pos.transform = 'translateY(-50%)'
break
}
if (position === 'left') {
pos.left = 0
} else {
pos.right = 0
}
}
return pos
}
},
created() {
this.$set(this.store, 'hidden', [])
},
render(h) {
const {curColor, pos, position, selectable, store} = this
const {hidden} = store
const slot = this.$scopedSlots.default
return h(
'div',
{
class: 'la-legend',
style: extend(
{
position: 'absolute'
},
pos
)
},
Object.keys(store.props).map(id =>
h(
'div',
{
style: {
display:
position === 'left' || position === 'right' ?
'block' :
'inline-block',
marginRight: '10px',
marginLeft: '5px',
color: curColor,
cursor: selectable ? 'pointer' : 'nromal'
},
on: {
click: () => {
if (!selectable) {
return
}
id = Number(id)
const index = hidden.indexOf(id)
if (index < 0) {
hidden.push(id)
} else {
hidden.splice(index, 1)
}
}
}
},
slot ?
slot({
color: store.colors[id],
label: store.labels[id],
prop: store.props[id]
}) :
[
h('span', {
style: {
backgroundColor: store.colors[id],
height: '10px',
width: '10px',
borderRadius: '50%',
display: 'inline-block',
marginRight: '5px'
}
}),
h(
'span',
{
style:
hidden.indexOf(Number(id)) > -1 ?
{
textDecoration: 'line-through'
} :
{}
},
store.labels[id]
)
]
)
)
)
}
}
|
{
"pile_set_name": "Github"
}
|
MILKDROP_PRESET_VERSION=201
PSVERSION=2
PSVERSION_WARP=2
PSVERSION_COMP=2
[preset00]
fRating=5.000
fGammaAdj=1.000
fDecay=1.000
fVideoEchoZoom=2.000
fVideoEchoAlpha=0.000
nVideoEchoOrientation=0
nWaveMode=3
bAdditiveWaves=0
bWaveDots=1
bWaveThick=0
bModWaveAlphaByVolume=1
bMaximizeWaveColor=1
bTexWrap=1
bDarkenCenter=0
bRedBlueStereo=0
bBrighten=0
bDarken=0
bSolarize=0
bInvert=0
fWaveAlpha=0.800
fWaveScale=16.217
fWaveSmoothing=0.750
fWaveParam=-0.440
fModWaveAlphaStart=0.750
fModWaveAlphaEnd=0.950
fWarpAnimSpeed=1.000
fWarpScale=1.772
fZoomExponent=4.40100
fShader=0.000
zoom=1.01100
rot=0.00300
cx=0.500
cy=0.500
dx=0.00000
dy=0.00000
warp=0.00000
sx=1.00000
sy=1.00000
wave_r=0.500
wave_g=0.500
wave_b=0.500
wave_x=0.500
wave_y=0.500
ob_size=0.010
ob_r=0.000
ob_g=0.000
ob_b=0.000
ob_a=0.000
ib_size=0.010
ib_r=0.250
ib_g=0.250
ib_b=0.250
ib_a=0.000
nMotionVectorsX=12.000
nMotionVectorsY=9.000
mv_dx=0.000
mv_dy=0.000
mv_l=0.900
mv_r=1.000
mv_g=1.000
mv_b=1.000
mv_a=0.000
b1n=0.000
b2n=0.000
b3n=0.000
b1x=1.000
b2x=1.000
b3x=1.000
b1ed=0.250
wavecode_0_enabled=0
wavecode_0_samples=512
wavecode_0_sep=0
wavecode_0_bSpectrum=0
wavecode_0_bUseDots=0
wavecode_0_bDrawThick=0
wavecode_0_bAdditive=0
wavecode_0_scaling=1.00000
wavecode_0_smoothing=0.50000
wavecode_0_r=1.000
wavecode_0_g=1.000
wavecode_0_b=1.000
wavecode_0_a=1.000
wavecode_1_enabled=0
wavecode_1_samples=512
wavecode_1_sep=0
wavecode_1_bSpectrum=0
wavecode_1_bUseDots=0
wavecode_1_bDrawThick=0
wavecode_1_bAdditive=0
wavecode_1_scaling=1.00000
wavecode_1_smoothing=0.50000
wavecode_1_r=1.000
wavecode_1_g=1.000
wavecode_1_b=1.000
wavecode_1_a=1.000
wavecode_2_enabled=0
wavecode_2_samples=512
wavecode_2_sep=0
wavecode_2_bSpectrum=0
wavecode_2_bUseDots=0
wavecode_2_bDrawThick=0
wavecode_2_bAdditive=0
wavecode_2_scaling=1.00000
wavecode_2_smoothing=0.50000
wavecode_2_r=1.000
wavecode_2_g=1.000
wavecode_2_b=1.000
wavecode_2_a=1.000
wavecode_3_enabled=0
wavecode_3_samples=512
wavecode_3_sep=0
wavecode_3_bSpectrum=0
wavecode_3_bUseDots=0
wavecode_3_bDrawThick=0
wavecode_3_bAdditive=0
wavecode_3_scaling=1.00000
wavecode_3_smoothing=0.50000
wavecode_3_r=1.000
wavecode_3_g=1.000
wavecode_3_b=1.000
wavecode_3_a=1.000
shapecode_0_enabled=0
shapecode_0_sides=4
shapecode_0_additive=1
shapecode_0_thickOutline=0
shapecode_0_textured=1
shapecode_0_num_inst=1
shapecode_0_x=0.500
shapecode_0_y=0.500
shapecode_0_rad=0.59958
shapecode_0_ang=0.00000
shapecode_0_tex_ang=0.00000
shapecode_0_tex_zoom=1.00000
shapecode_0_r=1.000
shapecode_0_g=1.000
shapecode_0_b=1.000
shapecode_0_a=1.000
shapecode_0_r2=1.000
shapecode_0_g2=1.000
shapecode_0_b2=1.000
shapecode_0_a2=0.000
shapecode_0_border_r=0.000
shapecode_0_border_g=0.000
shapecode_0_border_b=0.000
shapecode_0_border_a=0.100
shapecode_1_enabled=0
shapecode_1_sides=4
shapecode_1_additive=0
shapecode_1_thickOutline=0
shapecode_1_textured=0
shapecode_1_num_inst=1
shapecode_1_x=0.500
shapecode_1_y=0.500
shapecode_1_rad=0.10000
shapecode_1_ang=0.00000
shapecode_1_tex_ang=0.00000
shapecode_1_tex_zoom=1.00000
shapecode_1_r=1.000
shapecode_1_g=0.000
shapecode_1_b=0.000
shapecode_1_a=1.000
shapecode_1_r2=0.000
shapecode_1_g2=1.000
shapecode_1_b2=0.000
shapecode_1_a2=0.000
shapecode_1_border_r=1.000
shapecode_1_border_g=1.000
shapecode_1_border_b=1.000
shapecode_1_border_a=0.100
shapecode_2_enabled=0
shapecode_2_sides=4
shapecode_2_additive=0
shapecode_2_thickOutline=0
shapecode_2_textured=0
shapecode_2_num_inst=1
shapecode_2_x=0.500
shapecode_2_y=0.500
shapecode_2_rad=0.10000
shapecode_2_ang=0.00000
shapecode_2_tex_ang=0.00000
shapecode_2_tex_zoom=1.00000
shapecode_2_r=1.000
shapecode_2_g=0.000
shapecode_2_b=0.000
shapecode_2_a=1.000
shapecode_2_r2=0.000
shapecode_2_g2=1.000
shapecode_2_b2=0.000
shapecode_2_a2=0.000
shapecode_2_border_r=1.000
shapecode_2_border_g=1.000
shapecode_2_border_b=1.000
shapecode_2_border_a=0.100
shapecode_3_enabled=0
shapecode_3_sides=4
shapecode_3_additive=0
shapecode_3_thickOutline=0
shapecode_3_textured=0
shapecode_3_num_inst=1
shapecode_3_x=0.500
shapecode_3_y=0.500
shapecode_3_rad=0.10000
shapecode_3_ang=0.00000
shapecode_3_tex_ang=0.00000
shapecode_3_tex_zoom=1.00000
shapecode_3_r=1.000
shapecode_3_g=0.000
shapecode_3_b=0.000
shapecode_3_a=1.000
shapecode_3_r2=0.000
shapecode_3_g2=1.000
shapecode_3_b2=0.000
shapecode_3_a2=0.000
shapecode_3_border_r=1.000
shapecode_3_border_g=1.000
shapecode_3_border_b=1.000
shapecode_3_border_a=0.100
per_frame_1=t = time*12.3;
per_frame_2=wave_x = wave_x + 0.350*( 0.70*sin(2.221*time*5) + 0.30*sin(1.821*time*15) );
per_frame_3=wave_y = wave_y + 0.350*( 0.30*sin(1.942*time*5) + 0.70*sin(2.522*time*15) );
per_frame_4=wave_r = wave_r + 0.790*( 0.60*sin(0.823*t) + 0.40*sin(0.916*t) );
per_frame_5=wave_g = wave_g + 0.790*( 0.60*sin(0.900*t) + 0.40*sin(1.023*t) );
per_frame_6=wave_b = wave_b + 0.790*( 0.60*sin(0.808*t) + 0.40*sin(0.949*t) );
per_frame_7=rot = rot + 0.030*( 0.60*sin(0.38*time) + 0.40*sin(0.54*time) );
per_frame_8=dx = dx + 0.002*( 0.60*sin(0.434*time) + 0.40*sin(0.277*time) );
per_frame_9=dy = dy + 0.002*( 0.60*sin(0.384*time) + 0.40*sin(0.477*time) );
warp_1=`#define MyGet GetPixel //GetBlur1
warp_2=`shader_body
warp_3=`{
warp_4=` // GROW EFFECT - bright pixels spread radially outward.
warp_5=` // BE CAREFUL - this can really thrash the texture cache! (SLOW)
warp_6=` float grad_rad = 4; //TWEAK - should be a least 4 for max. compatibility!
warp_7=` float str = 2.8; //TWEAK
warp_8=` float3 d = float3(texsize.zw, 0) * grad_rad;
warp_9=` float4 lums = 0;
warp_10=` lums.x = lum( MyGet(uv + texsize.zw*d.xz) );
warp_11=` lums.y = lum( MyGet(uv - texsize.zw*d.xz) );
warp_12=` lums.z = lum( MyGet(uv + texsize.zw*d.zy) );
warp_13=` lums.w = lum( MyGet(uv - texsize.zw*d.zy) );
warp_14=` float2 grad = float2(lums.x-lums.y, lums.z-lums.w)*str*1000/grad_rad;
warp_15=` grad = (saturate(grad*0.5+0.5)*2-1)*1.4;
warp_16=` // sample previous frame
warp_17=` ret = tex2D( sampler_fc_main, uv + grad*texsize.zw ).xyz;
warp_18=`
warp_19=` // darken (decay) over time
warp_20=` ret *= 0.95; //or try: ret -= 0.004;
warp_21=`}
comp_1=`shader_body
comp_2=`{
comp_3=` //uv.y = rad*rad;
comp_4=` float srad = sqrt(rad)+ 0.05;
comp_5=`
comp_6=` ret = tex2D(sampler_main, uv).xyz;
comp_7=` ret = max(ret, tex2D(sampler_main, uv + 0.045*float2(cos(uv.x*37),sin(uv.y*29))).xyz);
comp_8=`
comp_9=` //ret += GetBlur1(uv) - 0.07;
comp_10=` //ret *= float3(1.3,0.8,0.5);
comp_11=` //ret *= 0.8;
comp_12=`}
|
{
"pile_set_name": "Github"
}
|
.. _sphx_glr_auto_examples_plot_align.py:
=============================
Aligning matrices to a common space
=============================
In this example, we plot the trajectory of multivariate brain activity for
two groups of subjects that have been hyperaligned (Haxby et al, 2011). First,
we use the align tool to project all subjects in the list to a common space.
Then we average the data into two groups, and plot.
.. image:: /auto_examples/images/sphx_glr_plot_align_001.png
:align: center
.. code-block:: python
# Code source: Andrew Heusser
# License: MIT
# import
import hypertools as hyp
import numpy as np
# load example data
data = hyp.load('weights').get_data()
data = hyp.align(data, align='hyper')
# average into two groups
group1 = np.mean(data[:17], 0)
group2 = np.mean(data[18:], 0)
# plot
hyp.plot([group1[:100, :], group2[:100, :]])
**Total running time of the script:** ( 0 minutes 0.432 seconds)
.. only :: html
.. container:: sphx-glr-footer
.. container:: sphx-glr-download
:download:`Download Python source code: plot_align.py <plot_align.py>`
.. container:: sphx-glr-download
:download:`Download Jupyter notebook: plot_align.ipynb <plot_align.ipynb>`
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
|
{
"pile_set_name": "Github"
}
|
#ifndef INCLUDED_CSFTYPES
# define INCLUDED_CSFTYPES
#ifdef USE_IN_GDAL
#include "cpl_port.h"
#endif
#ifdef __cplusplus
extern "C" {
#define CSF_IN_GLOBAL_NS ::
#else
#define CSF_IN_GLOBAL_NS
#endif
#ifdef CSF_V1
# error include file CSF version 2 used while CSF_V1 is defined
#endif
/* MACHINE AND OPERATING SYSTEM DEPENDENT SECTION:
* (LOOK AND CONFIGURE YOUR MACHINE/OS)
* - Retype all types for file i/o
* - Define endian mode
* - Compliance mode (POSIX/XOPEN)
*/
#ifdef THINK_C
# error read notes in csftypes.h
/* Some history:
* THINK C 3.0:
* - does not know the keyword signed
* - uses a 12-byte for double if compiled with
* the in-line 68881 option
*/
#endif
/* the only 64 bit cpu we tested on:
* -ifdef __alpha
* don't use long
* -define CSF_4BYTE_INT_SIZE_SPECIFIER long
*/
#define CSF_4BYTE_INT_SIZE_SPECIFIER
/* some old C++ compiler complains
* about signed
*/
#ifdef SIGNED_NOT_IMPL
# define CSF_SIGNED_SPECIFIER
#else
# define CSF_SIGNED_SPECIFIER signed
#endif
/* the last-character figure is the
* size in bytes of the data type
*/
typedef CSF_SIGNED_SPECIFIER char INT1;
typedef unsigned char UINT1;
#ifdef USE_IN_GDAL
typedef GInt16 INT2;
typedef GInt32 INT4;
typedef GUInt16 UINT2;
typedef GUInt32 UINT4;
#else
typedef CSF_SIGNED_SPECIFIER short int INT2;
typedef CSF_SIGNED_SPECIFIER CSF_4BYTE_INT_SIZE_SPECIFIER int INT4;
typedef unsigned short int UINT2;
typedef unsigned CSF_4BYTE_INT_SIZE_SPECIFIER int UINT4;
#endif
#ifdef __GNUC__
/* Modern versions of GCC use knowledge about strict aliasing to implement
* certain optimizations. We have some code that fails to comply to the
* strict aliasing rules (see uses of UINT_ALIASING in this header).
* These are simple cases that should not be optimized. Using
* UINT_ALIASING will prevent gcc from optimizing these expressions.
* http://dbp-consulting.com/tutorials/StrictAliasing.html
* http://ohse.de/uwe/articles/gcc-attributes.html#type-may_alias
*/
typedef UINT4 __attribute__((__may_alias__)) UINT4_ALIASING;
#else
typedef UINT4 UINT4_ALIASING;
#endif
#undef CSF_4BYTE_INT_SIZE_SPECIFIER
#undef CSF_SIGNED_SPECIFIER
typedef float REAL4; /* IEEE-754 32-bit */
typedef double REAL8; /* IEEE-754 64-bit */
/* endian mode
* DEFINE WITH -D or find here
*/
#ifndef CPU_BIG_ENDIAN
# ifndef CPU_LITTLE_ENDIAN
#ifdef USE_IN_GDAL
/* GDAL CPL STYLE */
# ifdef CPL_LSB
# define CPU_LITTLE_ENDIAN
# endif
# ifdef CPL_MSB
# define CPU_BIG_ENDIAN
# endif
#else
/* probe a few: */
#ifdef _AIX
/* IBM AIX defines this on RS/6000 */
# define CPU_BIG_ENDIAN
#endif
#ifdef sparc
/* both cc and gcc defines this in SunOS */
# define CPU_BIG_ENDIAN
#endif
/*
* #ifdef mips
* worked once on the SGI machines
* but mips has both endian architectures
* # define CPU_BIG_ENDIAN
* #endif
*/
#ifdef __alpha
/* DEC alpha defines this
* tested on OSF1 planet V4.0 1229 alpha
* in combo with egcs/gcc 2.95.2
*/
# define CPU_LITTLE_ENDIAN
#endif
#ifdef __i386__
/* linux/gcc defines this on intel 80x86 platform */
# define CPU_LITTLE_ENDIAN
#endif
#ifdef __x86_64__
/* linux/gcc defines this on intel 80x86_64 platform */
# define CPU_LITTLE_ENDIAN
#endif
#ifdef _M_X64
/* Mscc defines this on intel 80x86_64 platform */
# define CPU_LITTLE_ENDIAN
#endif
#ifdef _M_IX86
/* Borland C defines this */
/* Win32/MSC defines this on intel 80x86 platform */
# define CPU_LITTLE_ENDIAN
#endif
#ifdef __hppa
/* cc and gcc defines this on HP PA risc platform */
# define CPU_BIG_ENDIAN
#endif
/* endif probing */
# endif
/* endif no ENDIAN defined */
# endif
#endif
/* POSIX or XOPEN compliance
* The only need for the POSIX or even XOPEN superset
* over ANSI-C are
* M_PI HP-UX complained about that and it seems in XOPEN
* solution:
* M_PI is defined in situ in source files if it is not defined
* (most times in math.h)
* we probe a few systems to find if we may define it
*/
#ifdef __hpux
# ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE
# endif
#endif
/* END OF MACHINE AND OPERATING SYSTEM DEPENDENT SECTION
* NO NEED TO EDIT ANYTHING BELOW THIS POINT
*/
/* PROJECTION
*/
/* version 1 types, no longer used
*/
#define PT_XY 0 /* XY-field (= PT_YINCT2B)
*/
#define PT_UTM 1 /* Universal Transverse Mercator (= PT_YDECT2B)
*/
#define PT_LATLON 2 /* Latitude / Longitude (= PT_YDECT2B)
*/
#define PT_CART 3 /* Carthesian (= PT_YDECT2B)
*/
#define PT_RDM 4 /* Rijks Driehoek Metingen stelsel (= PT_YDECT2B)
*/
/* the only difference we make is whether Y increases from
* top to bottom or decreases from top to bottom
*/
typedef enum CSF_PT {
/* * these two can be returned by or passed to a csf2 function */
PT_YINCT2B=0, /* Y increase from top to bottom, wrong do not use */
PT_YDECT2B=1, /* Y decrease from top to bottom, correct */
/* * this one CANNOT be returned by NOR passed to a csf2 function */
PT_UNDEFINED=100 /* just some value different from the rest */
} CSF_PT;
/* DATATYPE
* A.K.A. VALUESCALE
*/
/* historical errors don't use them:
* #define VS_NOTCLASSIFIED 2
* #define VS_CONTINUES 2
*
* NOTE new VS_* types must be different from CR_* values
* VS_BOOLEAN 0xE0 => 224
* VS_NOMINAL 0xE2 => 226
* VS_ORDINAL 0xF2 => 242
* VS_SCALAR 0xEB => 235
* VS_DIRECTION 0xFB => 251
* VS_LDD 0xF0 => 240
* VS_VECTOR 0xEC => 236
* VS_VECTOR 0xEC vector, not used yet
*/
typedef enum CSF_VS {
/* * version 1 datatypes,
* these can be returned by BUT NOT passed to a csf2 function
*/
VS_NOTDETERMINED=0, /* version 1 */
VS_CLASSIFIED =1, /* version 1 */
VS_CONTINUOUS =2, /* version 1 */
/* * version 2 datatypes
* these two can be returned by or passed to a csf2 function
*/
VS_BOOLEAN =0xE0,/* boolean, always UINT1, values: 0,1 or MV_UINT1 */
VS_NOMINAL =0xE2,/* nominal, UINT1 or INT4 */
VS_ORDINAL =0xF2,/* ordinal, UINT1 or INT4 */
VS_SCALAR =0xEB,/* scalar, REAL4 or (maybe) REAL8 */
VS_DIRECTION =0xFB,/* directional REAL4 or (maybe) REAL8, -1 means no direction */
VS_LDD =0xF0,/* local drain direction, always UINT1, values: 1-9 or MV_UINT1 */
/* * this one CANNOT be returned by NOR passed to a csf2 function */
VS_UNDEFINED =100 /* just some value different from the rest */
} CSF_VS;
/* CELL REPRESENTATION
CR_UINT1 0x00 => 0
CR_INT4 0x26 => 38
CR_REAL4 0x5A => 90
CR_INT1 0x04 => 4
CR_INT2 0x15 => 21
CR_UINT2 0x11 => 17
CR_UINT4 0x22 => 34
CR_REAL8 0xDB => 219
for vector types
CR_VECT4 0x??
CR_VECT8 0x??
*/
typedef enum CSF_CR {
/* * preferred version 2 cell representations
*/
CR_UINT1 =0x00, /* boolean, ldd and small nominal and small ordinal */
CR_INT4 =0x26, /* large nominal and large ordinal */
CR_REAL4 =0x5A, /* single scalar and single directional */
/* * other version 2 cell representations
*/
CR_REAL8 =0xDB, /* double scalar or directional, and also the only type that
* can hold all
* cell representation without loss of precision
*/
/* * version 1 cell representations
* these can be returned by BUT NOT passed to a csf2 function
*/
CR_INT1 =0x04, /* . */
CR_INT2 =0x15, /* . */
CR_UINT2 =0x11, /* . */
CR_UINT4 =0x22, /* . */
/* * this one CANNOT be returned by NOR passed to a csf2 function */
CR_UNDEFINED =100 /* just some value different from the rest */
} CSF_CR;
/* how to get the cellsize from these type identifiers */
#define CSF_SIZE_MASK ((size_t)0x03)
#define CSF_SIGN_MASK ((size_t)0x04)
#define CSF_FLOAT_MASK ((size_t)0x08)
#define CSF_FLOAT_SIGN_MASK ((size_t)0x0C)
#define CSF_SIZE_MV_MASK ((size_t)0x30)
#define CSF_SKIP_MASK ((size_t)0xC0)
/* low nibble is uniq for every CR_VALUE: */
#define CSF_UNIQ_MASK ((size_t)0x0F)
#define CSF_POS_SIZE_MV_MASK ((size_t)4)
#define CSF_POS_SKIP_MASK ((size_t)6)
#define CSF_UNIQ_CR_MASK(type) ((size_t)((type) & CSF_UNIQ_MASK))
#define LOG_CELLSIZE(type) ((size_t)((type) & CSF_SIZE_MASK))
#define CELLSIZE(type) ((size_t)(1 << LOG_CELLSIZE(type)))
#define CSFSIZEOF(nr, type) ((size_t)(((size_t)nr) << LOG_CELLSIZE(type)))
#include <float.h> /* FLT_MIN, DBL_MAX, DBL_MAX, FLT_MAX */
#define MV_INT1 ((CSF_IN_GLOBAL_NS INT1)-128)
#define MV_INT2 ((CSF_IN_GLOBAL_NS INT2)-32768)
/* cl C4146 has it right
#define MV_INT4 ((CSF_IN_GLOBAL_NS INT4)-2147483648)
is dangerous
*/
#define MV_INT4 ((CSF_IN_GLOBAL_NS INT4)0x80000000L)
#define MV_UINT1 ((CSF_IN_GLOBAL_NS UINT1)0xFF)
#define MV_UINT2 ((CSF_IN_GLOBAL_NS UINT2)0xFFFF)
#define MV_UINT4 ((CSF_IN_GLOBAL_NS UINT4)0xFFFFFFFFL)
#define INT2_MIN ((INT2)(MV_INT2+1))
#define INT2_MAX ((INT2)0x7FFF)
#define UINT1_MIN ((UINT1)0)
#define UINT1_MAX ((UINT1)(MV_UINT1-1))
#define INT4_MIN ((INT4)(MV_INT4+1))
#define INT4_MAX ((INT4)0x7FFFFFFFL)
#define REAL4_MIN ((REAL4)(FLT_MIN))
#define REAL4_MAX ((REAL4)(FLT_MAX))
#define REAL8_MIN ((REAL8)(DBL_MIN))
#define REAL8_MAX ((REAL8)(DBL_MAX))
/* x is a pointer to a value */
#define IS_MV_UINT1(x) ((*((const CSF_IN_GLOBAL_NS UINT1 *)x)) == MV_UINT1)
#define IS_MV_UINT2(x) ((*((const CSF_IN_GLOBAL_NS UINT2 *)x)) == MV_UINT2)
#define IS_MV_UINT4(x) ((*((const CSF_IN_GLOBAL_NS UINT4 *)x)) == MV_UINT4)
#define IS_MV_INT1(x) ((*((const CSF_IN_GLOBAL_NS INT1 *)x)) == MV_INT1)
#define IS_MV_INT2(x) ((*((const CSF_IN_GLOBAL_NS INT2 *)x)) == MV_INT2)
#define IS_MV_INT4(x) ((*((const CSF_IN_GLOBAL_NS INT4 *)x)) == MV_INT4)
/* MV_REAL4 and MV_REAL8 are bitpatterns with all 1's that
* are NAN's
* MV_REAL4 has the same bitpattern as a MV_UINT4
* MV_REAL8 has the same bitpattern as two MV_UINT4's
* only the first 32 bits already identify a NAN,
* so that's what we test
*/
#ifdef CPU_LITTLE_ENDIAN
# ifdef CPU_BIG_ENDIAN
# error CPU_BIG_ENDIAN and CPU_LITTLE_ENDIAN are both defined
# endif
# ifdef INTEL16
# define IS_MV_REAL4(x) (((const UINT2 *)(x))[1] == MV_UINT2)
# define IS_MV_REAL8(x) (((const UINT2 *)(x))[3] == MV_UINT2)
# else
# define IS_MV_REAL4(x) ((*((const CSF_IN_GLOBAL_NS UINT4_ALIASING *)(x))) == MV_UINT4)
# define IS_MV_REAL8(x) (((const CSF_IN_GLOBAL_NS UINT4_ALIASING *)(x))[1] == MV_UINT4)
# endif
#else
# ifdef CPU_BIG_ENDIAN
# ifdef CPU_LITTLE_ENDIAN
# error CPU_BIG_ENDIAN and CPU_LITTLE_ENDIAN are both defined
# endif
# define IS_MV_REAL4(x) (((const UINT4 *)(x))[0] == MV_UINT4)
# define IS_MV_REAL8(x) (((const UINT4 *)(x))[0] == MV_UINT4)
# else
# error BYTE ORDER NOT SPECIFIED (CPU_LITTLE_ENDIAN or CPU_BIG_ENDIAN)
# endif
#endif
/* some special values
*/
#define LDD_PIT 5
#define DIR_NODIRECTION -1
/* some special macro's
* x is a pointer
*/
#define SET_MV_UINT1(x) ( (*((UINT1 *)(x))) = MV_UINT1)
#define SET_MV_UINT2(x) ( (*((UINT2 *)(x))) = MV_UINT2)
#define SET_MV_UINT4(x) ( (*((UINT4 *)(x))) = MV_UINT4)
#define SET_MV_INT1(x) ( (*(( INT1 *)(x))) = MV_INT1)
#define SET_MV_INT2(x) ( (*(( INT2 *)(x))) = MV_INT2)
#define SET_MV_INT4(x) ( (*(( INT4 *)(x))) = MV_INT4)
#define SET_MV_REAL4(x) ((*(CSF_IN_GLOBAL_NS UINT4_ALIASING *)(x)) = MV_UINT4)
#define SET_MV_REAL8(x) SET_MV_REAL4((x)),SET_MV_REAL4((((CSF_IN_GLOBAL_NS UINT4 *)(x))+1))
/* copy of floats by typecasting to
* an integer since MV_REAL? is a NAN
*/
#define COPY_REAL4(dest,src) ( (*(UINT4_ALIASING *)(dest)) = (*(const UINT4_ALIASING *)(src)) )
#define COPY_REAL8(dest,src) COPY_REAL4((dest),(src)),\
COPY_REAL4( (((UINT4 *)(dest))+1),(((const UINT4 *)(src))+1) )
#ifdef __cplusplus
}
#endif
#endif
|
{
"pile_set_name": "Github"
}
|
The class diagram for the stream classes is shown below:
*===========================* *============================*
| InputStreamCallback<S, T> | | OutputStreamCallback<S, T> |
*===========================* *============================*
| |
|-inherits from inherits from-|
| |
| |
| +-------------------------------+ +--------------------------------+ |
| | SyncInputStreamCallback<S, T> | | SyncOutputStreamCallback<S, T> | |
| +-------------------------------+ +--------------------------------+ |
| | ^ | | ^ | |
| |-inherits from | |-uses uses-| | inherits from-| |
| | | | | | | |
| | creates-| | | |-creates | |
| | | V V | | |
| | *================* *=================* | |
| | | InputStream<T> | | OutputStream<T> | | |
| | *================* *=================* | |
| | | | | |
| | |-uses uses-| | |
| | | | | |
| V V V | |
| / - - - - - - - - - - - - - - - -\ / - - - - - - - - - - - - - - - - \ |
| | SyncInputStreamCallbackBase<T> | | SyncOutputStreamCallbackBase<T> | |
| \ - - - - - - - - - - - - - - - -/ \ - - - - - - - - - - - - - - - - / |
| | | |
| |-inherits from inherits from-| |
| | | |
| V V |
| +-------------------------+ +--------------------------+ |
\-> | InputStreamCallbackBase |------\ /-----| OutputStreamCallbackBase |<-/
+-------------------------+ | | +--------------------------+
| *^ | | ^* |
uses-| | uses-| |-uses | |-uses
| | | | | |
| |-uses | | uses-| |
| |-owns | | owns-| |
V 1| | | |1 V
+--------------+ | | +------------+
/--------| StreamSource |--\ | | /--| StreamSink |---------\
| +--------------+ | | | | +------------+ |
|-uses ^ | | | | ^ uses-|
|-owns | uses-| | | |-uses | owns-|
| |-uses | | | | uses-| |
| |-owns | | | | owns-| |
V | V V V V | V
+--------------+ | +---------------+ | +--------------+
| StreamReader | \---------| StreamManager |-------/ | StreamWriter |
+--------------+ +---------------+ +--------------+
| |
| |
/--------/ \--------------\
| |
|-uses uses-|
| |
V V
/ - - - - - - - - - - - \ +-----------+
| StreamChannelCallback | | EventBase |
\ - - - - - - - - - - - / +-----------+
Legend:
/ - - - - - \ +-------+ +=====================+
| Interface | | Class | | ClassExposedToUsers |
\ - - - - - / +-------+ +=====================+
|
{
"pile_set_name": "Github"
}
|
using N2.Engine;
using N2.Web.Parts;
namespace N2.Tests.Web.Items
{
[Adapts(typeof(CustomItem))]
public class CustomZoneController : PartsAdapter
{
}
}
|
{
"pile_set_name": "Github"
}
|
class Ispell < Formula
desc "International Ispell"
homepage "http://lasr.cs.ucla.edu/geoff/ispell.html"
url "https://www.cs.hmc.edu/~geoff/tars/ispell-3.4.00.tar.gz"
mirror "https://mirrors.kernel.org/debian/pool/main/i/ispell/ispell_3.4.00.orig.tar.gz"
sha256 "5dc42e458635f218032d3ae929528e5587b1e7247564f0e9f9d77d5ccab7aec2"
bottle do
sha256 "81d9f6f9aca0f92ba3bece2ad22d0b0bca29c719304c6c5e8e59b02a3c8763da" => :el_capitan
sha256 "ff46baf7aa6daf42fddde68897bd80dbb073922b4556c502e7b0072656b48498" => :yosemite
sha256 "f1ee90dcc76682d17c2b758d2a896493448753acc0e556e9b0c8bf7ec0f552df" => :mavericks
sha256 "dbbaabbc715f6f16dfb9f2cd05755a88e471b92c63d7f87f79a940a5df8dadfb" => :mountain_lion
end
def install
ENV.deparallelize
ENV.no_optimization
# No configure script, so do this all manually
cp "local.h.macos", "local.h"
chmod 0644, "local.h"
inreplace "local.h" do |s|
s.gsub! "/usr/local", prefix
s.gsub! "/man/man", "/share/man/man"
s.gsub! "/lib", "/lib/ispell"
end
chmod 0644, "correct.c"
inreplace "correct.c", "getline", "getline_ispell"
system "make config.sh"
chmod 0644, "config.sh"
inreplace "config.sh", "/usr/share/dict", "#{share}/dict"
(lib/"ispell").mkpath
system "make", "install"
end
test do
assert_equal "BOTHER BOTHE/R BOTH/R",
`echo BOTHER | #{bin}/ispell -c`.chomp
end
end
|
{
"pile_set_name": "Github"
}
|
/*
Copyright (C) 2011 Martin S.
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.
*/
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\r\n]*/,null,"%"]],[["kwd",/^\\[a-zA-Z@]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[{}()\[\]=]+/]]),["latex","tex"]);
|
{
"pile_set_name": "Github"
}
|
_errorMessage() {
# ${1}: message to sent
${printf} "\033[31m * \033[0m${1}\n"
_logMessages "Error: ${1}"
}
_infoMessage() {
# ${1}: message to sent
${printf} "\033[32m * \033[0m${1}\n"
_logMessages "Info: ${1}"
}
_optionMessages() {
local -a selectedOptions=("${@}")
_warningMessage "Options selected: ${selectedOptions[*]/--mysql-password=*/--mysql-password=****}"
if [ ${assumeyes} = "false" ]; then
_questionMessage "Do you want to continue? [y/N] "
read answer
local answer=${answer:-"n"}
else
local answer="y"
fi
if [ ${answer,,} = "n" ]; then
_errorMessage "User exit"
exit 1
fi
}
_questionMessage() {
# ${1}: message to sent
${printf} "\033[34m * \033[0m${1}"
}
_warningMessage() {
# ${1}: message to sent
echo " * ${1}"
_logMessages "Warning: ${1}"
}
_endMessage() {
_infoMessage "Successful installation!"
}
|
{
"pile_set_name": "Github"
}
|
# Event 153 - ContentFramerateDetected
###### Version: 0
## Description
None
## Data Dictionary
|Standard Name|Field Name|Type|Description|Sample Value|
|---|---|---|---|---|
|TBD|object|Pointer|None|`None`|
|TBD|FrameDuration|UInt64|None|`None`|
## Tags
* etw_level_Informational
* etw_task_ContentFramerateDetected
|
{
"pile_set_name": "Github"
}
|
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"dimanche",
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi"
],
"ERANAMES": [
"avant J\u00e9sus-Christ",
"apr\u00e8s J\u00e9sus-Christ"
],
"ERAS": [
"av. J.-C.",
"ap. J.-C."
],
"FIRSTDAYOFWEEK": 0,
"MONTH": [
"janvier",
"f\u00e9vrier",
"mars",
"avril",
"mai",
"juin",
"juillet",
"ao\u00fbt",
"septembre",
"octobre",
"novembre",
"d\u00e9cembre"
],
"SHORTDAY": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"SHORTMONTH": [
"janv.",
"f\u00e9vr.",
"mars",
"avr.",
"mai",
"juin",
"juil.",
"ao\u00fbt",
"sept.",
"oct.",
"nov.",
"d\u00e9c."
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y HH:mm:ss",
"mediumDate": "d MMM y",
"mediumTime": "HH:mm:ss",
"short": "dd/MM/y HH:mm",
"shortDate": "dd/MM/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u00a0",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a0\u00a4",
"posPre": "",
"posSuf": "\u00a0\u00a4"
}
]
},
"id": "fr-mc",
"pluralCat": function(n, opt_precision) { var i = n | 0; if (i == 0 || i == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
|
{
"pile_set_name": "Github"
}
|
------------------------------------------------------------------------------
-- GNAT Studio --
-- --
-- Copyright (C) 2006-2020, AdaCore --
-- --
-- This is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY 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 distributed with this software; see file --
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy --
-- of the license. --
------------------------------------------------------------------------------
with Glib_Values_Utils; use Glib_Values_Utils;
with Code_Analysis_Tree_Model; use Code_Analysis_Tree_Model;
with Code_Analysis_GUI; use Code_Analysis_GUI;
with Code_Coverage; use Code_Coverage;
with GNATCOLL.VFS;
with System;
package body Code_Analysis_Tree_Model is
procedure Set_Columns_Values
(Model : Gtk_Tree_Store;
Iter : Gtk_Tree_Iter;
Icon : String;
Name : String;
Node : System.Address;
File : System.Address;
Prjoject : System.Address);
-- Set model's values.
---------------
-- Fill_Iter --
---------------
procedure Fill_Iter
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Analysis_Id : Analysis;
Bin_Mode : Boolean := False) is
begin
if Analysis_Id.Coverage_Data /= null then
Fill_Iter (Model, Iter, Analysis_Id.Coverage_Data, Bin_Mode);
else
Set_And_Clear
(Model, Iter, (Cov_Col, Cov_Sort, Cov_Bar_Txt, Cov_Bar_Val),
(1 => As_String ("n/a"),
2 => As_Int (0),
3 => As_String ("n/a"),
4 => As_Int (0)));
end if;
end Fill_Iter;
---------------
-- Fill_Iter --
---------------
procedure Fill_Iter
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Parent : Gtk_Tree_Iter;
Prj_Node : Project_Access;
File_Node : File_Access;
Subp_Node : Subprogram_Access;
Bin_Mode : Boolean := False) is
begin
Append (Model, Iter, Parent);
Set_Columns_Values
(Model, Iter,
Icon => Subp_Pixbuf_Cst,
Name => Subp_Node.Name.all,
Node => Subp_Node.all'Address,
File => File_Node.all'Address,
Prjoject => Prj_Node.all'Address);
Fill_Iter (Model, Iter, Subp_Node.Analysis_Data, Bin_Mode);
end Fill_Iter;
--------------------------------
-- Fill_Iter_With_Subprograms --
--------------------------------
procedure Fill_Iter_With_Subprograms
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Prj_Node : Project_Access;
File_Node : File_Access;
Subp_Node : Subprogram_Access;
Bin_Mode : Boolean := False) is
begin
Append (Model, Iter, Null_Iter);
Set_Columns_Values
(Model, Iter,
Icon => Subp_Pixbuf_Cst,
Name => Subp_Node.Name.all,
Node => Subp_Node.all'Address,
File => File_Node.all'Address,
Prjoject => Prj_Node.all'Address);
Fill_Iter (Model, Iter, Subp_Node.Analysis_Data, Bin_Mode);
end Fill_Iter_With_Subprograms;
---------------
-- Fill_Iter --
---------------
procedure Fill_Iter
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Sibling : in out Gtk_Tree_Iter;
Parent : Gtk_Tree_Iter;
Prj_Node : Project_Access;
File_Node : File_Access;
Bin_Mode : Boolean := False)
is
use Subprogram_Maps;
Map_Cur : Subprogram_Maps.Cursor := File_Node.Subprograms.First;
Self_Iter : Gtk_Tree_Iter;
Sort_Arr : Subprogram_Array
(1 .. Integer (File_Node.Subprograms.Length));
begin
if File_Node.Analysis_Data.Coverage_Data /= null
and then File_Node.Analysis_Data.Coverage_Data.Is_Valid
then
Insert_After (Model, Iter, Parent, Sibling);
Sibling := Iter;
else
Append (Model, Iter, Parent);
end if;
Self_Iter := Iter;
Set_Columns_Values
(Model, Iter,
Icon => File_Pixbuf_Cst,
Name => GNATCOLL.VFS.Display_Base_Name (File_Node.Name),
Node => File_Node.all'Address,
File => File_Node.all'Address,
Prjoject => Prj_Node.all'Address);
Fill_Iter (Model, Iter, File_Node.Analysis_Data, Bin_Mode);
for J in Sort_Arr'Range loop
Sort_Arr (J) := (Element (Map_Cur));
Next (Map_Cur);
end loop;
Sort_Subprograms (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter (Model, Iter, Self_Iter, Prj_Node, File_Node, Sort_Arr (J),
Bin_Mode);
end loop;
end Fill_Iter;
--------------------------
-- Fill_Iter_With_Files --
--------------------------
procedure Fill_Iter_With_Files
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Sibling : in out Gtk_Tree_Iter;
Prj_Node : Project_Access;
File_Node : File_Access;
Bin_Mode : Boolean := False) is
begin
if File_Node.Analysis_Data.Coverage_Data /= null
and then File_Node.Analysis_Data.Coverage_Data.Is_Valid
then
Insert_After (Model, Iter, Null_Iter, Sibling);
Sibling := Iter;
else
Append (Model, Iter, Null_Iter);
end if;
Set_Columns_Values
(Model, Iter,
Icon => File_Pixbuf_Cst,
Name => GNATCOLL.VFS.Display_Base_Name (File_Node.Name),
Node => File_Node.all'Address,
File => File_Node.all'Address,
Prjoject => Prj_Node.all'Address);
Fill_Iter (Model, Iter, File_Node.Analysis_Data, Bin_Mode);
end Fill_Iter_With_Files;
--------------------------------
-- Fill_Iter_With_Subprograms --
--------------------------------
procedure Fill_Iter_With_Subprograms
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Prj_Node : Project_Access;
File_Node : File_Access;
Bin_Mode : Boolean := False)
is
use Subprogram_Maps;
Map_Cur : Subprogram_Maps.Cursor := File_Node.Subprograms.First;
Sort_Arr : Subprogram_Array
(1 .. Integer (File_Node.Subprograms.Length));
begin
for J in Sort_Arr'Range loop
Sort_Arr (J) := (Element (Map_Cur));
Next (Map_Cur);
end loop;
Sort_Subprograms (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter_With_Subprograms
(Model, Iter, Prj_Node, File_Node, Sort_Arr (J), Bin_Mode);
end loop;
end Fill_Iter_With_Subprograms;
---------------
-- Fill_Iter --
---------------
procedure Fill_Iter
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Sibling : in out Gtk_Tree_Iter;
Prj_Node : Project_Access;
Bin_Mode : Boolean := False)
is
use File_Maps;
Map_Cur : File_Maps.Cursor := Prj_Node.Files.First;
Self_Iter : Gtk_Tree_Iter;
Sort_Arr : File_Array (1 .. Integer (Prj_Node.Files.Length));
Child_Sibl : Gtk_Tree_Iter := Null_Iter;
begin
if Prj_Node.Analysis_Data.Coverage_Data /= null
and then Prj_Node.Analysis_Data.Coverage_Data.Is_Valid
then
Insert_After (Model, Iter, Null_Iter, Sibling);
Sibling := Iter;
else
Append (Model, Iter, Null_Iter);
end if;
Self_Iter := Iter;
Set_And_Clear
(Model, Iter, (Icon_Name_Col, Name_Col, Node_Col),
(1 => As_String (Prj_Pixbuf_Cst),
2 => As_String (Prj_Node.View.Name),
3 => As_Pointer (Prj_Node.all'Address)));
Fill_Iter (Model, Iter, Prj_Node.Analysis_Data, Bin_Mode);
for J in Sort_Arr'Range loop
Sort_Arr (J) := Element (Map_Cur);
Next (Map_Cur);
end loop;
Sort_Files (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter (Model, Iter, Child_Sibl, Self_Iter, Prj_Node, Sort_Arr (J),
Bin_Mode);
end loop;
end Fill_Iter;
--------------------------
-- Fill_Iter_With_Files --
--------------------------
procedure Fill_Iter_With_Files
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Sibling : in out Gtk_Tree_Iter;
Prj_Node : Project_Access;
Bin_Mode : Boolean := False)
is
use File_Maps;
Map_Cur : File_Maps.Cursor := Prj_Node.Files.First;
Sort_Arr : File_Array (1 .. Integer (Prj_Node.Files.Length));
begin
for J in Sort_Arr'Range loop
Sort_Arr (J) := Element (Map_Cur);
Next (Map_Cur);
end loop;
Sort_Files (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter_With_Files
(Model, Iter, Sibling, Prj_Node, Sort_Arr (J), Bin_Mode);
end loop;
end Fill_Iter_With_Files;
--------------------------------
-- Fill_Iter_With_Subprograms --
--------------------------------
procedure Fill_Iter_With_Subprograms
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Prj_Node : Project_Access;
Bin_Mode : Boolean := False)
is
use File_Maps;
Map_Cur : File_Maps.Cursor := Prj_Node.Files.First;
Sort_Arr : File_Array (1 .. Integer (Prj_Node.Files.Length));
begin
for J in Sort_Arr'Range loop
Sort_Arr (J) := Element (Map_Cur);
Next (Map_Cur);
end loop;
Sort_Files (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter_With_Subprograms
(Model, Iter, Prj_Node, Sort_Arr (J), Bin_Mode);
end loop;
end Fill_Iter_With_Subprograms;
---------------
-- Fill_Iter --
---------------
procedure Fill_Iter
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Projects : Code_Analysis_Tree;
Bin_Mode : Boolean := False)
is
use Project_Maps;
Map_Cur : Project_Maps.Cursor := Projects.First;
Sort_Arr : Project_Array (1 .. Integer (Projects.Length));
Sibling : Gtk_Tree_Iter := Null_Iter;
begin
for J in Sort_Arr'Range loop
Sort_Arr (J) := Element (Map_Cur);
Next (Map_Cur);
end loop;
Sort_Projects (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter (Model, Iter, Sibling, Sort_Arr (J), Bin_Mode);
end loop;
end Fill_Iter;
--------------------------
-- Fill_Iter_With_Files --
--------------------------
procedure Fill_Iter_With_Files
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Projects : Code_Analysis_Tree;
Bin_Mode : Boolean := False)
is
use Project_Maps;
Map_Cur : Project_Maps.Cursor := Projects.First;
Sort_Arr : Project_Array (1 .. Integer (Projects.Length));
Sibling : Gtk_Tree_Iter := Null_Iter;
begin
for J in Sort_Arr'Range loop
Sort_Arr (J) := Element (Map_Cur);
Next (Map_Cur);
end loop;
Sort_Projects (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter_With_Files (Model, Iter, Sibling, Sort_Arr (J), Bin_Mode);
end loop;
end Fill_Iter_With_Files;
--------------------------------
-- Fill_Iter_With_Subprograms --
--------------------------------
procedure Fill_Iter_With_Subprograms
(Model : Gtk_Tree_Store;
Iter : in out Gtk_Tree_Iter;
Projects : Code_Analysis_Tree;
Bin_Mode : Boolean := False)
is
use Project_Maps;
Map_Cur : Project_Maps.Cursor := Projects.First;
Sort_Arr : Project_Array (1 .. Integer (Projects.Length));
begin
for J in Sort_Arr'Range loop
Sort_Arr (J) := Element (Map_Cur);
Next (Map_Cur);
end loop;
Sort_Projects (Sort_Arr);
for J in Sort_Arr'Range loop
Fill_Iter_With_Subprograms
(Model, Iter, Sort_Arr (J), Bin_Mode);
end loop;
end Fill_Iter_With_Subprograms;
------------------------
-- Set_Columns_Values --
------------------------
procedure Set_Columns_Values
(Model : Gtk_Tree_Store;
Iter : Gtk_Tree_Iter;
Icon : String;
Name : String;
Node : System.Address;
File : System.Address;
Prjoject : System.Address) is
begin
Set_And_Clear
(Model, Iter, (Icon_Name_Col, Name_Col, Node_Col, File_Col, Prj_Col),
(1 => As_String (Icon),
2 => As_String (Name),
3 => As_Pointer (Node),
4 => As_Pointer (File),
5 => As_Pointer (Prjoject)));
end Set_Columns_Values;
end Code_Analysis_Tree_Model;
|
{
"pile_set_name": "Github"
}
|
{
"name": "flipCounter",
"filename": "jquery.flipCounter.pack.js",
"version": "1.2",
"description": "Uses valid markup and an image sprite to render an analogue clock / odometer effect. Clock image is easily customizable, default options can be easily overriden, can be easily animated and extended with jQuery.easing plugin, gracefully degrades if Javascript is not available.",
"keywords": [
"flipcounter",
"number",
"end_number",
"easing",
"duration"
],
"homepage": "http://bloggingsquared.com/jquery/flipcounter/",
"author": {
"name": "Brolly.ca",
"email": "info@brolly.ca"
}
}
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.