text
stringlengths 2
1.04M
| meta
dict |
---|---|
#ifndef CO_GATEWAY_ASCII_H
#define CO_GATEWAY_ASCII_H
#include "301/CO_driver.h"
#include "301/CO_fifo.h"
#include "301/CO_SDOclient.h"
#include "301/CO_NMT_Heartbeat.h"
#include "305/CO_LSSmaster.h"
#include "303/CO_LEDs.h"
/* default configuration, see CO_config.h */
#ifndef CO_CONFIG_GTW
#define CO_CONFIG_GTW (0)
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII) || defined CO_DOXYGEN
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup CO_CANopen_309_3 Gateway ASCII mapping
* CANopen access from other networks - ASCII mapping (CiA 309-3 DSP v3.0.0)
*
* @ingroup CO_CANopen_309
* @{
* This module enables ascii command interface (CAN gateway), which can be used
* for master interaction with CANopen network. Some sort of string input/output
* stream can be used, for example serial port + terminal on microcontroller or
* stdio in OS or sockets, etc.
*
* For example, one wants to read 'Heartbeat producer time' parameter (0x1017,0)
* on remote node (with id=4). Parameter is 16-bit integer. He can can enter
* command string: `[1] 4 read 0x1017 0 i16`. CANopenNode will use SDO client,
* send request to remote node via CAN, wait for response via CAN and prints
* `[1] OK` to output stream on success.
*
* This module is usually initialized and processed in CANopen.c file.
* Application should register own callback function for reading the output
* stream. Application writes new commands with CO_GTWA_write().
*/
/**
* @defgroup CO_CANopen_309_3_Syntax Command syntax
* ASCII command syntax.
*
* @{
*
* @code{.unparsed}
Command strings start with '"["<sequence>"]"' followed by:
[[<net>] <node>] r[ead] <index> <subindex> [<datatype>] # SDO upload.
[[<net>] <node>] w[rite] <index> <subindex> <datatype> <value> # SDO download.
[[<net>] <node>] start # NMT Start node.
[[<net>] <node>] stop # NMT Stop node.
[[<net>] <node>] preop[erational] # NMT Set node to pre-operational.
[[<net>] <node>] reset node # NMT Reset node.
[[<net>] <node>] reset comm[unication] # NMT Reset communication.
[<net>] set network <value> # Set default net.
[<net>] set node <value> # Set default node.
[<net>] set sdo_timeout <value> # Configure SDO time-out.
[<net>] set sdo_block <value> # Enable/disable SDO block transfer.
help [datatype|lss] # Print this or datatype or lss help.
led # Print status LED diodes.
log # Print message log.
Response:
"["<sequence>"]" OK | <value> |
ERROR:<SDO-abort-code> | ERROR:<internal-error-code>
* Every command must be terminated with <CR><LF> ('\\r\\n'). characters. Same
is response. String is not null terminated, <CR> is optional in command.
* Comments started with '#' are ignored. They may be on the beginning of the
line or after the command string.
* 'sdo_timeout' is in milliseconds, 500 by default. Block transfer is
disabled by default.
* If '<net>' or '<node>' is not specified within commands, then value defined
by 'set network' or 'set node' command is used.
Datatypes:
b # Boolean.
i8, i16, i32, i64 # Signed integers.
u8, u16, u32, u64 # Unsigned integers.
x8, x16, x32, x64 # Unsigned integers, displayed as hexadecimal, non-standard.
r32, r64 # Real numbers.
t, td # Time of day, time difference.
vs # Visible string (between double quotes if multi-word).
os, us # Octet, unicode string, (mime-base64 (RFC2045) based, line).
d # domain (mime-base64 (RFC2045) based, one line).
hex # Hexagonal data, optionally space separated, non-standard.
LSS commands:
lss_switch_glob <0|1> # Switch state global command.
lss_switch_sel <vendorID> <product code> \\
<revisionNo> <serialNo> #Switch state selective.
lss_set_node <node> # Configure node-ID.
lss_conf_bitrate <table_selector=0> \\
<table_index> # Configure bit-rate.
lss_activate_bitrate <switch_delay_ms> # Activate new bit-rate.
lss_store # LSS store configuration.
lss_inquire_addr [<LSSSUB=0..3>] # Inquire LSS address.
lss_get_node # Inquire node-ID.
_lss_fastscan [<timeout_ms>] # Identify fastscan, non-standard.
lss_allnodes [<timeout_ms> [<nodeStart=1..127> <store=0|1>\\
[<scanType0> <vendorId> <scanType1> <productCode>\\
<scanType2> <revisionNo> <scanType3> <serialNo>]]]
# Node-ID configuration of all nodes.
* All LSS commands start with '\"[\"<sequence>\"]\" [<net>]'.
* <table_index>: 0=1000 kbit/s, 1=800 kbit/s, 2=500 kbit/s, 3=250 kbit/s,
4=125 kbit/s, 6=50 kbit/s, 7=20 kbit/s, 8=10 kbit/s, 9=auto
* <scanType>: 0=fastscan, 1=ignore, 2=match value in next parameter
* @endcode
*
* This help text is the same as variable contents in CO_GTWA_helpString.
* @}
*/
/** Size of response string buffer. This is intermediate buffer. If there is
* larger amount of data to transfer, then multiple transfers will occur. */
#ifndef CO_GTWA_RESP_BUF_SIZE
#define CO_GTWA_RESP_BUF_SIZE 200
#endif
/** Timeout time in microseconds for some internal states. */
#ifndef CO_GTWA_STATE_TIMEOUT_TIME_US
#define CO_GTWA_STATE_TIMEOUT_TIME_US 1200000
#endif
/**
* Response error codes as specified by CiA 309-3. Values less or equal to 0
* are used for control for some functions and are not part of the standard.
*/
typedef enum {
/** 0 - No error or idle */
CO_GTWA_respErrorNone = 0,
/** 100 - Request not supported */
CO_GTWA_respErrorReqNotSupported = 100,
/** 101 - Syntax error */
CO_GTWA_respErrorSyntax = 101,
/** 102 - Request not processed due to internal state */
CO_GTWA_respErrorInternalState = 102,
/** 103 - Time-out (where applicable) */
CO_GTWA_respErrorTimeOut = 103,
/** 104 - No default net set */
CO_GTWA_respErrorNoDefaultNetSet = 104,
/** 105 - No default node set */
CO_GTWA_respErrorNoDefaultNodeSet = 105,
/** 106 - Unsupported net */
CO_GTWA_respErrorUnsupportedNet = 106,
/** 107 - Unsupported node */
CO_GTWA_respErrorUnsupportedNode = 107,
/** 200 - Lost guarding message */
CO_GTWA_respErrorLostGuardingMessage = 200,
/** 201 - Lost connection */
CO_GTWA_respErrorLostConnection = 201,
/** 202 - Heartbeat started */
CO_GTWA_respErrorHeartbeatStarted = 202,
/** 203 - Heartbeat lost */
CO_GTWA_respErrorHeartbeatLost = 203,
/** 204 - Wrong NMT state */
CO_GTWA_respErrorWrongNMTstate = 204,
/** 205 - Boot-up */
CO_GTWA_respErrorBootUp = 205,
/** 300 - Error passive */
CO_GTWA_respErrorErrorPassive = 300,
/** 301 - Bus off */
CO_GTWA_respErrorBusOff = 301,
/** 303 - CAN buffer overflow */
CO_GTWA_respErrorCANbufferOverflow = 303,
/** 304 - CAN init */
CO_GTWA_respErrorCANinit = 304,
/** 305 - CAN active (at init or start-up) */
CO_GTWA_respErrorCANactive = 305,
/** 400 - PDO already used */
CO_GTWA_respErrorPDOalreadyUsed = 400,
/** 401 - PDO length exceeded */
CO_GTWA_respErrorPDOlengthExceeded = 401,
/** 501 - LSS implementation- / manufacturer-specific error */
CO_GTWA_respErrorLSSmanufacturer = 501,
/** 502 - LSS node-ID not supported */
CO_GTWA_respErrorLSSnodeIdNotSupported = 502,
/** 503 - LSS bit-rate not supported */
CO_GTWA_respErrorLSSbitRateNotSupported = 503,
/** 504 - LSS parameter storing failed */
CO_GTWA_respErrorLSSparameterStoringFailed = 504,
/** 505 - LSS command failed because of media error */
CO_GTWA_respErrorLSSmediaError = 505,
/** 600 - Running out of memory */
CO_GTWA_respErrorRunningOutOfMemory = 600
} CO_GTWA_respErrorCode_t;
/**
* Internal states of the Gateway-ascii state machine.
*/
typedef enum {
/** Gateway is idle, no command is processing. This state is starting point
* for new commands, which are parsed here. */
CO_GTWA_ST_IDLE = 0x00U,
/** SDO 'read' (upload) */
CO_GTWA_ST_READ = 0x10U,
/** SDO 'write' (download) */
CO_GTWA_ST_WRITE = 0x11U,
/** SDO 'write' (download) - aborted, purging remaining data */
CO_GTWA_ST_WRITE_ABORTED = 0x12U,
/** LSS 'lss_switch_glob' */
CO_GTWA_ST_LSS_SWITCH_GLOB = 0x20U,
/** LSS 'lss_switch_sel' */
CO_GTWA_ST_LSS_SWITCH_SEL = 0x21U,
/** LSS 'lss_set_node' */
CO_GTWA_ST_LSS_SET_NODE = 0x22U,
/** LSS 'lss_conf_bitrate' */
CO_GTWA_ST_LSS_CONF_BITRATE = 0x23U,
/** LSS 'lss_store' */
CO_GTWA_ST_LSS_STORE = 0x24U,
/** LSS 'lss_inquire_addr' or 'lss_get_node' */
CO_GTWA_ST_LSS_INQUIRE = 0x25U,
/** LSS 'lss_inquire_addr', all parameters */
CO_GTWA_ST_LSS_INQUIRE_ADDR_ALL = 0x26U,
/** LSS '_lss_fastscan' */
CO_GTWA_ST__LSS_FASTSCAN = 0x30U,
/** LSS 'lss_allnodes' */
CO_GTWA_ST_LSS_ALLNODES = 0x31U,
/** print message 'log' */
CO_GTWA_ST_LOG = 0x80U,
/** print 'help' text */
CO_GTWA_ST_HELP = 0x81U,
/** print 'status' of the node */
CO_GTWA_ST_LED = 0x82U
} CO_GTWA_state_t;
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
/*
* CANopen Gateway-ascii data types structure
*/
typedef struct {
/** Data type syntax, as defined in CiA309-3 */
char* syntax;
/** Data type length in bytes, 0 if size is not known */
size_t length;
/** Function, which reads data of specific data type from fifo buffer and
* writes them as corresponding ascii string. It is a pointer to
* #CO_fifo_readU82a function or similar and is used with SDO upload. For
* description of parameters see #CO_fifo_readU82a */
size_t (*dataTypePrint)(CO_fifo_t *fifo,
char *buf,
size_t count,
bool_t end);
/** Function, which reads ascii-data of specific data type from fifo buffer
* and copies them to another fifo buffer as binary data. It is a pointer to
* #CO_fifo_cpyTok2U8 function or similar and is used with SDO download. For
* description of parameters see #CO_fifo_cpyTok2U8 */
size_t (*dataTypeScan)(CO_fifo_t *dest,
CO_fifo_t *src,
CO_fifo_st *status);
} CO_GTWA_dataType_t;
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO */
/**
* CANopen Gateway-ascii object
*/
typedef struct {
/** Pointer to external function for reading response from Gateway-ascii
* object. Pointer is initialized in CO_GTWA_initRead().
*
* @param object Void pointer to custom object
* @param buf Buffer from which data can be read
* @param count Count of bytes available inside buffer
* @param [out] connectionOK different than 0 indicates connection is OK.
*
* @return Count of bytes actually transferred.
*/
size_t (*readCallback)(void *object,
const char *buf,
size_t count,
uint8_t *connectionOK);
/** Pointer to object, which will be used inside readCallback, from
* CO_GTWA_init() */
void *readCallbackObject;
/** Sequence number of the command */
uint32_t sequence;
/** Default CANopen Net number is undefined (-1) at startup */
int32_t net_default;
/** Default CANopen Node ID number is undefined (-1) at startup */
int16_t node_default;
/** Current CANopen Net number */
uint16_t net;
/** Current CANopen Node ID */
uint8_t node;
/** CO_fifo_t object for command (not pointer) */
CO_fifo_t commFifo;
/** Command buffer of usable size @ref CO_CONFIG_GTWA_COMM_BUF_SIZE */
uint8_t commBuf[CO_CONFIG_GTWA_COMM_BUF_SIZE + 1];
/** Response buffer of usable size @ref CO_GTWA_RESP_BUF_SIZE */
char respBuf[CO_GTWA_RESP_BUF_SIZE];
/** Actual size of data in respBuf */
size_t respBufCount;
/** If only part of data has been successfully written into external
* application (with readCallback()), then Gateway-ascii object will stay
* in current state. This situation is indicated with respHold variable and
* respBufOffset indicates offset to untransferred data inside respBuf. */
size_t respBufOffset;
/** See respBufOffset above */
bool_t respHold;
/** Sum of time difference from CO_GTWA_process() in case of respHold */
uint32_t timeDifference_us_cumulative;
/** Current state of the gateway object */
CO_GTWA_state_t state;
/** Timeout timer for the current state */
uint32_t stateTimeoutTmr;
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
/** SDO client object from CO_GTWA_init() */
CO_SDOclient_t *SDO_C;
/** Timeout time for SDO transfer in milliseconds, if no response */
uint16_t SDOtimeoutTime;
/** SDO block transfer enabled? */
bool_t SDOblockTransferEnable;
/** Indicate status of data copy from / to SDO buffer. If reading, true
* indicates, that response has started. If writing, true indicates, that
* SDO buffer contains only part of data and more data will follow. */
bool_t SDOdataCopyStatus;
/** Data type of variable in current SDO communication */
const CO_GTWA_dataType_t *SDOdataType;
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) || defined CO_DOXYGEN
/** NMT object from CO_GTWA_init() */
CO_NMT_t *NMT;
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) || defined CO_DOXYGEN
/** LSSmaster object from CO_GTWA_init() */
CO_LSSmaster_t *LSSmaster;
/** 128 bit number, uniquely identifying each node */
CO_LSS_address_t lssAddress;
/** LSS Node-ID parameter */
uint8_t lssNID;
/** LSS bitrate parameter */
uint16_t lssBitrate;
/** LSS inquire parameter */
CO_LSS_cs_t lssInquireCs;
/** LSS fastscan parameter */
CO_LSSmaster_fastscan_t lssFastscan;
/** LSS allnodes sub state parameter */
uint8_t lssSubState;
/** LSS allnodes node count parameter */
uint8_t lssNodeCount;
/** LSS allnodes store parameter */
bool_t lssStore;
/** LSS allnodes timeout parameter */
uint16_t lssTimeout_ms;
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) || defined CO_DOXYGEN
/** Message log buffer of usable size @ref CO_CONFIG_GTWA_LOG_BUF_SIZE */
uint8_t logBuf[CO_CONFIG_GTWA_LOG_BUF_SIZE + 1];
/** CO_fifo_t object for message log (not pointer) */
CO_fifo_t logFifo;
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_HELP) || defined CO_DOXYGEN
/** Offset, when printing help text */
const char *helpString;
size_t helpStringOffset;
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) || defined CO_DOXYGEN
/** CO_LEDs_t object for CANopen status LEDs imitation from CO_GTWA_init()*/
CO_LEDs_t *LEDs;
uint8_t ledStringPreviousIndex;
#endif
} CO_GTWA_t;
/**
* Initialize Gateway-ascii object
*
* @param gtwa This object will be initialized
* @param SDO_C SDO client object
* @param SDOclientTimeoutTime_ms Default timeout in milliseconds, 500 typically
* @param SDOclientBlockTransfer If true, block transfer will be set by default
* @param NMT NMT object
* @param LSSmaster LSS master object
* @param LEDs LEDs object
* @param dummy dummy argument, set to 0
*
* @return #CO_ReturnError_t: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT
*/
CO_ReturnError_t CO_GTWA_init(CO_GTWA_t* gtwa,
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_SDO) || defined CO_DOXYGEN
CO_SDOclient_t* SDO_C,
uint16_t SDOclientTimeoutTime_ms,
bool_t SDOclientBlockTransfer,
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_NMT) || defined CO_DOXYGEN
CO_NMT_t *NMT,
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LSS) || defined CO_DOXYGEN
CO_LSSmaster_t *LSSmaster,
#endif
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_PRINT_LEDS) || defined CO_DOXYGEN
CO_LEDs_t *LEDs,
#endif
uint8_t dummy);
/**
* Initialize read callback in Gateway-ascii object
*
* Callback will be used for transfer data to output stream of the application.
* It will be called from CO_GTWA_process() zero or multiple times, depending on
* the data available. If readCallback is uninitialized or NULL, then output
* data will be purged.
*
* @param gtwa This object will be initialized
* @param readCallback Pointer to external function for reading response from
* Gateway-ascii object. See #CO_GTWA_t for parameters.
* @param readCallbackObject Pointer to object, which will be used inside
* readCallback
*/
void CO_GTWA_initRead(CO_GTWA_t* gtwa,
size_t (*readCallback)(void *object,
const char *buf,
size_t count,
uint8_t *connectionOK),
void *readCallbackObject);
/**
* Get free write buffer space
*
* @param gtwa This object
*
* @return number of available bytes
*/
static inline size_t CO_GTWA_write_getSpace(CO_GTWA_t* gtwa) {
return CO_fifo_getSpace(>wa->commFifo);
}
/**
* Write command into CO_GTWA_t object.
*
* This function copies ascii command from buf into internal fifo buffer.
* Command must be closed with '\n' character. Function returns number of bytes
* successfully copied. If there is not enough space in destination, not all
* bytes will be copied and data can be refilled later (in case of large SDO
* download).
*
* @param gtwa This object
* @param buf Buffer which will be copied
* @param count Number of bytes in buf
*
* @return number of bytes actually written.
*/
static inline size_t CO_GTWA_write(CO_GTWA_t* gtwa,
const char *buf,
size_t count)
{
return CO_fifo_write(>wa->commFifo, (const uint8_t *)buf, count, NULL);
}
#if ((CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG) || defined CO_DOXYGEN
/**
* Print message log string into fifo buffer
*
* This function enables recording of system log messages including CANopen
* events. Function can be called by application for recording any message.
* Message is copied to internal fifo buffer. In case fifo is full, old messages
* will be owerwritten. Message log fifo can be read with non-standard command
* "log". After log is read, it is emptied.
*
* @param gtwa This object
* @param message Null terminated string
*/
void CO_GTWA_log_print(CO_GTWA_t* gtwa, const char *message);
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII_LOG */
/**
* Process Gateway-ascii object
*
* This is non-blocking function and must be called cyclically
*
* @param gtwa This object will be initialized.
* @param enable If true, gateway operates normally. If false, gateway is
* completely disabled and no command interaction is possible. Can be connected
* to hardware switch, for example.
* @param timeDifference_us Time difference from previous function call in
* [microseconds].
* @param [out] timerNext_us info to OS - see CO_process().
*
* @return CO_ReturnError_t: CO_ERROR_NO on success or CO_ERROR_ILLEGAL_ARGUMENT
*/
void CO_GTWA_process(CO_GTWA_t *gtwa,
bool_t enable,
uint32_t timeDifference_us,
uint32_t *timerNext_us);
/** @} */ /* CO_CANopen_309_3 */
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /* (CO_CONFIG_GTW) & CO_CONFIG_GTW_ASCII */
#endif /* CO_GATEWAY_ASCII_H */
| {
"content_hash": "4e03f9d82761624853bda3c2aa25eb15",
"timestamp": "",
"source": "github",
"line_count": 515,
"max_line_length": 80,
"avg_line_length": 39.258252427184466,
"alnum_prop": 0.6273122959738846,
"repo_name": "CANopenNode/CANopenNode",
"id": "832107b2e8be99733fb606509dd3ef06bd4aa252",
"size": "21238",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "309/CO_gateway_ascii.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1075213"
},
{
"name": "Makefile",
"bytes": "1085"
}
],
"symlink_target": ""
} |
define("ghost/mixins/marker-manager",
["exports"],
function(__exports__) {
"use strict";
var MarkerManager = Ember.Mixin.create({
// jscs:disable
imageMarkdownRegex: /^(?:\{<(.*?)>\})?!(?:\[([^\n\]]*)\])(?:\(([^\n\]]*)\))?$/gim,
markerRegex: /\{<([\w\W]*?)>\}/,
// jscs:enable
uploadId: 1,
// create an object that will be shared amongst instances.
// makes it easier to use helper functions in different modules
markers: {},
// Add markers to the line if it needs one
initMarkers: function (line) {
var imageMarkdownRegex = this.get('imageMarkdownRegex'),
markerRegex = this.get('markerRegex'),
editor = this.get('codemirror'),
isImage = line.text.match(imageMarkdownRegex),
hasMarker = line.text.match(markerRegex);
if (isImage && !hasMarker) {
this.addMarker(line, editor.getLineNumber(line));
}
},
// Get the markdown with all the markers stripped
getMarkdown: function (value) {
var marker, id,
editor = this.get('codemirror'),
markers = this.get('markers'),
markerRegexForId = this.get('markerRegexForId'),
oldValue = value || editor.getValue(),
newValue = oldValue;
for (id in markers) {
if (markers.hasOwnProperty(id)) {
marker = markers[id];
newValue = newValue.replace(markerRegexForId(id), '');
}
}
return {
withMarkers: oldValue,
withoutMarkers: newValue
};
},
// check the given line to see if it has an image, and if it correctly has a marker
// in the special case of lines which were just pasted in, any markers are removed to prevent duplication
checkLine: function (ln, mode) {
var editor = this.get('codemirror'),
line = editor.getLineHandle(ln),
imageMarkdownRegex = this.get('imageMarkdownRegex'),
markerRegex = this.get('markerRegex'),
isImage = line.text.match(imageMarkdownRegex),
hasMarker;
// We care if it is an image
if (isImage) {
hasMarker = line.text.match(markerRegex);
if (hasMarker && (mode === 'paste' || mode === 'undo')) {
// this could be a duplicate, and won't be a real marker
this.stripMarkerFromLine(line);
}
if (!hasMarker) {
this.addMarker(line, ln);
}
}
// TODO: hasMarker but no image?
},
// Add a marker to the given line
// Params:
// line - CodeMirror LineHandle
// ln - line number
addMarker: function (line, ln) {
var marker,
markers = this.get('markers'),
editor = this.get('codemirror'),
uploadPrefix = 'image_upload',
uploadId = this.get('uploadId'),
magicId = '{<' + uploadId + '>}',
newText = magicId + line.text;
editor.replaceRange(
newText,
{line: ln, ch: 0},
{line: ln, ch: newText.length}
);
marker = editor.markText(
{line: ln, ch: 0},
{line: ln, ch: (magicId.length)},
{collapsed: true}
);
markers[uploadPrefix + '_' + uploadId] = marker;
this.set('uploadId', uploadId += 1);
},
// Check each marker to see if it is still present in the editor and if it still corresponds to image markdown
// If it is no longer a valid image, remove it
checkMarkers: function () {
var id, marker, line,
editor = this.get('codemirror'),
markers = this.get('markers'),
imageMarkdownRegex = this.get('imageMarkdownRegex');
for (id in markers) {
if (markers.hasOwnProperty(id)) {
marker = markers[id];
if (marker.find()) {
line = editor.getLineHandle(marker.find().from.line);
if (!line.text.match(imageMarkdownRegex)) {
this.removeMarker(id, marker, line);
}
} else {
this.removeMarker(id, marker);
}
}
}
},
// this is needed for when we transition out of the editor.
// since the markers object is persistent and shared between classes that
// mix in this mixin, we need to make sure markers don't carry over between edits.
clearMarkers: function () {
var markers = this.get('markers'),
id,
marker;
// can't just `this.set('markers', {})`,
// since it wouldn't apply to this mixin,
// but only to the class that mixed this mixin in
for (id in markers) {
if (markers.hasOwnProperty(id)) {
marker = markers[id];
delete markers[id];
marker.clear();
}
}
},
// Remove a marker
// Will be passed a LineHandle if we already know which line the marker is on
removeMarker: function (id, marker, line) {
var markers = this.get('markers');
delete markers[id];
marker.clear();
if (line) {
this.stripMarkerFromLine(line);
} else {
this.findAndStripMarker(id);
}
},
// Removes the marker on the given line if there is one
stripMarkerFromLine: function (line) {
var editor = this.get('codemirror'),
ln = editor.getLineNumber(line),
// jscs:disable
markerRegex = /\{<([\w\W]*?)>\}/,
// jscs:enable
markerText = line.text.match(markerRegex);
if (markerText) {
editor.replaceRange(
'',
{line: ln, ch: markerText.index},
{line: ln, ch: markerText.index + markerText[0].length}
);
}
},
// the regex
markerRegexForId: function (id) {
id = id.replace('image_upload_', '');
return new RegExp('\\{<' + id + '>\\}', 'gmi');
},
// Find a marker in the editor by id & remove it
// Goes line by line to find the marker by it's text if we've lost track of the TextMarker
findAndStripMarker: function (id) {
var self = this,
editor = this.get('codemirror');
editor.eachLine(function (line) {
var markerText = self.markerRegexForId(id).exec(line.text),
ln;
if (markerText) {
ln = editor.getLineNumber(line);
editor.replaceRange(
'',
{line: ln, ch: markerText.index},
{line: ln, ch: markerText.index + markerText[0].length}
);
}
});
},
// Find the line with the marker which matches
findLine: function (resultId) {
var editor = this.get('codemirror'),
markers = this.get('markers');
// try to find the right line to replace
if (markers.hasOwnProperty(resultId) && markers[resultId].find()) {
return editor.getLineHandle(markers[resultId].find().from.line);
}
return false;
}
});
__exports__["default"] = MarkerManager;
}); | {
"content_hash": "29366b286317a1cbacfffecd2df6e40e",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 118,
"avg_line_length": 36.16228070175438,
"alnum_prop": 0.46961795027289266,
"repo_name": "mttschltz/ghostblog",
"id": "eb7ce982d6750f353ebd82be5cb5984e2211d1bc",
"size": "8245",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": ".tmp/ember-transpiled/mixins/marker-manager.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "147491"
},
{
"name": "JavaScript",
"bytes": "10669392"
},
{
"name": "Shell",
"bytes": "788"
},
{
"name": "XSLT",
"bytes": "7800"
}
],
"symlink_target": ""
} |
import common
common.FRAMEWORK_ONLY = True
import lrrbot.main
from lrrbot.chatlog import run_task, rebuild_all, stop_task
import asyncio
loop = asyncio.new_event_loop()
task = asyncio.ensure_future(run_task(), loop=loop)
rebuild_all()
stop_task()
loop.run_until_complete(task)
loop.close()
| {
"content_hash": "461e60a568ef412fc1f436f5cbdcd0fd",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 59,
"avg_line_length": 24.25,
"alnum_prop": 0.7697594501718213,
"repo_name": "andreasots/lrrbot",
"id": "ed9b8432be7e9ca19fec1c189fb6aae6700517f0",
"size": "314",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "rebuild_chat_logs.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "15924"
},
{
"name": "HTML",
"bytes": "65230"
},
{
"name": "JavaScript",
"bytes": "39616"
},
{
"name": "Mako",
"bytes": "318"
},
{
"name": "Python",
"bytes": "381399"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "66f62cf83a647bda2a1ecb429668b802",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "bf6be2d0d80fe46723ca1982ea1bcf27f90bbfa1",
"size": "184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Rhodophyta/Florideophyceae/Gigartinales/Areschougiaceae/Solieria/Solieria chordalis/ Syn. Gigartina gaditana/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import renderer from '~/vue_shared/components/rich_content_editor/services/renderers/render_font_awesome_html_inline';
import { buildUneditableInlineTokens } from '~/vue_shared/components/rich_content_editor/services/renderers/build_uneditable_token';
import { normalTextNode } from './mock_data';
const fontAwesomeInlineHtmlNode = {
firstChild: null,
literal: '<i class="far fa-paper-plane" id="biz-tech-icons">',
type: 'html',
};
describe('Render Font Awesome Inline HTML renderer', () => {
describe('canRender', () => {
it('should return true when the argument `literal` has font awesome inline html syntax', () => {
expect(renderer.canRender(fontAwesomeInlineHtmlNode)).toBe(true);
});
it('should return false when the argument `literal` lacks font awesome inline html syntax', () => {
expect(renderer.canRender(normalTextNode)).toBe(false);
});
});
describe('render', () => {
it('should return uneditable inline tokens', () => {
const token = { type: 'text', tagName: null, content: fontAwesomeInlineHtmlNode.literal };
const context = { origin: () => token };
expect(renderer.render(fontAwesomeInlineHtmlNode, context)).toStrictEqual(
buildUneditableInlineTokens(token),
);
});
});
});
| {
"content_hash": "8901fd2038472718f13605cb8a883ec4",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 132,
"avg_line_length": 38.78787878787879,
"alnum_prop": 0.68515625,
"repo_name": "mmkassem/gitlabhq",
"id": "d6bb01259bb57902fcf61627e8bbce064a427b85",
"size": "1280",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/frontend/vue_shared/components/rich_content_editor/services/renderers/render_font_awesome_html_inline_spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "113683"
},
{
"name": "CoffeeScript",
"bytes": "139197"
},
{
"name": "Cucumber",
"bytes": "119759"
},
{
"name": "HTML",
"bytes": "447030"
},
{
"name": "JavaScript",
"bytes": "29805"
},
{
"name": "Ruby",
"bytes": "2417833"
},
{
"name": "Shell",
"bytes": "14336"
}
],
"symlink_target": ""
} |
package images
import (
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/pagination"
)
// ListOptsBuilder allows extensions to add additional parameters to the
// List request.
type ListOptsBuilder interface {
ToImageListQuery() (string, error)
}
// ListOpts allows the filtering and sorting of paginated collections through
// the API. Filtering is achieved by passing in struct field values that map to
// the server attributes you want to see returned. Marker and Limit are used
// for pagination.
//http://developer.openstack.org/api-ref-image-v2.html
type ListOpts struct {
// Integer value for the limit of values to return.
Limit int `q:"limit"`
// UUID of the server at which you want to set a marker.
Marker string `q:"marker"`
Name string `q:"name"`
Visibility ImageVisibility `q:"visibility"`
MemberStatus ImageMemberStatus `q:"member_status"`
Owner string `q:"owner"`
Status ImageStatus `q:"status"`
SizeMin int64 `q:"size_min"`
SizeMax int64 `q:"size_max"`
SortKey string `q:"sort_key"`
SortDir string `q:"sort_dir"`
Tag string `q:"tag"`
}
// ToImageListQuery formats a ListOpts into a query string.
func (opts ListOpts) ToImageListQuery() (string, error) {
q, err := gophercloud.BuildQueryString(opts)
return q.String(), err
}
// List implements image list request
func List(c *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {
url := listURL(c)
if opts != nil {
query, err := opts.ToImageListQuery()
if err != nil {
return pagination.Pager{Err: err}
}
url += query
}
return pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {
return ImagePage{pagination.LinkedPageBase{PageResult: r}}
})
}
// CreateOptsBuilder describes struct types that can be accepted by the Create call.
// The CreateOpts struct in this package does.
type CreateOptsBuilder interface {
// Returns value that can be passed to json.Marshal
ToImageCreateMap() (map[string]interface{}, error)
}
// CreateOpts implements CreateOptsBuilder
type CreateOpts struct {
// Name is the name of the new image.
Name string `json:"name" required:"true"`
// Id is the the image ID.
ID string `json:"id,omitempty"`
// Visibility defines who can see/use the image.
Visibility *ImageVisibility `json:"visibility,omitempty"`
// Tags is a set of image tags.
Tags []string `json:"tags,omitempty"`
// ContainerFormat is the format of the
// container. Valid values are ami, ari, aki, bare, and ovf.
ContainerFormat string `json:"container_format,omitempty"`
// DiskFormat is the format of the disk. If set,
// valid values are ami, ari, aki, vhd, vmdk, raw, qcow2, vdi,
// and iso.
DiskFormat string `json:"disk_format,omitempty"`
// MinDisk is the amount of disk space in
// GB that is required to boot the image.
MinDisk int `json:"min_disk,omitempty"`
// MinRAM is the amount of RAM in MB that
// is required to boot the image.
MinRAM int `json:"min_ram,omitempty"`
// protected is whether the image is not deletable.
Protected *bool `json:"protected,omitempty"`
// properties is a set of properties, if any, that
// are associated with the image.
Properties map[string]string `json:"-,omitempty"`
}
// ToImageCreateMap assembles a request body based on the contents of
// a CreateOpts.
func (opts CreateOpts) ToImageCreateMap() (map[string]interface{}, error) {
b, err := gophercloud.BuildRequestBody(opts, "")
if err != nil {
return nil, err
}
if opts.Properties != nil {
for k, v := range opts.Properties {
b[k] = v
}
}
return b, nil
}
// Create implements create image request
func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) {
b, err := opts.ToImageCreateMap()
if err != nil {
r.Err = err
return r
}
_, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{OkCodes: []int{201}})
return
}
// Delete implements image delete request
func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) {
_, r.Err = client.Delete(deleteURL(client, id), nil)
return
}
// Get implements image get request
func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {
_, r.Err = client.Get(getURL(client, id), &r.Body, nil)
return
}
// Update implements image updated request
func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) {
b, err := opts.ToImageUpdateMap()
if err != nil {
r.Err = err
return r
}
_, r.Err = client.Patch(updateURL(client, id), b, &r.Body, &gophercloud.RequestOpts{
OkCodes: []int{200},
MoreHeaders: map[string]string{"Content-Type": "application/openstack-images-v2.1-json-patch"},
})
return
}
// UpdateOptsBuilder implements UpdateOptsBuilder
type UpdateOptsBuilder interface {
// returns value implementing json.Marshaler which when marshaled matches the patch schema:
// http://specs.openstack.org/openstack/glance-specs/specs/api/v2/http-patch-image-api-v2.html
ToImageUpdateMap() ([]interface{}, error)
}
// UpdateOpts implements UpdateOpts
type UpdateOpts []Patch
// ToImageUpdateMap builder
func (opts UpdateOpts) ToImageUpdateMap() ([]interface{}, error) {
m := make([]interface{}, len(opts))
for i, patch := range opts {
patchJSON := patch.ToImagePatchMap()
m[i] = patchJSON
}
return m, nil
}
// Patch represents a single update to an existing image. Multiple updates to an image can be
// submitted at the same time.
type Patch interface {
ToImagePatchMap() map[string]interface{}
}
// UpdateVisibility updated visibility
type UpdateVisibility struct {
Visibility ImageVisibility
}
// ToImagePatchMap builder
func (u UpdateVisibility) ToImagePatchMap() map[string]interface{} {
return map[string]interface{}{
"op": "replace",
"path": "/visibility",
"value": u.Visibility,
}
}
// ReplaceImageName implements Patch
type ReplaceImageName struct {
NewName string
}
// ToImagePatchMap builder
func (r ReplaceImageName) ToImagePatchMap() map[string]interface{} {
return map[string]interface{}{
"op": "replace",
"path": "/name",
"value": r.NewName,
}
}
// ReplaceImageChecksum implements Patch
type ReplaceImageChecksum struct {
Checksum string
}
// ReplaceImageChecksum builder
func (rc ReplaceImageChecksum) ToImagePatchMap() map[string]interface{} {
return map[string]interface{}{
"op": "replace",
"path": "/checksum",
"value": rc.Checksum,
}
}
// ReplaceImageTags implements Patch
type ReplaceImageTags struct {
NewTags []string
}
// ToImagePatchMap builder
func (r ReplaceImageTags) ToImagePatchMap() map[string]interface{} {
return map[string]interface{}{
"op": "replace",
"path": "/tags",
"value": r.NewTags,
}
}
| {
"content_hash": "106778baccb5b3f401654f6e9ed597a0",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 101,
"avg_line_length": 28.777310924369747,
"alnum_prop": 0.709592641261498,
"repo_name": "stardog-union/stardog-graviton",
"id": "32f09ee95ac6837ef4fc436f3789b999eed07842",
"size": "6849",
"binary": false,
"copies": "15",
"ref": "refs/heads/develop",
"path": "vendor/github.com/mitchellh/packer/vendor/github.com/gophercloud/gophercloud/openstack/imageservice/v2/images/requests.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "BitBake",
"bytes": "50002"
},
{
"name": "Dockerfile",
"bytes": "1212"
},
{
"name": "Go",
"bytes": "195457"
},
{
"name": "HCL",
"bytes": "26587"
},
{
"name": "Makefile",
"bytes": "602"
},
{
"name": "Python",
"bytes": "43992"
},
{
"name": "Shell",
"bytes": "11173"
},
{
"name": "Smarty",
"bytes": "2192"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="com.twitter"
module="zipkin-cassandra"
revision="1.2.0-SNAPSHOT"
conf="pom"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom"
date="20140523011554"/>
<dependencies>
</dependencies>
</ivy-report>
| {
"content_hash": "60b023daf803cc1c11adac9509389471",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 131,
"avg_line_length": 33.30769230769231,
"alnum_prop": 0.7090069284064665,
"repo_name": "pkoryzna/zipkin",
"id": "e06caca2f033d9ae4469131890c46c1333420c4d",
"size": "433",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "zipkin-cassandra/target/resolution-cache/reports/com.twitter-zipkin-cassandra-pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "151299"
},
{
"name": "JavaScript",
"bytes": "1146946"
},
{
"name": "Ruby",
"bytes": "21133"
},
{
"name": "Scala",
"bytes": "1521413"
},
{
"name": "Shell",
"bytes": "2599"
},
{
"name": "XSLT",
"bytes": "473154"
}
],
"symlink_target": ""
} |
// Copyright (c) 2015, Baidu.com, Inc. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// 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.
#include "leveldb/db.h"
#include "db/db_impl.h"
#include "db/filename.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "leveldb/cache.h"
#include "leveldb/env.h"
#include "leveldb/filter_policy.h"
#include "leveldb/lg_coding.h"
#include "leveldb/table.h"
#include "util/hash.h"
#include "util/logging.h"
#include "util/mutexlock.h"
#include "util/string_ext.h"
#include "util/testharness.h"
#include "util/testutil.h"
namespace leveldb {
static std::string RandomString(Random* rnd, int len) {
std::string r;
test::RandomString(rnd, len, &r);
return r;
}
namespace {
class AtomicCounter {
private:
port::Mutex mu_;
int count_;
public:
AtomicCounter() : count_(0) { }
void Increment() {
IncrementBy(1);
}
void IncrementBy(int count) {
MutexLock l(&mu_);
count_ += count;
}
int Read() {
MutexLock l(&mu_);
return count_;
}
void Reset() {
MutexLock l(&mu_);
count_ = 0;
}
};
void DelayMilliseconds(int millis) {
Env::Default()->SleepForMicroseconds(millis * 1000);
}
}
// Special Env used to delay background operations
class SpecialEnv : public EnvWrapper {
public:
// sstable Sync() calls are blocked while this pointer is non-NULL.
port::AtomicPointer delay_sstable_sync_;
// Simulate no-space errors while this pointer is non-NULL.
port::AtomicPointer no_space_;
// Simulate non-writable file system while this pointer is non-NULL
port::AtomicPointer non_writable_;
// Force sync of manifest files to fail while this pointer is non-NULL
port::AtomicPointer manifest_sync_error_;
// Force write to manifest files to fail while this pointer is non-NULL
port::AtomicPointer manifest_write_error_;
bool count_random_reads_;
AtomicCounter random_read_counter_;
AtomicCounter sleep_counter_;
AtomicCounter sleep_time_counter_;
explicit SpecialEnv(Env* base) : EnvWrapper(base) {
delay_sstable_sync_.Release_Store(NULL);
no_space_.Release_Store(NULL);
non_writable_.Release_Store(NULL);
count_random_reads_ = false;
manifest_sync_error_.Release_Store(NULL);
manifest_write_error_.Release_Store(NULL);
}
Status NewWritableFile(const std::string& f, WritableFile** r) {
class SSTableFile : public WritableFile {
private:
SpecialEnv* env_;
WritableFile* base_;
public:
SSTableFile(SpecialEnv* env, WritableFile* base)
: env_(env),
base_(base) {
}
~SSTableFile() { delete base_; }
Status Append(const Slice& data) {
if (env_->no_space_.Acquire_Load() != NULL) {
// Drop writes on the floor
return Status::OK();
} else {
return base_->Append(data);
}
}
Status Close() { return base_->Close(); }
Status Flush() { return base_->Flush(); }
Status Sync() {
while (env_->delay_sstable_sync_.Acquire_Load() != NULL) {
DelayMilliseconds(100);
}
return base_->Sync();
}
};
class ManifestFile : public WritableFile {
private:
SpecialEnv* env_;
WritableFile* base_;
public:
ManifestFile(SpecialEnv* env, WritableFile* b) : env_(env), base_(b) { }
~ManifestFile() { delete base_; }
Status Append(const Slice& data) {
if (env_->manifest_write_error_.Acquire_Load() != NULL) {
return Status::IOError("simulated writer error");
} else {
return base_->Append(data);
}
}
Status Close() { return base_->Close(); }
Status Flush() { return base_->Flush(); }
Status Sync() {
if (env_->manifest_sync_error_.Acquire_Load() != NULL) {
return Status::IOError("simulated sync error");
} else {
return base_->Sync();
}
}
};
if (non_writable_.Acquire_Load() != NULL) {
return Status::IOError("simulated write error");
}
Status s = target()->NewWritableFile(f, r);
if (s.ok()) {
if (strstr(f.c_str(), ".sst") != NULL) {
*r = new SSTableFile(this, *r);
} else if (strstr(f.c_str(), "MANIFEST") != NULL) {
*r = new ManifestFile(this, *r);
}
}
return s;
}
Status NewRandomAccessFile(const std::string& f, RandomAccessFile** r) {
class CountingFile : public RandomAccessFile {
private:
RandomAccessFile* target_;
AtomicCounter* counter_;
public:
CountingFile(RandomAccessFile* target, AtomicCounter* counter)
: target_(target), counter_(counter) {
}
virtual ~CountingFile() { delete target_; }
virtual Status Read(uint64_t offset, size_t n, Slice* result,
char* scratch) const {
counter_->Increment();
return target_->Read(offset, n, result, scratch);
}
};
Status s = target()->NewRandomAccessFile(f, r);
if (s.ok() && count_random_reads_) {
*r = new CountingFile(*r, &random_read_counter_);
}
return s;
}
virtual void SleepForMicroseconds(int micros) {
sleep_counter_.Increment();
sleep_time_counter_.IncrementBy(micros);
}
};
class DBTest {
private:
const FilterPolicy* filter_policy_;
// Sequence of option configurations to try
enum OptionConfig {
kDefault,
kFilter,
kUncompressed,
kEnd
};
int option_config_;
public:
std::string dbname_;
SpecialEnv* env_;
DB* db_;
Options last_options_;
DBTest() : option_config_(kDefault),
env_(new SpecialEnv(Env::Default())) {
filter_policy_ = NewBloomFilterPolicy(10);
dbname_ = test::TmpDir() + "/db_test/tablet00000012";
DestroyDB(dbname_, Options());
db_ = NULL;
Reopen();
}
~DBTest() {
delete db_;
DestroyDB(dbname_, Options());
delete env_;
delete filter_policy_;
}
// Switch to a fresh database with the next option configuration to
// test. Return false if there are no more configurations to test.
bool ChangeOptions() {
option_config_++;
if (option_config_ >= kEnd) {
return false;
} else {
DestroyAndReopen();
return true;
}
}
// Return the current option configuration.
Options CurrentOptions() {
Options options;
options.dump_mem_on_shutdown = false;
Logger* logger;
Env::Default()->NewLogger("/tmp/db_test.log", &logger);
Env::Default()->SetLogger(logger);
options.info_log = logger;
switch (option_config_) {
case kFilter:
options.filter_policy = filter_policy_;
break;
case kUncompressed:
options.compression = kNoCompression;
break;
default:
break;
}
return options;
}
DBTable* dbfull() {
return reinterpret_cast<DBTable*>(db_);
}
void Reopen(Options* options = NULL) {
ASSERT_OK(TryReopen(options));
}
void Close() {
delete db_;
db_ = NULL;
}
void DestroyAndReopen(Options* options = NULL) {
delete db_;
db_ = NULL;
DestroyDB(dbname_, Options());
ASSERT_OK(TryReopen(options));
}
Status TryReopen(Options* options) {
delete db_;
db_ = NULL;
Options opts;
if (options != NULL) {
opts = *options;
} else {
opts = CurrentOptions();
}
last_options_ = opts;
return DB::Open(opts, dbname_, &db_);
}
Status Put(const std::string& k, const std::string& v) {
return db_->Put(WriteOptions(), k, v);
}
Status Delete(const std::string& k) {
return db_->Delete(WriteOptions(), k);
}
std::string Get(const std::string& k, const uint64_t snapshot = leveldb::kMaxSequenceNumber) {
ReadOptions options;
options.snapshot = snapshot;
std::string result;
Status s = db_->Get(options, k, &result);
if (s.IsNotFound()) {
result = "NOT_FOUND";
} else if (!s.ok()) {
result = s.ToString();
}
return result;
}
// Return a string that contains all key,value pairs in order,
// formatted like "(k1->v1)(k2->v2)".
std::string Contents() {
std::vector<std::string> forward;
std::string result;
Iterator* iter = db_->NewIterator(ReadOptions());
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
std::string s = IterStatus(iter);
result.push_back('(');
result.append(s);
result.push_back(')');
forward.push_back(s);
}
// Check reverse iteration results are the reverse of forward results
size_t matched = 0;
for (iter->SeekToLast(); iter->Valid(); iter->Prev()) {
ASSERT_LT(matched, forward.size());
ASSERT_EQ(IterStatus(iter), forward[forward.size() - matched - 1]);
matched++;
}
ASSERT_EQ(matched, forward.size());
delete iter;
return result;
}
std::string AllEntriesFor(const Slice& user_key) {
Iterator* iter = dbfull()->TEST_NewInternalIterator();
InternalKey target(user_key, kMaxSequenceNumber, kTypeValue);
iter->Seek(target.Encode());
std::string result;
if (!iter->status().ok()) {
result = iter->status().ToString();
} else {
result = "[ ";
bool first = true;
while (iter->Valid()) {
ParsedInternalKey ikey;
if (!ParseInternalKey(iter->key(), &ikey)) {
result += "CORRUPTED";
} else {
if (last_options_.comparator->Compare(ikey.user_key, user_key) != 0) {
break;
}
if (!first) {
result += ", ";
}
first = false;
switch (ikey.type) {
case kTypeValue:
result += iter->value().ToString();
break;
case kTypeDeletion:
result += "DEL";
break;
}
}
iter->Next();
}
if (!first) {
result += " ";
}
result += "]";
}
delete iter;
return result;
}
int NumTableFilesAtLevel(int level) {
std::string property;
ASSERT_TRUE(
db_->GetProperty("leveldb.num-files-at-level" + NumberToString(level),
&property));
return atoi(property.c_str());
}
int TotalTableFiles() {
int result = 0;
for (int level = 0; level < config::kNumLevels; level++) {
result += NumTableFilesAtLevel(level);
}
return result;
}
// Return spread of files per level
std::string FilesPerLevel() {
std::string result;
int last_non_zero_offset = 0;
for (int level = 0; level < config::kNumLevels; level++) {
int f = NumTableFilesAtLevel(level);
char buf[100];
snprintf(buf, sizeof(buf), "%s%d", (level ? "," : ""), f);
result += buf;
if (f > 0) {
last_non_zero_offset = result.size();
}
}
result.resize(last_non_zero_offset);
return result;
}
int CountFiles() {
std::vector<std::string> files;
env_->GetChildren(dbname_, &files);
return static_cast<int>(files.size());
}
uint64_t Size(const Slice& start, const Slice& limit) {
Range r(start, limit);
uint64_t size;
db_->GetApproximateSizes(&r, 1, &size);
return size;
}
void Compact(const Slice& start, const Slice& limit) {
db_->CompactRange(&start, &limit);
}
// Do n memtable compactions, each of which produces an sstable
// covering the range [small,large].
void MakeTables(int n, const std::string& small, const std::string& large) {
for (int i = 0; i < n; i++) {
Put(small, "begin");
Put(large, "end");
dbfull()->TEST_CompactMemTable();
}
}
// Prevent pushing of new sstables into deeper levels by adding
// tables that cover a specified range to all levels.
void FillLevels(const std::string& smallest, const std::string& largest) {
MakeTables(config::kNumLevels, smallest, largest);
}
void DumpFileCounts(const char* label) {
fprintf(stderr, "---\n%s:\n", label);
fprintf(stderr, "maxoverlap: %lld\n",
static_cast<long long>(
dbfull()->TEST_MaxNextLevelOverlappingBytes()));
for (int level = 0; level < config::kNumLevels; level++) {
int num = NumTableFilesAtLevel(level);
if (num > 0) {
fprintf(stderr, " level %3d : %d files\n", level, num);
}
}
}
std::string DumpSSTableList() {
std::string property;
db_->GetProperty("leveldb.sstables", &property);
return property;
}
std::string IterStatus(Iterator* iter) {
std::string result;
if (iter->Valid()) {
result = iter->key().ToString() + "->" + iter->value().ToString();
} else {
result = "(invalid)";
}
return result;
}
bool DeleteAnSSTFile(int lg_id = 0) {
std::string dbname = dbname_ + "/" + Uint64ToString(lg_id);
std::vector<std::string> filenames;
ASSERT_OK(env_->GetChildren(dbname, &filenames));
uint64_t number;
FileType type;
for (size_t i = 0; i < filenames.size(); i++) {
if (ParseFileName(filenames[i], &number, &type) && type == kTableFile) {
ASSERT_OK(env_->DeleteFile(TableFileName(dbname, number)));
return true;
}
}
return false;
}
};
TEST(DBTest, Empty) {
do {
ASSERT_TRUE(db_ != NULL);
ASSERT_EQ("NOT_FOUND", Get("foo"));
} while (ChangeOptions());
}
TEST(DBTest, ReadWrite) {
do {
ASSERT_OK(Put("foo", "v1"));
ASSERT_EQ("v1", Get("foo"));
ASSERT_OK(Put("bar", "v2"));
ASSERT_OK(Put("foo", "v3"));
ASSERT_EQ("v3", Get("foo"));
ASSERT_EQ("v2", Get("bar"));
} while (ChangeOptions());
}
TEST(DBTest, PutDeleteGet) {
do {
ASSERT_OK(db_->Put(WriteOptions(), "foo", "v1"));
ASSERT_EQ("v1", Get("foo"));
ASSERT_OK(db_->Put(WriteOptions(), "foo", "v2"));
ASSERT_EQ("v2", Get("foo"));
ASSERT_OK(db_->Delete(WriteOptions(), "foo"));
ASSERT_EQ("NOT_FOUND", Get("foo"));
} while (ChangeOptions());
}
TEST(DBTest, GetFromImmutableLayer) {
do {
Options options = CurrentOptions();
options.env = env_;
options.write_buffer_size = 100000; // Small write buffer
Reopen(&options);
ASSERT_OK(Put("foo", "v1"));
ASSERT_EQ("v1", Get("foo"));
env_->delay_sstable_sync_.Release_Store(env_); // Block sync calls
Put("k1", std::string(100000, 'x')); // Fill memtable
Put("k2", std::string(100000, 'y')); // Trigger compaction
ASSERT_EQ("v1", Get("foo"));
env_->delay_sstable_sync_.Release_Store(NULL); // Release sync calls
} while (ChangeOptions());
}
TEST(DBTest, GetFromVersions) {
do {
ASSERT_OK(Put("foo", "v1"));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("v1", Get("foo"));
} while (ChangeOptions());
}
TEST(DBTest, GetSnapshot) {
do {
// Try with both a short key and a long key
for (int i = 0; i < 2; i++) {
std::string key = (i == 0) ? std::string("foo") : std::string(200, 'x');
ASSERT_OK(Put(key, "v1"));
uint64_t s1 = db_->GetSnapshot();
ASSERT_OK(Put(key, "v2"));
ASSERT_EQ("v2", Get(key));
ASSERT_EQ("v1", Get(key, s1));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("v2", Get(key));
ASSERT_EQ("v1", Get(key, s1));
db_->ReleaseSnapshot(s1);
}
} while (ChangeOptions());
}
TEST(DBTest, GetLevel0Ordering) {
do {
// Check that we process level-0 files in correct order. The code
// below generates two level-0 files where the earlier one comes
// before the later one in the level-0 file list since the earlier
// one has a smaller "smallest" key.
ASSERT_OK(Put("bar", "b"));
ASSERT_OK(Put("foo", "v1"));
dbfull()->TEST_CompactMemTable();
ASSERT_OK(Put("foo", "v2"));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("v2", Get("foo"));
} while (ChangeOptions());
}
TEST(DBTest, GetOrderedByLevels) {
do {
ASSERT_OK(Put("foo", "v1"));
Compact("a", "z");
ASSERT_EQ("v1", Get("foo"));
ASSERT_OK(Put("foo", "v2"));
ASSERT_EQ("v2", Get("foo"));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("v2", Get("foo"));
} while (ChangeOptions());
}
TEST(DBTest, GetPicksCorrectFile) {
do {
// Arrange to have multiple files in a non-level-0 level.
ASSERT_OK(Put("a", "va"));
Compact("a", "b");
ASSERT_OK(Put("x", "vx"));
Compact("x", "y");
ASSERT_OK(Put("f", "vf"));
Compact("f", "g");
ASSERT_EQ("va", Get("a"));
ASSERT_EQ("vf", Get("f"));
ASSERT_EQ("vx", Get("x"));
} while (ChangeOptions());
}
TEST(DBTest, GetEncountersEmptyLevel) {
do {
// Arrange for the following to happen:
// * sstable A in level 0
// * nothing in level 1
// * sstable B in level 2
// Then do enough Get() calls to arrange for an automatic compaction
// of sstable A. A bug would cause the compaction to be marked as
// occuring at level 1 (instead of the correct level 0).
// Step 1: First place sstables in levels 0 and 2
int compaction_count = 0;
while (NumTableFilesAtLevel(0) == 0 ||
NumTableFilesAtLevel(2) == 0) {
ASSERT_LE(compaction_count, 100) << "could not fill levels 0 and 2";
compaction_count++;
Put("a", "begin");
Put("z", "end");
dbfull()->TEST_CompactMemTable();
}
// Step 2: clear level 1 if necessary.
dbfull()->TEST_CompactRange(1, NULL, NULL);
ASSERT_EQ(NumTableFilesAtLevel(0), 1);
ASSERT_EQ(NumTableFilesAtLevel(1), 0);
ASSERT_EQ(NumTableFilesAtLevel(2), 1);
// Step 3: read a bunch of times
for (int i = 0; i < 1000; i++) {
ASSERT_EQ("NOT_FOUND", Get("missing"));
}
// Step 4: Wait for compaction to finish
DelayMilliseconds(1000);
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
} while (ChangeOptions());
}
TEST(DBTest, IterEmpty) {
Iterator* iter = db_->NewIterator(ReadOptions());
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->Seek("foo");
ASSERT_EQ(IterStatus(iter), "(invalid)");
delete iter;
}
TEST(DBTest, IterSingle) {
ASSERT_OK(Put("a", "va"));
Iterator* iter = db_->NewIterator(ReadOptions());
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->Seek("");
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->Seek("a");
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->Seek("b");
ASSERT_EQ(IterStatus(iter), "(invalid)");
delete iter;
}
TEST(DBTest, IterMulti) {
ASSERT_OK(Put("a", "va"));
ASSERT_OK(Put("b", "vb"));
ASSERT_OK(Put("c", "vc"));
Iterator* iter = db_->NewIterator(ReadOptions());
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "b->vb");
iter->Next();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "b->vb");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->Seek("");
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Seek("a");
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Seek("ax");
ASSERT_EQ(IterStatus(iter), "b->vb");
iter->Seek("b");
ASSERT_EQ(IterStatus(iter), "b->vb");
iter->Seek("z");
ASSERT_EQ(IterStatus(iter), "(invalid)");
// Switch from reverse to forward
iter->SeekToLast();
iter->Prev();
iter->Prev();
iter->Next();
ASSERT_EQ(IterStatus(iter), "b->vb");
// Switch from forward to reverse
iter->SeekToFirst();
iter->Next();
iter->Next();
iter->Prev();
ASSERT_EQ(IterStatus(iter), "b->vb");
// Make sure iter stays at snapshot
ASSERT_OK(Put("a", "va2"));
ASSERT_OK(Put("a2", "va3"));
ASSERT_OK(Put("b", "vb2"));
ASSERT_OK(Put("c", "vc2"));
ASSERT_OK(Delete("b"));
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "b->vb");
iter->Next();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "b->vb");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "(invalid)");
delete iter;
}
TEST(DBTest, IterSmallAndLargeMix) {
ASSERT_OK(Put("a", "va"));
ASSERT_OK(Put("b", std::string(100000, 'b')));
ASSERT_OK(Put("c", "vc"));
ASSERT_OK(Put("d", std::string(100000, 'd')));
ASSERT_OK(Put("e", std::string(100000, 'e')));
Iterator* iter = db_->NewIterator(ReadOptions());
iter->SeekToFirst();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Next();
ASSERT_EQ(IterStatus(iter), "b->" + std::string(100000, 'b'));
iter->Next();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Next();
ASSERT_EQ(IterStatus(iter), "d->" + std::string(100000, 'd'));
iter->Next();
ASSERT_EQ(IterStatus(iter), "e->" + std::string(100000, 'e'));
iter->Next();
ASSERT_EQ(IterStatus(iter), "(invalid)");
iter->SeekToLast();
ASSERT_EQ(IterStatus(iter), "e->" + std::string(100000, 'e'));
iter->Prev();
ASSERT_EQ(IterStatus(iter), "d->" + std::string(100000, 'd'));
iter->Prev();
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "b->" + std::string(100000, 'b'));
iter->Prev();
ASSERT_EQ(IterStatus(iter), "a->va");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "(invalid)");
delete iter;
}
TEST(DBTest, IterMultiWithDelete) {
do {
ASSERT_OK(Put("a", "va"));
ASSERT_OK(Put("b", "vb"));
ASSERT_OK(Put("c", "vc"));
ASSERT_OK(Delete("b"));
ASSERT_EQ("NOT_FOUND", Get("b"));
Iterator* iter = db_->NewIterator(ReadOptions());
iter->Seek("c");
ASSERT_EQ(IterStatus(iter), "c->vc");
iter->Prev();
ASSERT_EQ(IterStatus(iter), "a->va");
delete iter;
} while (ChangeOptions());
}
TEST(DBTest, Recover) {
do {
ASSERT_OK(Put("foo", "v1"));
ASSERT_OK(Put("baz", "v5"));
Reopen();
ASSERT_EQ("v1", Get("foo"));
ASSERT_EQ("v1", Get("foo"));
ASSERT_EQ("v5", Get("baz"));
ASSERT_OK(Put("bar", "v2"));
ASSERT_OK(Put("foo", "v3"));
Reopen();
ASSERT_EQ("v3", Get("foo"));
ASSERT_OK(Put("foo", "v4"));
ASSERT_EQ("v4", Get("foo"));
ASSERT_EQ("v2", Get("bar"));
ASSERT_EQ("v5", Get("baz"));
} while (ChangeOptions());
}
TEST(DBTest, RecoveryWithEmptyLog) {
do {
ASSERT_OK(Put("foo", "v1"));
ASSERT_OK(Put("foo", "v2"));
Reopen();
Reopen();
ASSERT_OK(Put("foo", "v3"));
Reopen();
ASSERT_EQ("v3", Get("foo"));
} while (ChangeOptions());
}
// Check that writes done during a memtable compaction are recovered
// if the database is shutdown during the memtable compaction.
TEST(DBTest, RecoverDuringMemtableCompaction) {
do {
Options options = CurrentOptions();
options.env = env_;
options.write_buffer_size = 1000000;
Reopen(&options);
// Trigger a long memtable compaction and reopen the database during it
ASSERT_OK(Put("foo", "v1")); // Goes to 1st log file
ASSERT_OK(Put("big1", std::string(10000000, 'x'))); // Fills memtable
ASSERT_OK(Put("big2", std::string(1000, 'y'))); // Triggers compaction
ASSERT_OK(Put("bar", "v2")); // Goes to new log file
dbfull()->MinorCompact();
Reopen(&options);
ASSERT_EQ("v1", Get("foo"));
ASSERT_EQ("v2", Get("bar"));
ASSERT_EQ(std::string(10000000, 'x'), Get("big1"));
ASSERT_EQ(std::string(1000, 'y'), Get("big2"));
} while (ChangeOptions());
}
static std::string Key(int i) {
char buf[100];
snprintf(buf, sizeof(buf), "key%06d", i);
return std::string(buf);
}
TEST(DBTest, MinorCompactionsHappen) {
Options options = CurrentOptions();
options.write_buffer_size = 10000;
Reopen(&options);
const int N = 500;
int starting_num_tables = TotalTableFiles();
for (int i = 0; i < N; i++) {
ASSERT_OK(Put(Key(i), Key(i) + std::string(1000, 'v')));
}
int ending_num_tables = TotalTableFiles();
ASSERT_GT(ending_num_tables, starting_num_tables);
for (int i = 0; i < N; i++) {
ASSERT_EQ(Key(i) + std::string(1000, 'v'), Get(Key(i)));
}
Reopen();
for (int i = 0; i < N; i++) {
ASSERT_EQ(Key(i) + std::string(1000, 'v'), Get(Key(i)));
}
}
TEST(DBTest, RecoverWithLargeLog) {
{
Options options = CurrentOptions();
Reopen(&options);
ASSERT_OK(Put("big1", std::string(200000, '1')));
ASSERT_OK(Put("big2", std::string(200000, '2')));
ASSERT_OK(Put("small3", std::string(10, '3')));
ASSERT_OK(Put("small4", std::string(10, '4')));
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
}
// Make sure that if we re-open with a small write buffer size that
// we flush table files in the middle of a large log file.
Options options = CurrentOptions();
options.write_buffer_size = 100000;
Reopen(&options);
// tera-leveldb will call MaybeScheduleCompaction() when Init(Recover),
// and 3 sst files cause level0's score to be 1.5,(kL0_CompactionTrigger == 2)
// so, compaction will happen, at the end, maybe 1 or 2 or 3 sst at level-0
ASSERT_EQ(2, config::kL0_CompactionTrigger);
ASSERT_GT(NumTableFilesAtLevel(0), 0);
ASSERT_EQ(std::string(200000, '1'), Get("big1"));
ASSERT_EQ(std::string(200000, '2'), Get("big2"));
ASSERT_EQ(std::string(10, '3'), Get("small3"));
ASSERT_EQ(std::string(10, '4'), Get("small4"));
ASSERT_GT(NumTableFilesAtLevel(0), 0);
}
TEST(DBTest, CompactionsGenerateMultipleFiles) {
Options options = CurrentOptions();
options.write_buffer_size = 100000000; // Large write buffer
Reopen(&options);
Random rnd(301);
// Write 8MB (80 values, each 100K)
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
std::vector<std::string> values;
for (int i = 0; i < 80; i++) {
values.push_back(RandomString(&rnd, 100000));
ASSERT_OK(Put(Key(i), values[i]));
}
// Reopening moves updates to level-0
Reopen(&options);
dbfull()->TEST_CompactRange(0, NULL, NULL);
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
// ASSERT_GT(NumTableFilesAtLevel(1), 1);
for (int i = 0; i < 80; i++) {
ASSERT_EQ(Get(Key(i)), values[i]);
}
}
#if 0 // config::kL0_StopWritesTrigger is changed
TEST(DBTest, RepeatedWritesToSameKey) {
Options options = CurrentOptions();
options.env = env_;
options.write_buffer_size = 100000; // Small write buffer
Reopen(&options);
// We must have at most one file per level except for level-0,
// which may have up to kL0_StopWritesTrigger files.
const int kMaxFiles = config::kNumLevels + config::kL0_StopWritesTrigger;
Random rnd(301);
std::string value = RandomString(&rnd, 2 * options.write_buffer_size);
for (int i = 0; i < 5 * kMaxFiles; i++) {
Put("key", value);
ASSERT_LE(TotalTableFiles(), kMaxFiles);
fprintf(stderr, "after %d: %d files\n", int(i+1), TotalTableFiles());
}
}
#endif
TEST(DBTest, SparseMerge) {
Options options = CurrentOptions();
options.compression = kNoCompression;
Reopen(&options);
FillLevels("A", "Z");
// Suppose there is:
// small amount of data with prefix A
// large amount of data with prefix B
// small amount of data with prefix C
// and that recent updates have made small changes to all three prefixes.
// Check that we do not do a compaction that merges all of B in one shot.
const std::string value(1000, 'x');
Put("A", "va");
// Write approximately 100MB of "B" values
for (int i = 0; i < 100000; i++) {
char key[100];
snprintf(key, sizeof(key), "B%010d", i);
Put(key, value);
}
Put("C", "vc");
dbfull()->TEST_CompactMemTable();
dbfull()->TEST_CompactRange(0, NULL, NULL);
// Make sparse update
Put("A", "va2");
Put("B100", "bvalue2");
Put("C", "vc2");
dbfull()->TEST_CompactMemTable();
// Compactions should not cause us to create a situation where
// a file overlaps too much data at the next level.
ASSERT_LE(dbfull()->TEST_MaxNextLevelOverlappingBytes(), 20*1048576);
dbfull()->TEST_CompactRange(0, NULL, NULL);
ASSERT_LE(dbfull()->TEST_MaxNextLevelOverlappingBytes(), 20*1048576);
dbfull()->TEST_CompactRange(1, NULL, NULL);
ASSERT_LE(dbfull()->TEST_MaxNextLevelOverlappingBytes(), 20*1048576);
}
static bool Between(uint64_t val, uint64_t low, uint64_t high) {
bool result = (val >= low) && (val <= high);
if (!result) {
fprintf(stderr, "Value %llu is not in range [%llu, %llu]\n",
(unsigned long long)(val),
(unsigned long long)(low),
(unsigned long long)(high));
}
return result;
}
TEST(DBTest, ApproximateSizes) {
do {
Options options = CurrentOptions();
options.write_buffer_size = 100000000; // Large write buffer
options.compression = kNoCompression;
DestroyAndReopen();
ASSERT_TRUE(Between(Size("", "xyz"), 0, 0));
Reopen(&options);
ASSERT_TRUE(Between(Size("", "xyz"), 0, 0));
// Write 8MB (80 values, each 100K)
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
const int N = 80;
static const int S1 = 100000;
static const int S2 = 105000; // Allow some expansion from metadata
Random rnd(301);
for (int i = 0; i < N; i++) {
ASSERT_OK(Put(Key(i), RandomString(&rnd, S1)));
}
// 0 because GetApproximateSizes() does not account for memtable space
ASSERT_TRUE(Between(Size("", Key(50)), 0, 0));
// Check sizes across recovery by reopening a few times
for (int run = 0; run < 3; run++) {
Reopen(&options);
for (int compact_start = 0; compact_start < N; compact_start += 10) {
for (int i = 0; i < N; i += 10) {
ASSERT_TRUE(Between(Size("", Key(i)), S1*i, S2*i));
ASSERT_TRUE(Between(Size("", Key(i)+".suffix"), S1*(i+1), S2*(i+1)));
ASSERT_TRUE(Between(Size(Key(i), Key(i+10)), S1*10, S2*10))
<< "[" << run << ", " << compact_start << ", " << i << "]";
}
ASSERT_TRUE(Between(Size("", Key(50)), S1*50, S2*50));
ASSERT_TRUE(Between(Size("", Key(50)+".suffix"), S1*50, S2*50));
std::string cstart_str = Key(compact_start);
std::string cend_str = Key(compact_start + 9);
Slice cstart = cstart_str;
Slice cend = cend_str;
dbfull()->TEST_CompactRange(0, &cstart, &cend);
}
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
// ASSERT_GT(NumTableFilesAtLevel(1), 0);
}
} while (ChangeOptions());
}
TEST(DBTest, ApproximateSizes_MixOfSmallAndLarge) {
do {
Options options = CurrentOptions();
options.compression = kNoCompression;
Reopen();
Random rnd(301);
std::string big1 = RandomString(&rnd, 100000);
ASSERT_OK(Put(Key(0), RandomString(&rnd, 10000)));
ASSERT_OK(Put(Key(1), RandomString(&rnd, 10000)));
ASSERT_OK(Put(Key(2), big1));
ASSERT_OK(Put(Key(3), RandomString(&rnd, 10000)));
ASSERT_OK(Put(Key(4), big1));
ASSERT_OK(Put(Key(5), RandomString(&rnd, 10000)));
ASSERT_OK(Put(Key(6), RandomString(&rnd, 300000)));
ASSERT_OK(Put(Key(7), RandomString(&rnd, 10000)));
// Check sizes across recovery by reopening a few times
for (int run = 0; run < 3; run++) {
Reopen(&options);
ASSERT_TRUE(Between(Size("", Key(0)), 0, 0));
ASSERT_TRUE(Between(Size("", Key(1)), 10000, 11000));
ASSERT_TRUE(Between(Size("", Key(2)), 20000, 21000));
ASSERT_TRUE(Between(Size("", Key(3)), 120000, 121000));
ASSERT_TRUE(Between(Size("", Key(4)), 130000, 131000));
ASSERT_TRUE(Between(Size("", Key(5)), 230000, 231000));
ASSERT_TRUE(Between(Size("", Key(6)), 240000, 241000));
ASSERT_TRUE(Between(Size("", Key(7)), 540000, 541000));
ASSERT_TRUE(Between(Size("", Key(8)), 550000, 560000));
ASSERT_TRUE(Between(Size(Key(3), Key(5)), 110000, 111000));
dbfull()->TEST_CompactRange(0, NULL, NULL);
}
} while (ChangeOptions());
}
TEST(DBTest, IteratorPinsRef) {
Put("foo", "hello");
// Get iterator that will yield the current contents of the DB.
Iterator* iter = db_->NewIterator(ReadOptions());
// Write to force compactions
Put("foo", "newvalue1");
for (int i = 0; i < 100; i++) {
ASSERT_OK(Put(Key(i), Key(i) + std::string(100000, 'v'))); // 100K values
}
Put("foo", "newvalue2");
iter->SeekToFirst();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("foo", iter->key().ToString());
ASSERT_EQ("hello", iter->value().ToString());
iter->Next();
ASSERT_TRUE(!iter->Valid());
delete iter;
}
TEST(DBTest, Snapshot) {
do {
Put("foo", "v1");
uint64_t s1 = db_->GetSnapshot();
Put("foo", "v2");
uint64_t s2 = db_->GetSnapshot();
Put("foo", "v3");
uint64_t s3 = db_->GetSnapshot();
Put("foo", "v4");
ASSERT_EQ("v1", Get("foo", s1));
ASSERT_EQ("v2", Get("foo", s2));
ASSERT_EQ("v3", Get("foo", s3));
ASSERT_EQ("v4", Get("foo"));
db_->ReleaseSnapshot(s3);
ASSERT_EQ("v1", Get("foo", s1));
ASSERT_EQ("v2", Get("foo", s2));
ASSERT_EQ("v4", Get("foo"));
db_->ReleaseSnapshot(s1);
ASSERT_EQ("v2", Get("foo", s2));
ASSERT_EQ("v4", Get("foo"));
db_->ReleaseSnapshot(s2);
ASSERT_EQ("v4", Get("foo"));
} while (ChangeOptions());
}
TEST(DBTest, HiddenValuesAreRemoved) {
do {
Random rnd(301);
FillLevels("a", "z");
std::string big = RandomString(&rnd, 50000);
Put("foo", big);
Put("pastfoo", "v");
uint64_t snapshot = db_->GetSnapshot();
Put("foo", "tiny");
Put("pastfoo2", "v2"); // Advance sequence number one more
ASSERT_OK(dbfull()->TEST_CompactMemTable());
// tera-leveldb:kL0_CompactionTrigger == 2, compact will happen
// google-leveldb:kL0_CompactionTrigger == 4, there is no compaction
// ASSERT_GT(NumTableFilesAtLevel(0), 0);
ASSERT_EQ(big, Get("foo", snapshot));
ASSERT_TRUE(Between(Size("", "pastfoo"), 50000, 60000));
db_->ReleaseSnapshot(snapshot);
ASSERT_EQ(AllEntriesFor("foo"), "[ tiny, " + big + " ]");
Slice x("x");
dbfull()->TEST_CompactRange(0, NULL, &x);
// dbfull()->TEST_CompactRange(1, NULL, &x);
// ASSERT_EQ(AllEntriesFor("foo"), "[ tiny ]");
// ASSERT_EQ(NumTableFilesAtLevel(0), 0);
// ASSERT_GE(NumTableFilesAtLevel(2), 1);
dbfull()->TEST_CompactRange(1, NULL, &x);
ASSERT_EQ(AllEntriesFor("foo"), "[ tiny ]");
ASSERT_TRUE(Between(Size("", "pastfoo"), 0, 1000));
} while (ChangeOptions());
}
TEST(DBTest, DeletionMarkers1) {
Put("foo", "v1");
ASSERT_OK(dbfull()->TEST_CompactMemTable());
const int last = config::kMaxMemCompactLevel;
ASSERT_EQ(NumTableFilesAtLevel(last), 1); // foo => v1 is now in last level
// Place a table at level last-1 to prevent merging with preceding mutation
Put("a", "begin");
Put("z", "end");
dbfull()->TEST_CompactMemTable();
ASSERT_EQ(NumTableFilesAtLevel(last), 1);
ASSERT_EQ(NumTableFilesAtLevel(last-1), 1);
Delete("foo");
Put("foo", "v2");
ASSERT_EQ(AllEntriesFor("foo"), "[ v2, DEL, v1 ]");
ASSERT_OK(dbfull()->TEST_CompactMemTable()); // Moves to level last-2
ASSERT_EQ(AllEntriesFor("foo"), "[ v2, DEL, v1 ]");
Slice z("z");
dbfull()->TEST_CompactRange(last-2, NULL, &z);
// DEL eliminated, but v1 remains because we aren't compacting that level
// (DEL can be eliminated because v2 hides v1).
ASSERT_EQ(AllEntriesFor("foo"), "[ v2, v1 ]");
dbfull()->TEST_CompactRange(last-1, NULL, NULL);
// Merging last-1 w/ last, so we are the base level for "foo", so
// DEL is removed. (as is v1).
ASSERT_EQ(AllEntriesFor("foo"), "[ v2 ]");
}
TEST(DBTest, DeletionMarkers2) {
Put("foo", "v1");
ASSERT_OK(dbfull()->TEST_CompactMemTable());
const int last = config::kMaxMemCompactLevel;
ASSERT_EQ(NumTableFilesAtLevel(last), 1); // foo => v1 is now in last level
// Place a table at level last-1 to prevent merging with preceding mutation
Put("a", "begin");
Put("z", "end");
dbfull()->TEST_CompactMemTable();
ASSERT_EQ(NumTableFilesAtLevel(last), 1);
ASSERT_EQ(NumTableFilesAtLevel(last-1), 1);
Delete("foo");
ASSERT_EQ(AllEntriesFor("foo"), "[ DEL, v1 ]");
ASSERT_OK(dbfull()->TEST_CompactMemTable()); // Moves to level last-2
ASSERT_EQ(AllEntriesFor("foo"), "[ DEL, v1 ]");
dbfull()->TEST_CompactRange(last-2, NULL, NULL);
// DEL kept: "last" file overlaps
ASSERT_EQ(AllEntriesFor("foo"), "[ DEL, v1 ]");
dbfull()->TEST_CompactRange(last-1, NULL, NULL);
// Merging last-1 w/ last, so we are the base level for "foo", so
// DEL is removed. (as is v1).
ASSERT_EQ(AllEntriesFor("foo"), "[ ]");
}
#if 0
TEST(DBTest, OverlapInLevel0) {
do {
ASSERT_EQ(config::kMaxMemCompactLevel, 2) << "Fix test to match config";
// Fill levels 1 and 2 to disable the pushing of new memtables to levels > 0.
ASSERT_OK(Put("100", "v100"));
ASSERT_OK(Put("999", "v999"));
dbfull()->TEST_CompactMemTable();
ASSERT_OK(Delete("100"));
ASSERT_OK(Delete("999"));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("0,1,1", FilesPerLevel());
// Make files spanning the following ranges in level-0:
// files[0] 200 .. 900
// files[1] 300 .. 500
// Note that files are sorted by smallest key.
ASSERT_OK(Put("300", "v300"));
ASSERT_OK(Put("500", "v500"));
dbfull()->TEST_CompactMemTable();
ASSERT_OK(Put("200", "v200"));
ASSERT_OK(Put("600", "v600"));
ASSERT_OK(Put("900", "v900"));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("2,1,1", FilesPerLevel());
// Compact away the placeholder files we created initially
dbfull()->TEST_CompactRange(1, NULL, NULL);
dbfull()->TEST_CompactRange(2, NULL, NULL);
ASSERT_EQ("2", FilesPerLevel());
// Do a memtable compaction. Before bug-fix, the compaction would
// not detect the overlap with level-0 files and would incorrectly place
// the deletion in a deeper level.
ASSERT_OK(Delete("600"));
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("3", FilesPerLevel());
ASSERT_EQ("NOT_FOUND", Get("600"));
} while (ChangeOptions());
}
#endif
TEST(DBTest, L0_CompactionBug_Issue44_a) {
Reopen();
ASSERT_OK(Put("b", "v"));
Reopen();
ASSERT_OK(Delete("b"));
ASSERT_OK(Delete("a"));
Reopen();
ASSERT_OK(Delete("a"));
Reopen();
ASSERT_OK(Put("a", "v"));
Reopen();
Reopen();
ASSERT_EQ("(a->v)", Contents());
DelayMilliseconds(1000); // Wait for compaction to finish
ASSERT_EQ("(a->v)", Contents());
}
TEST(DBTest, L0_CompactionBug_Issue44_b) {
Reopen();
Put("","");
Reopen();
Delete("e");
Put("","");
Reopen();
Put("c", "cv");
Reopen();
Put("","");
Reopen();
Put("","");
DelayMilliseconds(1000); // Wait for compaction to finish
Reopen();
Put("d","dv");
Reopen();
Put("","");
Reopen();
Delete("d");
Delete("b");
Reopen();
ASSERT_EQ("(->)(c->cv)", Contents());
DelayMilliseconds(1000); // Wait for compaction to finish
ASSERT_EQ("(->)(c->cv)", Contents());
}
TEST(DBTest, ComparatorCheck) {
class NewComparator : public Comparator {
public:
virtual const char* Name() const { return "leveldb.NewComparator"; }
virtual int Compare(const Slice& a, const Slice& b) const {
return BytewiseComparator()->Compare(a, b);
}
virtual void FindShortestSeparator(std::string* s, const Slice& l) const {
BytewiseComparator()->FindShortestSeparator(s, l);
}
virtual void FindShortSuccessor(std::string* key) const {
BytewiseComparator()->FindShortSuccessor(key);
}
};
NewComparator cmp;
Options new_options = CurrentOptions();
new_options.comparator = &cmp;
Status s = TryReopen(&new_options);
ASSERT_TRUE(!s.ok());
ASSERT_TRUE(s.ToString().find("comparator") != std::string::npos)
<< s.ToString();
}
TEST(DBTest, CustomComparator) {
class NumberComparator : public Comparator {
public:
virtual const char* Name() const { return "test.NumberComparator"; }
virtual int Compare(const Slice& a, const Slice& b) const {
return ToNumber(a) - ToNumber(b);
}
virtual void FindShortestSeparator(std::string* s, const Slice& l) const {
ToNumber(*s); // Check format
ToNumber(l); // Check format
}
virtual void FindShortSuccessor(std::string* key) const {
ToNumber(*key); // Check format
}
private:
static int ToNumber(const Slice& x) {
// Check that there are no extra characters.
ASSERT_TRUE(x.size() >= 2 && x[0] == '[' && x[x.size()-1] == ']')
<< EscapeString(x);
int val;
char ignored;
ASSERT_TRUE(sscanf(x.ToString().c_str(), "[%i]%c", &val, &ignored) == 1)
<< EscapeString(x);
return val;
}
};
NumberComparator cmp;
Options new_options = CurrentOptions();
new_options.comparator = &cmp;
new_options.filter_policy = NULL; // Cannot use bloom filters
new_options.write_buffer_size = 1000; // Compact more often
DestroyAndReopen(&new_options);
ASSERT_OK(Put("[10]", "ten"));
ASSERT_OK(Put("[0x14]", "twenty"));
for (int i = 0; i < 2; i++) {
ASSERT_EQ("ten", Get("[10]"));
ASSERT_EQ("ten", Get("[0xa]"));
ASSERT_EQ("twenty", Get("[20]"));
ASSERT_EQ("twenty", Get("[0x14]"));
ASSERT_EQ("NOT_FOUND", Get("[15]"));
ASSERT_EQ("NOT_FOUND", Get("[0xf]"));
Compact("[0]", "[9999]");
}
for (int run = 0; run < 2; run++) {
for (int i = 0; i < 1000; i++) {
char buf[100];
snprintf(buf, sizeof(buf), "[%d]", i*10);
ASSERT_OK(Put(buf, buf));
}
Compact("[0]", "[1000000]");
}
}
TEST(DBTest, ManualCompaction) {
ASSERT_EQ(config::kMaxMemCompactLevel, 2)
<< "Need to update this test to match kMaxMemCompactLevel";
MakeTables(3, "p", "q");
ASSERT_EQ("1,1,1", FilesPerLevel());
// Compaction range falls before files
Compact("", "c");
ASSERT_EQ("1,1,1", FilesPerLevel());
// Compaction range falls after files
Compact("r", "z");
ASSERT_EQ("1,1,1", FilesPerLevel());
// Compaction range overlaps files
Compact("p1", "p9");
ASSERT_EQ("0,0,1", FilesPerLevel());
// Populate a different range
MakeTables(3, "c", "e");
ASSERT_EQ("1,1,2", FilesPerLevel());
// Compact just the new range
Compact("b", "f");
ASSERT_EQ("0,0,2", FilesPerLevel());
// Compact all
MakeTables(1, "a", "z");
ASSERT_EQ("0,1,2", FilesPerLevel());
db_->CompactRange(NULL, NULL);
ASSERT_EQ("0,0,1", FilesPerLevel());
}
TEST(DBTest, DBOpen_Options) {
std::string dbname = test::TmpDir() + "/db_options_test";
DestroyDB(dbname, Options());
DB* db = NULL;
Options opts;
Status s = DB::Open(opts, dbname, &db);
ASSERT_OK(s);
ASSERT_TRUE(db != NULL);
delete db;
db = NULL;
}
TEST(DBTest, Locking) {
DB* db2 = NULL;
Status s = DB::Open(CurrentOptions(), dbname_, &db2);
ASSERT_TRUE(!s.ok()) << "Locking did not prevent re-opening db";
}
// Check that number of files does not grow when we are out of space
TEST(DBTest, NoSpace) {
Options options = CurrentOptions();
options.env = env_;
Reopen(&options);
ASSERT_OK(Put("foo", "v1"));
ASSERT_EQ("v1", Get("foo"));
Compact("a", "z");
const int num_files = CountFiles();
env_->no_space_.Release_Store(env_); // Force out-of-space errors
env_->sleep_counter_.Reset();
for (int i = 0; i < 5; i++) {
for (int level = 0; level < config::kNumLevels-1; level++) {
dbfull()->TEST_CompactRange(level, NULL, NULL);
}
}
env_->no_space_.Release_Store(NULL);
ASSERT_LT(CountFiles(), num_files + 3);
// Check that compaction attempts slept after errors
ASSERT_GE(env_->sleep_counter_.Read(), 5);
}
TEST(DBTest, ExponentialBackoff) {
Options options = CurrentOptions();
options.env = env_;
Reopen(&options);
ASSERT_OK(Put("foo", "v1"));
ASSERT_EQ("v1", Get("foo"));
Compact("a", "z");
env_->non_writable_.Release_Store(env_); // Force errors for new files
env_->sleep_counter_.Reset();
env_->sleep_time_counter_.Reset();
for (int i = 0; i < 5; i++) {
dbfull()->TEST_CompactRange(2, NULL, NULL);
}
env_->non_writable_.Release_Store(NULL);
// Wait for compaction to finish
DelayMilliseconds(1000);
ASSERT_GE(env_->sleep_counter_.Read(), 5);
ASSERT_LT(env_->sleep_counter_.Read(), 10);
ASSERT_GE(env_->sleep_time_counter_.Read(), 10e6);
}
TEST(DBTest, NonWritableFileSystem) {
Options options = CurrentOptions();
options.write_buffer_size = 1000;
options.env = env_;
Reopen(&options);
ASSERT_OK(Put("foo", "v1"));
env_->non_writable_.Release_Store(env_); // Force errors for new files
std::string big(100000, 'x');
int errors = 0;
for (int i = 0; i < 20; i++) {
fprintf(stderr, "iter %d; errors %d\n", i, errors);
if (!Put("foo", big).ok()) {
errors++;
DelayMilliseconds(100);
}
}
ASSERT_GT(errors, 0);
env_->non_writable_.Release_Store(NULL);
}
TEST(DBTest, ManifestWriteError) {
// Test for the following problem:
// (a) Compaction produces file F
// (b) Log record containing F is written to MANIFEST file, but Sync() fails
// (c) GC deletes F
// (d) After reopening DB, reads fail since deleted F is named in log record
// We iterate twice. In the second iteration, everything is the
// same except the log record never makes it to the MANIFEST file.
for (int iter = 0; iter < 2; iter++) {
port::AtomicPointer* error_type = (iter == 0)
? &env_->manifest_sync_error_
: &env_->manifest_write_error_;
// Insert foo=>bar mapping
Options options = CurrentOptions();
options.env = env_;
options.error_if_exists = false;
DestroyAndReopen(&options);
ASSERT_OK(Put("foo", "bar"));
ASSERT_EQ("bar", Get("foo"));
// Memtable compaction (will succeed)
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("bar", Get("foo"));
const int last = config::kMaxMemCompactLevel;
ASSERT_EQ(NumTableFilesAtLevel(last), 1); // foo=>bar is now in last level
// Merging compaction (will fail)
error_type->Release_Store(env_);
dbfull()->TEST_CompactRange(last, NULL, NULL); // Should fail
ASSERT_EQ("bar", Get("foo"));
// Recovery: should not lose data
error_type->Release_Store(NULL);
Reopen(&options);
ASSERT_EQ("bar", Get("foo"));
}
}
TEST(DBTest, MissingSSTFile) {
ASSERT_OK(Put("foo", "bar"));
ASSERT_EQ("bar", Get("foo"));
// Dump the memtable to disk.
dbfull()->TEST_CompactMemTable();
ASSERT_EQ("bar", Get("foo"));
Close();
ASSERT_TRUE(DeleteAnSSTFile());
Options options = CurrentOptions();
options.paranoid_checks = true;
Status s = TryReopen(&options);
ASSERT_TRUE(!s.ok());
//ASSERT_TRUE(s.ToString().find("issing") != std::string::npos)
// << s.ToString();
}
TEST(DBTest, FilesDeletedAfterCompaction) {
ASSERT_OK(Put("foo", "v2"));
Compact("a", "z");
const int num_files = CountFiles();
for (int i = 0; i < 10; i++) {
ASSERT_OK(Put("foo", "v2"));
Compact("a", "z");
}
ASSERT_EQ(CountFiles(), num_files);
}
TEST(DBTest, BloomFilter) {
env_->count_random_reads_ = true;
Options options = CurrentOptions();
options.env = env_;
options.block_cache = NewLRUCache(0); // Prevent cache hits
options.filter_policy = NewBloomFilterPolicy(10);
Reopen(&options);
// Populate multiple layers
const int N = 10000;
for (int i = 0; i < N; i++) {
ASSERT_OK(Put(Key(i), Key(i)));
}
Compact("a", "z");
for (int i = 0; i < N; i += 100) {
ASSERT_OK(Put(Key(i), Key(i)));
}
dbfull()->TEST_CompactMemTable();
// Prevent auto compactions triggered by seeks
env_->delay_sstable_sync_.Release_Store(env_);
// Lookup present keys. Should rarely read from small sstable.
env_->random_read_counter_.Reset();
for (int i = 0; i < N; i++) {
ASSERT_EQ(Key(i), Get(Key(i)));
}
int reads = env_->random_read_counter_.Read();
fprintf(stderr, "%d present => %d reads\n", N, reads);
ASSERT_GE(reads, N);
ASSERT_LE(reads, N + 2*N/100);
// Lookup present keys. Should rarely read from either sstable.
env_->random_read_counter_.Reset();
for (int i = 0; i < N; i++) {
ASSERT_EQ("NOT_FOUND", Get(Key(i) + ".missing"));
}
reads = env_->random_read_counter_.Read();
fprintf(stderr, "%d missing => %d reads\n", N, reads);
ASSERT_LE(reads, 3*N/100);
env_->delay_sstable_sync_.Release_Store(NULL);
Close();
delete options.block_cache;
delete options.filter_policy;
}
// Multi-threaded test:
namespace {
static const int kNumThreads = 4;
static const int kTestSeconds = 10;
static const int kNumKeys = 1000;
struct MTState {
DBTest* test;
port::AtomicPointer stop;
port::AtomicPointer counter[kNumThreads];
port::AtomicPointer thread_done[kNumThreads];
};
struct MTThread {
MTState* state;
int id;
};
static void MTThreadBody(void* arg) {
MTThread* t = reinterpret_cast<MTThread*>(arg);
int id = t->id;
DB* db = t->state->test->db_;
uintptr_t counter = 0;
fprintf(stderr, "... starting thread %d\n", id);
Random rnd(1000 + id);
std::string value;
char valbuf[1500];
while (t->state->stop.Acquire_Load() == NULL) {
t->state->counter[id].Release_Store(reinterpret_cast<void*>(counter));
int key = rnd.Uniform(kNumKeys);
char keybuf[20];
snprintf(keybuf, sizeof(keybuf), "%016d", key);
if (rnd.OneIn(2)) {
// Write values of the form <key, my id, counter>.
// We add some padding for force compactions.
snprintf(valbuf, sizeof(valbuf), "%d.%d.%-1000d",
key, id, static_cast<int>(counter));
ASSERT_OK(db->Put(WriteOptions(), Slice(keybuf), Slice(valbuf)));
} else {
// Read a value and verify that it matches the pattern written above.
Status s = db->Get(ReadOptions(), Slice(keybuf), &value);
if (s.IsNotFound()) {
// Key has not yet been written
} else {
// Check that the writer thread counter is >= the counter in the value
ASSERT_OK(s);
int k, w;
uint32_t c;
ASSERT_EQ(3, sscanf(value.c_str(), "%d.%d.%d", &k, &w, &c)) << value;
ASSERT_EQ(k, key);
ASSERT_GE(w, 0);
ASSERT_LT(w, kNumThreads);
ASSERT_LE(c, reinterpret_cast<uintptr_t>(
t->state->counter[w].Acquire_Load()));
}
}
counter++;
}
t->state->thread_done[id].Release_Store(t);
fprintf(stderr, "... stopping thread %d after %d ops\n", id, int(counter));
}
} // namespace
TEST(DBTest, MultiThreaded) {
do {
// Initialize state
MTState mt;
mt.test = this;
mt.stop.Release_Store(0);
for (int id = 0; id < kNumThreads; id++) {
mt.counter[id].Release_Store(0);
mt.thread_done[id].Release_Store(0);
}
// Start threads
MTThread thread[kNumThreads];
for (int id = 0; id < kNumThreads; id++) {
thread[id].state = &mt;
thread[id].id = id;
env_->StartThread(MTThreadBody, &thread[id]);
}
// Let them run for a while
DelayMilliseconds(kTestSeconds * 1000);
// Stop the threads and wait for them to finish
mt.stop.Release_Store(&mt);
for (int id = 0; id < kNumThreads; id++) {
while (mt.thread_done[id].Acquire_Load() == NULL) {
DelayMilliseconds(100);
}
}
} while (ChangeOptions());
}
namespace {
typedef std::map<std::string, std::string> KVMap;
}
class ModelDB: public DB {
public:
class ModelSnapshot {
public:
KVMap map_;
};
explicit ModelDB(const Options& options): options_(options), snapshot_id_(0) { }
~ModelDB() { }
virtual Status Shutdown1() { return Status(); }
virtual Status Shutdown2() { return Status(); }
virtual Status Put(const WriteOptions& o, const Slice& k, const Slice& v) {
return DB::Put(o, k, v);
}
virtual Status Delete(const WriteOptions& o, const Slice& key) {
return DB::Delete(o, key);
}
virtual Status Get(const ReadOptions& options,
const Slice& key, std::string* value) {
assert(false); // Not implemented
return Status::NotFound(key);
}
virtual Iterator* NewIterator(const ReadOptions& options) {
if (options.snapshot == leveldb::kMaxSequenceNumber) {
KVMap* saved = new KVMap;
*saved = map_;
return new ModelIter(saved, true);
} else {
std::multimap<uint64_t, ModelSnapshot*>::iterator it = snapshots_.find(options.snapshot);
assert (it != snapshots_.end());
const KVMap* snapshot_state = &(it->second->map_);
return new ModelIter(snapshot_state, false);
}
}
virtual const uint64_t GetSnapshot(uint64_t sequence_number = 0) {
ModelSnapshot* snapshot = new ModelSnapshot;
snapshot->map_ = map_;
snapshots_.insert(std::pair<uint64_t, ModelSnapshot*>(++snapshot_id_, snapshot));
return snapshot_id_;
}
virtual void ReleaseSnapshot(uint64_t snapshot) {
std::multimap<uint64_t, ModelSnapshot*>::iterator it = snapshots_.find(snapshot);
if (it != snapshots_.end()) {
delete it->second;
snapshots_.erase(it);
}
}
virtual const uint64_t Rollback(uint64_t snapshot_seq, uint64_t rollback_point = kMaxSequenceNumber) {
// TODO
return 0;
}
virtual bool BusyWrite() {
return false;
}
virtual void Workload(double* write_workload) {}
virtual Status Write(const WriteOptions& options, WriteBatch* batch) {
class Handler : public WriteBatch::Handler {
public:
KVMap* map_;
virtual void Put(const Slice& key, const Slice& value) {
(*map_)[key.ToString()] = value.ToString();
}
virtual void Delete(const Slice& key) {
map_->erase(key.ToString());
}
};
Handler handler;
handler.map_ = &map_;
return batch->Iterate(&handler);
}
virtual bool GetProperty(const Slice& property, std::string* value) {
return false;
}
virtual void GetApproximateSizes(const Range* r, int n, uint64_t* sizes) {
for (int i = 0; i < n; i++) {
sizes[i] = 0;
}
}
virtual void GetApproximateSizes(uint64_t* size,
std::vector<uint64_t>* lgsize = NULL) {
}
virtual void CompactRange(const Slice* start, const Slice* end, int lg_no) {
}
virtual bool FindSplitKey(double ratio,
std::string* split_key) {
return false;
}
virtual bool FindKeyRange(std::string* smallest_key, std::string* largest_key) {
return false;
}
virtual uint64_t GetScopeSize(const std::string& start_key,
const std::string& end_key,
std::vector<uint64_t>* lgsize = NULL) {
return 0;
}
virtual bool MinorCompact() {
return false;
}
virtual void CompactMissFiles(const Slice* begin, const Slice* end) {}
virtual void AddInheritedLiveFiles(std::vector<std::set<uint64_t> >* live) {}
private:
class ModelIter: public Iterator {
public:
ModelIter(const KVMap* map, bool owned)
: map_(map), owned_(owned), iter_(map_->end()) {
}
~ModelIter() {
if (owned_) delete map_;
}
virtual bool Valid() const { return iter_ != map_->end(); }
virtual void SeekToFirst() { iter_ = map_->begin(); }
virtual void SeekToLast() {
if (map_->empty()) {
iter_ = map_->end();
} else {
iter_ = map_->find(map_->rbegin()->first);
}
}
virtual void Seek(const Slice& k) {
iter_ = map_->lower_bound(k.ToString());
}
virtual void Next() { ++iter_; }
virtual void Prev() { --iter_; }
virtual Slice key() const { return iter_->first; }
virtual Slice value() const { return iter_->second; }
virtual Status status() const { return Status::OK(); }
private:
const KVMap* const map_;
const bool owned_; // Do we own map_
KVMap::const_iterator iter_;
};
const Options options_;
KVMap map_;
std::multimap<uint64_t, ModelSnapshot*> snapshots_;
uint64_t snapshot_id_;
};
static std::string RandomKey(Random* rnd) {
int len = (rnd->OneIn(3)
? 1 // Short sometimes to encourage collisions
: (rnd->OneIn(100) ? rnd->Skewed(10) : rnd->Uniform(10)));
return test::RandomKey(rnd, len);
}
static bool CompareIterators(int step,
DB* model,
DB* db,
uint64_t model_snap,
uint64_t db_snap) {
ReadOptions options;
options.snapshot = model_snap;
Iterator* miter = model->NewIterator(options);
options.snapshot = db_snap;
Iterator* dbiter = db->NewIterator(options);
bool ok = true;
int count = 0;
for (miter->SeekToFirst(), dbiter->SeekToFirst();
ok && miter->Valid() && dbiter->Valid();
miter->Next(), dbiter->Next()) {
count++;
if (miter->key().compare(dbiter->key()) != 0) {
fprintf(stderr, "step %d: Key mismatch: '%s' vs. '%s' [count: %d]\n",
step,
EscapeString(miter->key()).c_str(),
EscapeString(dbiter->key()).c_str(),
count);
ok = false;
break;
}
if (miter->value().compare(dbiter->value()) != 0) {
fprintf(stderr, "step %d: Value mismatch for key '%s': '%s' vs. '%s'\n",
step,
EscapeString(miter->key()).c_str(),
EscapeString(miter->value()).c_str(),
EscapeString(miter->value()).c_str());
ok = false;
}
}
if (ok) {
if (miter->Valid() != dbiter->Valid()) {
fprintf(stderr, "step %d: Mismatch at end of iterators: %d vs. %d\n",
step, miter->Valid(), dbiter->Valid());
ok = false;
}
}
fprintf(stderr, "%d entries compared: ok=%d\n", count, ok);
delete miter;
delete dbiter;
return ok;
}
TEST(DBTest, Randomized) {
Random rnd(test::RandomSeed());
do {
ModelDB model(CurrentOptions());
const int N = 10000;
uint64_t model_snap = leveldb::kMaxSequenceNumber;
uint64_t db_snap = leveldb::kMaxSequenceNumber;
std::string k, v;
for (int step = 0; step < N; step++) {
if (step % 100 == 0) {
fprintf(stderr, "Step %d of %d\n", step, N);
}
// TODO(sanjay): Test Get() works
int p = rnd.Uniform(100);
if (p < 45) { // Put
k = RandomKey(&rnd);
v = RandomString(&rnd,
rnd.OneIn(20)
? 100 + rnd.Uniform(100)
: rnd.Uniform(8));
ASSERT_OK(model.Put(WriteOptions(), k, v));
ASSERT_OK(db_->Put(WriteOptions(), k, v));
} else if (p < 90) { // Delete
k = RandomKey(&rnd);
ASSERT_OK(model.Delete(WriteOptions(), k));
ASSERT_OK(db_->Delete(WriteOptions(), k));
} else { // Multi-element batch
WriteBatch b;
const int num = rnd.Uniform(8);
for (int i = 0; i < num; i++) {
if (i == 0 || !rnd.OneIn(10)) {
k = RandomKey(&rnd);
} else {
// Periodically re-use the same key from the previous iter, so
// we have multiple entries in the write batch for the same key
}
if (rnd.OneIn(2)) {
v = RandomString(&rnd, rnd.Uniform(10));
b.Put(k, v);
} else {
b.Delete(k);
}
}
ASSERT_OK(model.Write(WriteOptions(), &b));
ASSERT_OK(db_->Write(WriteOptions(), &b));
}
if ((step % 100) == 0) {
ASSERT_TRUE(CompareIterators(step, &model, db_,
leveldb::kMaxSequenceNumber, leveldb::kMaxSequenceNumber));
ASSERT_TRUE(CompareIterators(step, &model, db_, model_snap, db_snap));
// Save a snapshot from each DB this time that we'll use next
// time we compare things, to make sure the current state is
// preserved with the snapshot
if (model_snap != leveldb::kMaxSequenceNumber) model.ReleaseSnapshot(model_snap);
if (db_snap != leveldb::kMaxSequenceNumber) db_->ReleaseSnapshot(db_snap);
Reopen();
ASSERT_TRUE(CompareIterators(step, &model, db_,
leveldb::kMaxSequenceNumber, leveldb::kMaxSequenceNumber));
model_snap = model.GetSnapshot();
db_snap = db_->GetSnapshot();
}
}
if (model_snap != leveldb::kMaxSequenceNumber) model.ReleaseSnapshot(model_snap);
if (db_snap != leveldb::kMaxSequenceNumber) db_->ReleaseSnapshot(db_snap);
} while (ChangeOptions());
}
#if 0
TEST(DBTest, LG_ReadWrite) {
uint32_t lg_num = 3;
Options options;
options.create_if_missing = true;
options.lg_num = lg_num;
ASSERT_OK(TryReopen(&options));
std::map<std::string, std::string> kv_list;
Random rnd(test::RandomSeed());
const int N = 1000;
std::string k, v;
for (int i = 0; i < N; ++i) {
if (i != 0 && i % 100 == 0) {
printf("Step: %d of %d\n", i, N);
}
WriteBatch wb;
k = RandomKey(&rnd);
uint32_t p = 0;
for (int j = 0; j < 3; ++j) {
p = (p + 1) % lg_num;
v = RandomString(&rnd,
rnd.OneIn(20)
? 100 + rnd.Uniform(100)
: rnd.Uniform(8));
std::string my_k = k;
PutFixed32LGId(&my_k, p);
wb.Put(my_k, v);
kv_list[my_k] = v;
if (kv_list.size() == 549) {
printf("for debug");
}
}
dbfull()->Write(WriteOptions(), &wb);
if (i != 0 && i % 100 == 0) {
ASSERT_OK(TryReopen(&options));
}
}
// check
int count = 0;
std::map<std::string, std::string>::iterator it;
for (it = kv_list.begin(); it != kv_list.end(); ++it) {
std::string v;
ASSERT_OK(dbfull()->Get(ReadOptions(), it->first, &v))
<< ": key = '" << it->first << "', count: " << count;
if (v != it->second) {
printf("key = '%s', count = %d\n", it->first.c_str(), count);
}
// ASSERT_EQ(v, it->second)
// << ": key = '" << it->first << "'\n, count: " << count;
count++;
}
ASSERT_EQ(count, N);
}
#endif
std::string MakeKey(unsigned int num) {
char buf[30];
snprintf(buf, sizeof(buf), "%016u", num);
return std::string(buf);
}
void BM_LogAndApply(int iters, int num_base_files) {
std::string dbname = test::TmpDir() + "/leveldb_test_benchmark";
DestroyDB(dbname, Options());
DB* db = NULL;
Options opts;
Status s = DB::Open(opts, dbname, &db);
ASSERT_OK(s);
ASSERT_TRUE(db != NULL);
delete db;
db = NULL;
Env* env = Env::Default();
port::Mutex mu;
MutexLock l(&mu);
InternalKeyComparator cmp(BytewiseComparator());
Options options;
VersionSet vset(dbname, &options, NULL, &cmp);
ASSERT_OK(vset.Recover());
VersionEdit vbase;
uint64_t fnum = 1;
for (int i = 0; i < num_base_files; i++) {
InternalKey start(MakeKey(2*fnum), 1, kTypeValue);
InternalKey limit(MakeKey(2*fnum+1), 1, kTypeDeletion);
vbase.AddFile(2, fnum++, 1 /* file size */, start, limit);
}
ASSERT_OK(vset.LogAndApply(&vbase, &mu));
uint64_t start_micros = env->NowMicros();
for (int i = 0; i < iters; i++) {
VersionEdit vedit;
vedit.DeleteFile(2, fnum);
InternalKey start(MakeKey(2*fnum), 1, kTypeValue);
InternalKey limit(MakeKey(2*fnum+1), 1, kTypeDeletion);
vedit.AddFile(2, fnum++, 1 /* file size */, start, limit);
vset.LogAndApply(&vedit, &mu);
}
uint64_t stop_micros = env->NowMicros();
unsigned int us = stop_micros - start_micros;
char buf[16];
snprintf(buf, sizeof(buf), "%d", num_base_files);
fprintf(stderr,
"BM_LogAndApply/%-6s %8d iters : %9u us (%7.0f us / iter)\n",
buf, iters, us, ((float)us) / iters);
}
TEST(DBTest, FindKeyRange) {
Options options = CurrentOptions();
options.write_buffer_size = 1000;
options.env = env_;
Reopen(&options);
ASSERT_OK(Put("a", "v1"));
ASSERT_OK(Put("b", "v1"));
ASSERT_OK(Put("c", "v1"));
ASSERT_OK(Put("d", "v1"));
ASSERT_OK(Put("e", "v1"));
ASSERT_OK(Put("f", "v1"));
Reopen(&options);
ASSERT_OK(Put("c", "v1"));
ASSERT_OK(Put("d", "v1"));
ASSERT_OK(Put("e", "v1"));
ASSERT_OK(Put("world", "v1"));
ASSERT_OK(Put("zoozoozoo", "v1"));
Reopen(&options);
ASSERT_OK(Put("e", "v1"));
ASSERT_OK(Put("f", "v1"));
ASSERT_OK(Put("hello", "v1"));
Reopen(&options);
std::string sk, lk;
db_->FindKeyRange(&sk, &lk);
ASSERT_EQ(sk, "a");
ASSERT_EQ(lk, "zoozoozoo");
}
} // namespace leveldb
int main(int argc, char** argv) {
if (argc > 1 && std::string(argv[1]) == "--benchmark") {
leveldb::BM_LogAndApply(1000, 1);
leveldb::BM_LogAndApply(1000, 100);
leveldb::BM_LogAndApply(1000, 10000);
leveldb::BM_LogAndApply(100, 100000);
return 0;
}
return leveldb::test::RunAllTests();
}
| {
"content_hash": "a214def0658e82de65e12bfdc07806b3",
"timestamp": "",
"source": "github",
"line_count": 2223,
"max_line_length": 104,
"avg_line_length": 29.63067926225821,
"alnum_prop": 0.593162185550107,
"repo_name": "lylei/tera",
"id": "768aba78baf93058dc6503c0d96786f6caeeac86",
"size": "65869",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/leveldb/db/db_test.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "85460"
},
{
"name": "C++",
"bytes": "3857794"
},
{
"name": "CMake",
"bytes": "1040"
},
{
"name": "Java",
"bytes": "29791"
},
{
"name": "Makefile",
"bytes": "17960"
},
{
"name": "Protocol Buffer",
"bytes": "30705"
},
{
"name": "Python",
"bytes": "151943"
},
{
"name": "Shell",
"bytes": "36208"
}
],
"symlink_target": ""
} |
using ceenq.com.Core.Routing;
using Orchard.ContentManagement.Records;
namespace ceenq.com.RoutingServer.Models
{
public class RoutingServerViewModel
{
public virtual string Name { get; set; }
public virtual string DnsName { get; set; }
public virtual int ConnectionPort { get; set; }
public virtual string Username { get; set; }
public virtual string IpAddress { get; set; }
}
} | {
"content_hash": "6e45d7779ba8d064eafb9dcf2aa238d7",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 55,
"avg_line_length": 30.928571428571427,
"alnum_prop": 0.6766743648960739,
"repo_name": "bill-cooper/catc-cms",
"id": "9112354aa89a10fc7d767ac1e2c9bf58f88d7112",
"size": "435",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Orchard.Web/Modules/ceenq.com.RoutingServer/Models/RoutingServerViewModel.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "1401"
},
{
"name": "Batchfile",
"bytes": "5675"
},
{
"name": "C",
"bytes": "4755"
},
{
"name": "C#",
"bytes": "10526440"
},
{
"name": "CSS",
"bytes": "1254118"
},
{
"name": "Cucumber",
"bytes": "89076"
},
{
"name": "HTML",
"bytes": "100974"
},
{
"name": "JavaScript",
"bytes": "4268248"
},
{
"name": "PowerShell",
"bytes": "22046"
},
{
"name": "SQLPL",
"bytes": "1827"
},
{
"name": "TypeScript",
"bytes": "51422"
},
{
"name": "XSLT",
"bytes": "119918"
}
],
"symlink_target": ""
} |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SERVE_STATIC_FILES = True
#Replace these with your keys
ODESK_PUBLIC_KEY = ''
ODESK_PRIVATE_KEY = ''
| {
"content_hash": "0c83ef6c357f5dddcf7b06e2dcdc7def",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 29,
"avg_line_length": 17.5,
"alnum_prop": 0.7142857142857143,
"repo_name": "solex/psdeploy",
"id": "d40d0b3a0b0deadb9d466bf2703c55200fc643e6",
"size": "141",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "psdeploy/templates_dir/odesk_app/+project+/local_settings.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "6800"
}
],
"symlink_target": ""
} |
vtk_module(vtkRenderingOpenGL
DEPENDS
vtkCommonCore
vtkCommonDataModel
vtkCommonMath
vtkCommonTransforms
vtkCommonSystem
vtkFiltersCore
vtkRenderingCore
vtkIOXML
vtkIOImage # For vtkImageExport
vtkImagingCore # For vtkSampleFunction
COMPILE_DEPENDS
ParseOGLExt
EncodeString
DEFAULT ON)
| {
"content_hash": "c468e7d38d50622f1437ffe86a6c5ce7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 42,
"avg_line_length": 21.25,
"alnum_prop": 0.7558823529411764,
"repo_name": "cjh1/vtkmodular",
"id": "cd725f778d817de00d128e2358849ea71e674a1e",
"size": "340",
"binary": false,
"copies": "1",
"ref": "refs/heads/modular-no-vtk4-compat",
"path": "Rendering/OpenGL/module.cmake",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "37780"
},
{
"name": "C",
"bytes": "43497387"
},
{
"name": "C++",
"bytes": "45441884"
},
{
"name": "Objective-C",
"bytes": "96778"
},
{
"name": "Perl",
"bytes": "174808"
},
{
"name": "Prolog",
"bytes": "4746"
},
{
"name": "Python",
"bytes": "406375"
},
{
"name": "Shell",
"bytes": "11229"
},
{
"name": "Tcl",
"bytes": "2383"
}
],
"symlink_target": ""
} |
..
.. 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.
..
Examples
========
.. toctree::
cifar10/README
char-rnn/README
imagenet/README
| {
"content_hash": "dc48f0313bde26cf702cf1bd70f5a584",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 75,
"avg_line_length": 32.17857142857143,
"alnum_prop": 0.7347391786903441,
"repo_name": "wangsheng1001/incubator-singa",
"id": "b501b36e8c218d3ac6efc0ab8c276874f3e7a9b2",
"size": "901",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/index.rst",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "179242"
},
{
"name": "C++",
"bytes": "2073854"
},
{
"name": "CMake",
"bytes": "35853"
},
{
"name": "Cuda",
"bytes": "23056"
},
{
"name": "Java",
"bytes": "1770"
},
{
"name": "Makefile",
"bytes": "509"
},
{
"name": "Protocol Buffer",
"bytes": "100639"
},
{
"name": "Python",
"bytes": "191632"
},
{
"name": "Shell",
"bytes": "19527"
}
],
"symlink_target": ""
} |
#ifdef __QNXNTO__
#include <openssl/ssl3.h>
#else
#include <openssl/opensslv.h>
#include <openssl/ssl.h>
#endif //__QNXNTO__
#include <fstream>
#include <limits>
#include <sstream>
#include "gtest/gtest.h"
#include "security_manager/crypto_manager_impl.h"
#include "security_manager/mock_security_manager_settings.h"
#define OPENSSL1_1_VERSION 0x1010000fL
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
namespace {
const size_t kUpdatesBeforeHour = 24;
const std::string kAllCiphers = "ALL";
const std::string kCaCertPath = "";
const uint32_t kServiceNumber = 2u;
const size_t kMaxSizeVector = 1u;
const std::string kCertPath = "certificate.crt";
const std::string kPrivateKeyPath = "private.key";
#ifdef __QNXNTO__
const std::string kFordCipher = SSL3_TXT_RSA_DES_192_CBC3_SHA;
#else
// Used cipher from ford protocol requirement
const std::string kFordCipher = TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384;
#endif
} // namespace
namespace test {
namespace components {
namespace crypto_manager_test {
using security_manager::CryptoManagerImpl;
class CryptoManagerTest : public testing::Test {
protected:
typedef NiceMock<security_manager_test::MockCryptoManagerSettings>
MockCryptoManagerSettings;
static void SetUpTestCase() {
std::ifstream certificate_file("server/spt_credential.pem");
ASSERT_TRUE(certificate_file.is_open())
<< "Could not open certificate data file";
const std::string certificate(
(std::istreambuf_iterator<char>(certificate_file)),
std::istreambuf_iterator<char>());
ASSERT_FALSE(certificate.empty()) << "Certificate data file is empty";
certificate_data_base64_ = certificate;
}
void SetUp() OVERRIDE {
ASSERT_FALSE(certificate_data_base64_.empty());
mock_security_manager_settings_ =
std::make_shared<MockCryptoManagerSettings>();
crypto_manager_ =
std::make_shared<CryptoManagerImpl>(mock_security_manager_settings_);
forced_protected_services_.reserve(kMaxSizeVector);
forced_unprotected_services_.reserve(kMaxSizeVector);
}
void InitSecurityManager() {
SetInitialValues(
security_manager::CLIENT, security_manager::TLSv1_2, kAllCiphers);
const bool crypto_manager_initialization = crypto_manager_->Init();
ASSERT_TRUE(crypto_manager_initialization);
}
void SetInitialValues(security_manager::Mode mode,
security_manager::Protocol protocol,
const std::string& cipher) {
ON_CALL(*mock_security_manager_settings_, force_unprotected_service())
.WillByDefault(ReturnRef(forced_unprotected_services_));
ON_CALL(*mock_security_manager_settings_, force_protected_service())
.WillByDefault(ReturnRef(forced_protected_services_));
ON_CALL(*mock_security_manager_settings_, security_manager_mode())
.WillByDefault(Return(mode));
ON_CALL(*mock_security_manager_settings_, security_manager_protocol_name())
.WillByDefault(Return(protocol));
ON_CALL(*mock_security_manager_settings_, certificate_data())
.WillByDefault(ReturnRef(certificate_data_base64_));
ON_CALL(*mock_security_manager_settings_, ciphers_list())
.WillByDefault(ReturnRef(cipher));
ON_CALL(*mock_security_manager_settings_, ca_cert_path())
.WillByDefault(ReturnRef(kCaCertPath));
ON_CALL(*mock_security_manager_settings_, module_cert_path())
.WillByDefault(ReturnRef(kCertPath));
ON_CALL(*mock_security_manager_settings_, module_key_path())
.WillByDefault(ReturnRef(kPrivateKeyPath));
ON_CALL(*mock_security_manager_settings_, verify_peer())
.WillByDefault(Return(false));
}
std::shared_ptr<CryptoManagerImpl> crypto_manager_;
std::shared_ptr<MockCryptoManagerSettings> mock_security_manager_settings_;
static std::string certificate_data_base64_;
std::vector<int> forced_protected_services_;
std::vector<int> forced_unprotected_services_;
};
std::string CryptoManagerTest::certificate_data_base64_;
TEST_F(CryptoManagerTest, UsingBeforeInit) {
EXPECT_TRUE(crypto_manager_->CreateSSLContext() == NULL);
EXPECT_EQ(std::string("Initialization is not completed"),
crypto_manager_->LastError());
}
TEST_F(CryptoManagerTest, WrongInit) {
// We have to cast (-1) to security_manager::Protocol Enum to be accepted by
// crypto_manager_->Init(...)
// Unknown protocol version
security_manager::Protocol UNKNOWN =
static_cast<security_manager::Protocol>(-1);
// Unexistent cipher value
const std::string invalid_cipher = "INVALID_UNKNOWN_CIPHER";
const security_manager::Mode mode = security_manager::SERVER;
SetInitialValues(mode, UNKNOWN, invalid_cipher);
EXPECT_FALSE(crypto_manager_->Init());
EXPECT_NE(std::string(), crypto_manager_->LastError());
#if OPENSSL1_1_VERSION >= OPENSSL_VERSION_NUMBER
// Legacy test, openssl 1.1.1 changed the error behavior of
// SSL_CTX_set_cipher_list
EXPECT_CALL(*mock_security_manager_settings_,
security_manager_protocol_name())
.WillOnce(Return(security_manager::TLSv1_2));
EXPECT_CALL(*mock_security_manager_settings_, certificate_data())
.WillOnce(ReturnRef(certificate_data_base64_));
EXPECT_CALL(*mock_security_manager_settings_, ciphers_list())
.WillRepeatedly(ReturnRef(invalid_cipher));
EXPECT_FALSE(crypto_manager_->Init());
EXPECT_NE(std::string(), crypto_manager_->LastError());
#endif
}
// #ifndef __QNXNTO__
TEST_F(CryptoManagerTest, CorrectInit) {
// Empty cert and key values for SERVER
SetInitialValues(
security_manager::SERVER, security_manager::TLSv1_2, kFordCipher);
EXPECT_TRUE(crypto_manager_->Init());
// Recall init
SetInitialValues(
security_manager::CLIENT, security_manager::TLSv1_2, kFordCipher);
EXPECT_TRUE(crypto_manager_->Init());
// Recall init with other protocols
SetInitialValues(
security_manager::CLIENT, security_manager::DTLSv1, kFordCipher);
EXPECT_TRUE(crypto_manager_->Init());
// Cipher value
SetInitialValues(
security_manager::SERVER, security_manager::TLSv1_2, kAllCiphers);
EXPECT_TRUE(crypto_manager_->Init());
SetInitialValues(
security_manager::SERVER, security_manager::DTLSv1, kAllCiphers);
EXPECT_TRUE(crypto_manager_->Init());
}
// #endif // __QNX__
TEST_F(CryptoManagerTest, ReleaseSSLContext_Null) {
EXPECT_NO_THROW(crypto_manager_->ReleaseSSLContext(NULL));
}
TEST_F(CryptoManagerTest, CreateReleaseSSLContext) {
const size_t max_payload_size = 1000u;
SetInitialValues(
security_manager::CLIENT, security_manager::TLSv1_2, kAllCiphers);
EXPECT_TRUE(crypto_manager_->Init());
EXPECT_CALL(*mock_security_manager_settings_, security_manager_mode())
.Times(2)
.WillRepeatedly(Return(security_manager::CLIENT));
EXPECT_CALL(*mock_security_manager_settings_, maximum_payload_size())
.Times(1)
.WillRepeatedly(Return(max_payload_size));
security_manager::SSLContext* context = crypto_manager_->CreateSSLContext();
EXPECT_TRUE(context);
EXPECT_NO_THROW(crypto_manager_->ReleaseSSLContext(context));
}
TEST_F(CryptoManagerTest, OnCertificateUpdated) {
InitSecurityManager();
EXPECT_TRUE(crypto_manager_->OnCertificateUpdated(certificate_data_base64_));
}
TEST_F(CryptoManagerTest, OnCertificateUpdated_UpdateNotRequired) {
time_t system_time = 0;
time_t certificates_time = 1;
size_t updates_before = 0;
SetInitialValues(
security_manager::CLIENT, security_manager::TLSv1_2, kAllCiphers);
ASSERT_TRUE(crypto_manager_->Init());
EXPECT_CALL(*mock_security_manager_settings_, update_before_hours())
.WillOnce(Return(updates_before));
EXPECT_FALSE(crypto_manager_->IsCertificateUpdateRequired(system_time,
certificates_time));
size_t max_updates_ = std::numeric_limits<size_t>::max();
SetInitialValues(
security_manager::CLIENT, security_manager::TLSv1_2, kAllCiphers);
EXPECT_CALL(*mock_security_manager_settings_, update_before_hours())
.WillOnce(Return(max_updates_));
ASSERT_TRUE(crypto_manager_->Init());
EXPECT_TRUE(crypto_manager_->IsCertificateUpdateRequired(system_time,
certificates_time));
}
TEST_F(CryptoManagerTest, OnCertificateUpdated_NotInitialized) {
EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(certificate_data_base64_));
}
TEST_F(CryptoManagerTest, OnCertificateUpdated_NullString) {
InitSecurityManager();
EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(std::string()));
}
TEST_F(CryptoManagerTest, OnCertificateUpdated_MalformedSign) {
InitSecurityManager();
// Corrupt the middle symbol
certificate_data_base64_[certificate_data_base64_.size() / 2] = '?';
EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(certificate_data_base64_));
}
TEST_F(CryptoManagerTest, OnCertificateUpdated_WrongInitFolder) {
SetInitialValues(
security_manager::CLIENT, security_manager::TLSv1_2, kAllCiphers);
ASSERT_TRUE(crypto_manager_->Init());
const std::string certificate = "wrong_data";
ASSERT_FALSE(certificate.empty());
EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(certificate));
}
} // namespace crypto_manager_test
} // namespace components
} // namespace test
| {
"content_hash": "cfcd69d68082538107ddaec8ce0bfb4e",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 80,
"avg_line_length": 36.127906976744185,
"alnum_prop": 0.7154811715481172,
"repo_name": "smartdevicelink/sdl_core",
"id": "44e24afe7040082543718e8657b7503d49d11757",
"size": "10891",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/components/security_manager/test/crypto_manager_impl_test.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "27115"
},
{
"name": "C++",
"bytes": "22338348"
},
{
"name": "CMake",
"bytes": "435397"
},
{
"name": "M4",
"bytes": "25347"
},
{
"name": "Makefile",
"bytes": "139997"
},
{
"name": "Python",
"bytes": "566738"
},
{
"name": "Shell",
"bytes": "696186"
}
],
"symlink_target": ""
} |
<!--
Copyright 2016 The LUCI Authors. All rights reserved.
Use of this source code is governed under the Apache License, Version 2.0
that can be found in the LICENSE file.
-->
<link rel="import" href="../inc/logdog-app-base/logdog-app-base.html">
<script>
window.addEventListener('WebComponentsReady', function() {
// We use Page.js for routing. This is a Micro
// client-side router inspired by the Express router
// More info: https://visionmedia.github.io/page.js/
// Removes end / from app.baseUrl which page.base requires for production
var baseUrl = app.baseUrl;
page.base(baseUrl);
// Middleware
function scrollToTop(ctx, next) {
app.scrollPageToTop();
next();
}
function closeDrawer(ctx, next) {
app.closeDrawer();
next();
}
// Hack to make this work on root-URL apps (e.g., localhost testing).
if ( baseUrl === "/" ) {
var oldReplace = page.replace;
page.replace = function(path, state, init, dispatch) {
if ( path.substring(0, 1) !== "/" ) {
path = "/" + path;
}
if ( path.substring(0, 3) !== "/#!" ) {
path = "/#!" + path;
}
return oldReplace(path, state, init, dispatch);
};
}
// Routes
page("*", scrollToTop, closeDrawer, function(ctx, next) {
next();
});
page("/", function() {
app.route = "root";
});
page("/query/*", function(data) {
app.route = "query";
app.$.query.base = logdog.correctStreamPath(data.params[0]);
});
page("/stream/*", function(data) {
app.route = "stream";
app.$.stream.streams = logdog.getQueryValues(data.querystring, "s").
map(logdog.correctStreamPath);
});
// 404
page(function() {
app.$.toast.text = "Can't find: " + window.location.href +
". Redirected you to Home Page";
app.$.toast.show();
page.redirect(app.baseUrl);
});
page({
hashbang: true,
});
});
</script>
| {
"content_hash": "ca07a0629a3fe06e0eb4b0a41c3c5cd1",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 27.513513513513512,
"alnum_prop": 0.5672888015717092,
"repo_name": "luci/luci-go",
"id": "032998a30e105a8c44eff07f355525af1692ef37",
"size": "2036",
"binary": false,
"copies": "3",
"ref": "refs/heads/main",
"path": "web/apps/logdog-app/elements/routing.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "25460"
},
{
"name": "Go",
"bytes": "10674259"
},
{
"name": "HTML",
"bytes": "658081"
},
{
"name": "JavaScript",
"bytes": "18433"
},
{
"name": "Makefile",
"bytes": "2862"
},
{
"name": "Python",
"bytes": "49205"
},
{
"name": "Shell",
"bytes": "20986"
},
{
"name": "TypeScript",
"bytes": "110221"
}
],
"symlink_target": ""
} |
/* Branch Monitor
* Marcus Botacin
* 2017
*/
#include "config.h"
#include "dbg\debug.h"
#include "checks\checks.h"
#include "device\device.h"
#include "BTS\BTS.h"
#include "list\list.h"
/*************************************************************************
Prototypes
*************************************************************************/
DRIVER_INITIALIZE DriverEntry;
NTSTATUS
DriverEntry (
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
);
VOID BranchMonitorUnload(PDRIVER_OBJECT DriverObject);
/*************************************************************************
Driver initialization and unload routines.
*************************************************************************/
PDRIVER_OBJECT drv;
NTSTATUS
DriverEntry (
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
{
pdevice_ext ext;
int ret_code;
NTSTATUS status=STATUS_SUCCESS;
UNREFERENCED_PARAMETER( RegistryPath );
debug("Entry Point: In");
DriverObject->DriverUnload=BranchMonitorUnload;
/* Check all required resources */
if((ret_code=perform_checks())!=NO_ERROR)
{
emit_error(ret_code);
status=STATUS_NOT_SUPPORTED;
}
/* Set up device */
if((status=CreateDevice(DriverObject))!=STATUS_SUCCESS)
{
debug("Error Creating Device");
}
/* driver data extension */
debug("Setting driver extension");
DriverObject->DeviceObject->DeviceExtension=ExAllocatePool(NonPagedPool,sizeof(device_ext));
/* Hooking PMI handler */
debug("Registering callback");
hook_handler();
drv=DriverObject;
/* setting list */
if(create_list()==FALSE)
{
debug("Create List error");
}
debug("Entry Point: Out");
return status;
}
VOID BranchMonitorUnload(PDRIVER_OBJECT DriverObject)
{
pdevice_ext ext;
UNICODE_STRING path;
debug("Unload Routine: In");
debug("Unregistering callback");
ext=(pdevice_ext)DriverObject->DeviceObject->DeviceExtension;
/* Unhook PMI handler */
unhook_handler();
ExFreePool(ext);
debug("clear list entries");
destroy_list();
debug("Removing Device");
RtlInitUnicodeString(&path,DOSDRIVERNAME);
IoDeleteSymbolicLink(&path);
IoDeleteDevice(DriverObject->DeviceObject);
debug("Unload Routine: Out");
return;
} | {
"content_hash": "076743bb8e7f39250d0470fdbf9d5281",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 93,
"avg_line_length": 21.86111111111111,
"alnum_prop": 0.5925455315544261,
"repo_name": "marcusbotacin/BranchMonitoringProject",
"id": "81f0341ac22d72b6ad6ec3ce84c0492bf6583916",
"size": "2361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BranchMonitor.PMI/src/BranchMonitor.c",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "332866"
},
{
"name": "C++",
"bytes": "111639"
},
{
"name": "Objective-C",
"bytes": "319110"
},
{
"name": "Python",
"bytes": "42353"
}
],
"symlink_target": ""
} |
<?php
/**
* 简单的 Excel 实现类
* 依赖于 PHPExcel
*
* @author Jesse
*
*/
class Office_Excel{
const TYPE_EXCEL5 = 'Excel5';
const TYPE_EXCEL2007 = 'Excel2007';
const TYPE_EXCEL2003XML = 'Excel2003XML';
const TYPE_HTML = 'HTML';
const TYPE_CSV = 'CSV';
public static $extMap = array(
self::TYPE_CSV => 'csv',
self::TYPE_EXCEL5 => 'xls',
self::TYPE_EXCEL2007=>'xlsx',
self::TYPE_HTML=>'html',
self::TYPE_EXCEL2003XML => 'xls',
'default' => 'xls',
);
public $phpExcel;
public $data;
public $titleInfo;
public function __construct(){
$this->phpExcel = new PHPExcel();
}
public function setArrayData($data,$setTitle = true){
$this->data = $data;
if($setTitle && !$this->titleInfo){
$titleInfo = array();
foreach (current($data) as $key => $value){
$titleInfo[$key] = $key;
}
$this->titleInfo = $titleInfo;
}
}
public function setTitle($titleInfo){
$this->titleInfo = $titleInfo;
}
public function download($name,$type = self::TYPE_EXCEL5,$return = false){
$data = $this->data;
$titleInfo = $this->titleInfo;
if(!$data){
return false;
}
$showArray = array();
if($titleInfo){
$row = array();
foreach ($titleInfo as $key => $title){
$row[] = $title;
}
$showArray[] = $row;
foreach ($data as $one){
$row = array();
foreach ($titleInfo as $key => $title){
$row[] = $one[$key];
}
$showArray[] = $row;
}
} else {
$showArray = $data;
}
$objPHPExcel = $this->phpExcel;
$worksheet = $objPHPExcel->getActiveSheet();
//全部设置成字符串
$colNum = $rowNum = 0;
foreach ($showArray as $array){
$colNum = 0;
$rowNum++;
foreach ($array as $val){
$worksheet->setCellValueExplicitByColumnAndRow($colNum,$rowNum,$val,PHPExcel_Cell_DataType::TYPE_STRING);
$colNum++;
}
}
//$worksheet->fromArray($showArray);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $type);
$names = explode('.', $name);
if(count($names) < 2){//无后缀
$name = $name . '.' . self::GetExt($type);
}
if($return){
ob_start();
$objWriter->save('php://output');
$content =ob_get_clean();
return $content;
} else {
header("Content-Disposition: attachment;filename={$name}");
header('Cache-Control: max-age=0');
header ('Pragma: public'); // HTTP/1.0
header('Content-Type: application/vnd.ms-excel');
header("Content-Type: application/octet-stream");
header('Content-Type: application/x-download');
$objWriter->save('php://output');
exit;
}
}
public static function GetExt($type){
$ext = self::$extMap[$type];
$ext = $ext ? $ext : self::$extMap['default'];
return $ext;
}
} | {
"content_hash": "43a9646d392250ddfbd0637a4a23540e",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 109,
"avg_line_length": 22.386554621848738,
"alnum_prop": 0.6017267267267268,
"repo_name": "jesse108/infectionMap",
"id": "c6c80d6e76ad53d5e43efb59cb2f6fc0faa37b0d",
"size": "2704",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/Office/Excel.class.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "407554"
},
{
"name": "HTML",
"bytes": "120689"
},
{
"name": "JavaScript",
"bytes": "499137"
},
{
"name": "PHP",
"bytes": "4300215"
},
{
"name": "Smarty",
"bytes": "4730"
}
],
"symlink_target": ""
} |
update careneeds set
delivery_status=:delivery_status
where
id=:id
| {
"content_hash": "e32887dafbdcad6928f0deea763bb173",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 15.6,
"alnum_prop": 0.7051282051282052,
"repo_name": "floodfx/gma-village",
"id": "95bca145d32c45889256f2da1e6f7d983ee52e9a",
"size": "78",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java-lambda/src/main/resources/com/gmavillage/lambda/db/sql/updateCareNeedStatus.sql",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2448"
},
{
"name": "HTML",
"bytes": "2281"
},
{
"name": "Java",
"bytes": "213999"
},
{
"name": "JavaScript",
"bytes": "100607"
},
{
"name": "Shell",
"bytes": "20498"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="SHORTCUT ICON" href="../../../../../img/clover.ico" />
<link rel="stylesheet" href="../../../../../aui/css/aui.min.css" media="all"/>
<link rel="stylesheet" href="../../../../../aui/css/aui-experimental.min.css" media="all"/>
<!--[if IE 9]><link rel="stylesheet" href="../../../../../aui/css/aui-ie9.min.css" media="all"/><![endif]-->
<style type="text/css" media="all">
@import url('../../../../../style.css');
@import url('../../../../../tree.css');
</style>
<script src="../../../../../jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-experimental.min.js" type="text/javascript"></script>
<script src="../../../../../aui/js/aui-soy.min.js" type="text/javascript"></script>
<script src="../../../../../package-nodes-tree.js" type="text/javascript"></script>
<script src="../../../../../clover-tree.js" type="text/javascript"></script>
<script src="../../../../../clover.js" type="text/javascript"></script>
<script src="../../../../../clover-descriptions.js" type="text/javascript"></script>
<script src="../../../../../cloud.js" type="text/javascript"></script>
<title>ABA Route Transit Number Validator 1.0.1-SNAPSHOT</title>
</head>
<body>
<div id="page">
<header id="header" role="banner">
<nav class="aui-header aui-dropdown2-trigger-group" role="navigation">
<div class="aui-header-inner">
<div class="aui-header-primary">
<h1 id="logo" class="aui-header-logo aui-header-logo-clover">
<a href="http://openclover.org" title="Visit OpenClover home page"><span class="aui-header-logo-device">OpenClover</span></a>
</h1>
</div>
<div class="aui-header-secondary">
<ul class="aui-nav">
<li id="system-help-menu">
<a class="aui-nav-link" title="Open online documentation" target="_blank"
href="http://openclover.org/documentation">
<span class="aui-icon aui-icon-small aui-iconfont-help"> Help</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="aui-page-panel">
<div class="aui-page-panel-inner">
<div class="aui-page-panel-nav aui-page-panel-nav-clover">
<div class="aui-page-header-inner" style="margin-bottom: 20px;">
<div class="aui-page-header-image">
<a href="http://cardatechnologies.com" target="_top">
<div class="aui-avatar aui-avatar-large aui-avatar-project">
<div class="aui-avatar-inner">
<img src="../../../../../img/clover_logo_large.png" alt="Clover icon"/>
</div>
</div>
</a>
</div>
<div class="aui-page-header-main" >
<h1>
<a href="http://cardatechnologies.com" target="_top">
ABA Route Transit Number Validator 1.0.1-SNAPSHOT
</a>
</h1>
</div>
</div>
<nav class="aui-navgroup aui-navgroup-vertical">
<div class="aui-navgroup-inner">
<ul class="aui-nav">
<li class="">
<a href="../../../../../dashboard.html">Project overview</a>
</li>
</ul>
<div class="aui-nav-heading packages-nav-heading">
<strong>Packages</strong>
</div>
<div class="aui-nav project-packages">
<form method="get" action="#" class="aui package-filter-container">
<input type="text" autocomplete="off" class="package-filter text"
placeholder="Type to filter packages..." name="package-filter" id="package-filter"
title="Start typing package name (or part of the name) to search through the tree. Use arrow keys and the Enter key to navigate."/>
</form>
<p class="package-filter-no-results-message hidden">
<small>No results found.</small>
</p>
<div class="packages-tree-wrapper" data-root-relative="../../../../../" data-package-name="com.cardatechnologies.utils.validators.abaroutevalidator">
<div class="packages-tree-container"></div>
<div class="clover-packages-lozenges"></div>
</div>
</div>
</div>
</nav> </div>
<section class="aui-page-panel-content">
<div class="aui-page-panel-content-clover">
<div class="aui-page-header-main"><ol class="aui-nav aui-nav-breadcrumbs">
<li><a href="../../../../../dashboard.html"> Project Clover database Sat Aug 7 2021 12:29:33 MDT</a></li>
<li><a href="test-pkg-summary.html">Package com.cardatechnologies.utils.validators.abaroutevalidator</a></li>
<li><a href="test-Test_AbaRouteValidator_13b.html">Class Test_AbaRouteValidator_13b</a></li>
</ol></div>
<h1 class="aui-h2-clover">
Test testAbaNumberCheck_29751_good
</h1>
<table class="aui">
<thead>
<tr>
<th>Test</th>
<th><label title="The test result. Either a Pass, Fail or Error.">Status</label></th>
<th><label title="When the test execution was started">Start time</label></th>
<th><label title="The total time in seconds taken to run this test.">Time (seconds)</label></th>
<th><label title="A failure or error message if the test is not successful.">Message</label></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_13b.html?line=61288#src-61288" >testAbaNumberCheck_29751_good</a>
</td>
<td>
<span class="sortValue">1</span><span class="aui-lozenge aui-lozenge-success">PASS</span>
</td>
<td>
7 Aug 12:42:41
</td>
<td>
0.0 </td>
<td>
<div></div>
<div class="errorMessage"></div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<table class="aui aui-table-sortable">
<thead>
<tr>
<th style="white-space:nowrap;"><label title="A class that was directly hit by this test.">Target Class</label></th>
<th colspan="4"><label title="The percentage of coverage contributed by each single test.">Coverage contributed by</label> testAbaNumberCheck_29751_good</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="sortValue">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</span>
  <a href="../../../../../com/cardatechnologies/utils/validators/abaroutevalidator/AbaRouteValidator.html?id=26248#AbaRouteValidator" title="AbaRouteValidator" name="sl-47">com.cardatechnologies.utils.validators.abaroutevalidator.AbaRouteValidator</a>
</td>
<td>
<span class="sortValue">0.7352941</span>73.5%
</td>
<td class="align-middle" style="width: 100%" colspan="3">
<div>
<div title="73.5% Covered" style="min-width:40px;" class="barNegative contribBarNegative contribBarNegative"><div class="barPositive contribBarPositive contribBarPositive" style="width:73.5%"></div></div></div> </td>
</tr>
</tbody>
</table>
</div> <!-- class="aui-page-panel-content-clover" -->
<footer id="footer" role="contentinfo">
<section class="footer-body">
<ul>
<li>
Report generated by <a target="_new" href="http://openclover.org">OpenClover</a> v 4.4.1
on Sat Aug 7 2021 12:49:26 MDT using coverage data from Sat Aug 7 2021 12:47:23 MDT.
</li>
</ul>
<ul>
<li>OpenClover is free and open-source software. </li>
</ul>
</section>
</footer> </section> <!-- class="aui-page-panel-content" -->
</div> <!-- class="aui-page-panel-inner" -->
</div> <!-- class="aui-page-panel" -->
</div> <!-- id="page" -->
</body>
</html> | {
"content_hash": "ad7b6ffc1955b09f2fc20ad947a8b871",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 297,
"avg_line_length": 43.942583732057415,
"alnum_prop": 0.5099085365853658,
"repo_name": "dcarda/aba.route.validator",
"id": "c78f9f7eb25aae7de5618fdc369b9bb13522612b",
"size": "9184",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "target13/site/clover/com/cardatechnologies/utils/validators/abaroutevalidator/Test_AbaRouteValidator_13b_testAbaNumberCheck_29751_good_k94.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "18715254"
}
],
"symlink_target": ""
} |
const parseJavaScript = require('./parseJavaScript');
module.exports = function parseExpression(str) {
return parseJavaScript(`(${String(str)})`, {
sourceType: 'module',
ecmaVersion: 'latest',
}).body[0].expression;
};
| {
"content_hash": "e6fe56121631c4a6d32aa0632daa7508",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 53,
"avg_line_length": 29,
"alnum_prop": 0.6853448275862069,
"repo_name": "assetgraph/assetgraph",
"id": "492675bd2c67423edd9bb321775725222973b3be",
"size": "232",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/parseExpression.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "1140587"
}
],
"symlink_target": ""
} |
//*****************************************************************************
//
// eusci_spi.c - Driver for the eusci_spi Module.
//
//*****************************************************************************
//*****************************************************************************
//
//! \addtogroup eusci_spi_api
//! @{
//
//*****************************************************************************
#include "inc/hw_regaccess.h"
#include "inc/hw_memmap.h"
#ifdef __MSP430_HAS_EUSCI_Ax__
#include "eusci_spi.h"
#include <assert.h>
//*****************************************************************************
//
//! \brief DEPRECATED - Initializes the SPI Master block.
//!
//! Upon successful initialization of the SPI master block, this function will
//! have set the bus speed for the master, but the SPI Master block still
//! remains disabled and must be enabled with EUSCI_SPI_enable()
//!
//! \param baseAddress is the base address of the EUSCI_SPI Master module.
//! \param selectClockSource selects Clock source.
//! Valid values are:
//! - \b EUSCI_SPI_CLOCKSOURCE_ACLK
//! - \b EUSCI_SPI_CLOCKSOURCE_SMCLK
//! \param clockSourceFrequency is the frequency of the selected clock source
//! \param desiredSpiClock is the desired clock rate for SPI communication
//! \param msbFirst controls the direction of the receive and transmit shift
//! register.
//! Valid values are:
//! - \b EUSCI_SPI_MSB_FIRST
//! - \b EUSCI_SPI_LSB_FIRST [Default]
//! \param clockPhase is clock phase select.
//! Valid values are:
//! - \b EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default]
//! - \b EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT
//! \param clockPolarity is clock polarity select
//! Valid values are:
//! - \b EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH
//! - \b EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default]
//! \param spiMode is SPI mode select
//! Valid values are:
//! - \b EUSCI_SPI_3PIN
//! - \b EUSCI_SPI_4PIN_UCxSTE_ACTIVE_HIGH
//! - \b EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW
//!
//! Modified bits are \b UCCKPH, \b UCCKPL, \b UC7BIT, \b UCMSB, \b UCSSELx and
//! \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return STATUS_SUCCESS
//
//*****************************************************************************
void EUSCI_SPI_masterInit(uint16_t baseAddress,
uint8_t selectClockSource,
uint32_t clockSourceFrequency,
uint32_t desiredSpiClock,
uint16_t msbFirst,
uint16_t clockPhase,
uint16_t clockPolarity,
uint16_t spiMode
)
{
EUSCI_SPI_initMasterParam param = { 0 };
param.selectClockSource = selectClockSource;
param.clockSourceFrequency = clockSourceFrequency;
param.desiredSpiClock = desiredSpiClock;
param.msbFirst = msbFirst;
param.clockPhase = clockPhase;
param.clockPolarity = clockPolarity;
param.spiMode = spiMode;
EUSCI_SPI_initMaster(baseAddress, ¶m);
}
//*****************************************************************************
//
//! \brief Initializes the SPI Master block.
//!
//! Upon successful initialization of the SPI master block, this function will
//! have set the bus speed for the master, but the SPI Master block still
//! remains disabled and must be enabled with EUSCI_SPI_enable()
//!
//! \param baseAddress is the base address of the EUSCI_SPI Master module.
//! \param param is the pointer to struct for master initialization.
//!
//! Modified bits are \b UCCKPH, \b UCCKPL, \b UC7BIT, \b UCMSB, \b UCSSELx and
//! \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return STATUS_SUCCESS
//
//*****************************************************************************
void EUSCI_SPI_initMaster(uint16_t baseAddress,
EUSCI_SPI_initMasterParam *param)
{
assert(param != 0);
assert(
(EUSCI_SPI_CLOCKSOURCE_ACLK == param->selectClockSource) ||
(EUSCI_SPI_CLOCKSOURCE_SMCLK == param->selectClockSource)
);
assert((EUSCI_SPI_MSB_FIRST == param->msbFirst) ||
(EUSCI_SPI_LSB_FIRST == param->msbFirst)
);
assert((EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT == param->clockPhase) ||
(EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT == param->clockPhase)
);
assert((EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH == param->clockPolarity) ||
(EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW == param->clockPolarity)
);
assert(
(EUSCI_SPI_3PIN == param->spiMode) ||
(EUSCI_SPI_4PIN_UCxSTE_ACTIVE_HIGH == param->spiMode) ||
(EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW == param->spiMode)
);
//Disable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST;
//Reset OFS_UCAxCTLW0 values
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCCKPH + UCCKPL + UC7BIT + UCMSB +
UCMST + UCMODE_3 + UCSYNC);
//Reset OFS_UCAxCTLW0 values
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSSEL_3);
//Select Clock
HWREG16(baseAddress + OFS_UCAxCTLW0) |= param->selectClockSource;
HWREG16(baseAddress + OFS_UCAxBRW) =
(uint16_t)(param->clockSourceFrequency / param->desiredSpiClock);
/*
* Configure as SPI master mode.
* Clock phase select, polarity, msb
* UCMST = Master mode
* UCSYNC = Synchronous mode
* UCMODE_0 = 3-pin SPI
*/
HWREG16(baseAddress + OFS_UCAxCTLW0) |= (
param->msbFirst +
param->clockPhase +
param->clockPolarity +
UCMST +
UCSYNC +
param->spiMode
);
//No modulation
HWREG16(baseAddress + OFS_UCAxMCTLW) = 0;
}
//*****************************************************************************
//
//! \brief Selects 4Pin Functionality
//!
//! This function should be invoked only in 4-wire mode. Invoking this function
//! has no effect in 3-wire mode.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param select4PinFunctionality selects 4 pin functionality
//! Valid values are:
//! - \b EUSCI_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS
//! - \b EUSCI_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE
//!
//! Modified bits are \b UCSTEM of \b UCAxCTLW0 register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_select4PinFunctionality(uint16_t baseAddress,
uint8_t select4PinFunctionality
)
{
assert( (EUSCI_SPI_PREVENT_CONFLICTS_WITH_OTHER_MASTERS == select4PinFunctionality) ||
(EUSCI_SPI_ENABLE_SIGNAL_FOR_4WIRE_SLAVE == select4PinFunctionality)
);
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~UCSTEM;
HWREG16(baseAddress + OFS_UCAxCTLW0) |= select4PinFunctionality;
}
//*****************************************************************************
//
//! \brief DEPRECATED - Initializes the SPI Master clock. At the end of this
//! function call, SPI module is left enabled.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param clockSourceFrequency is the frequency of the selected clock source
//! \param desiredSpiClock is the desired clock rate for SPI communication
//!
//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_masterChangeClock(uint16_t baseAddress,
uint32_t clockSourceFrequency,
uint32_t desiredSpiClock
)
{
EUSCI_SPI_changeMasterClockParam param = { 0 };
param.clockSourceFrequency = clockSourceFrequency;
param.desiredSpiClock = desiredSpiClock;
EUSCI_SPI_changeMasterClock(baseAddress, ¶m);
}
//*****************************************************************************
//
//! \brief Initializes the SPI Master clock. At the end of this function call,
//! SPI module is left enabled.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param param is the pointer to struct for master clock setting.
//!
//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_changeMasterClock(uint16_t baseAddress,
EUSCI_SPI_changeMasterClockParam *param)
{
assert(param != 0);
//Disable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST;
HWREG16(baseAddress + OFS_UCAxBRW) =
(uint16_t)(param->clockSourceFrequency / param->desiredSpiClock);
//Reset the UCSWRST bit to enable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST);
}
//*****************************************************************************
//
//! \brief DEPRECATED - Initializes the SPI Slave block.
//!
//! Upon successful initialization of the SPI slave block, this function will
//! have initialized the slave block, but the SPI Slave block still remains
//! disabled and must be enabled with EUSCI_SPI_enable()
//!
//! \param baseAddress is the base address of the EUSCI_SPI Slave module.
//! \param msbFirst controls the direction of the receive and transmit shift
//! register.
//! Valid values are:
//! - \b EUSCI_SPI_MSB_FIRST
//! - \b EUSCI_SPI_LSB_FIRST [Default]
//! \param clockPhase is clock phase select.
//! Valid values are:
//! - \b EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default]
//! - \b EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT
//! \param clockPolarity is clock polarity select
//! Valid values are:
//! - \b EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH
//! - \b EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default]
//! \param spiMode is SPI mode select
//! Valid values are:
//! - \b EUSCI_SPI_3PIN
//! - \b EUSCI_SPI_4PIN_UCxSTE_ACTIVE_HIGH
//! - \b EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW
//!
//! Modified bits are \b UCMSB, \b UCMST, \b UC7BIT, \b UCCKPL, \b UCCKPH, \b
//! UCMODE and \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return STATUS_SUCCESS
//
//*****************************************************************************
void EUSCI_SPI_slaveInit(uint16_t baseAddress,
uint16_t msbFirst,
uint16_t clockPhase,
uint16_t clockPolarity,
uint16_t spiMode
)
{
EUSCI_SPI_initSlaveParam param = { 0 };
param.msbFirst = msbFirst;
param.clockPhase = clockPhase;
param.clockPolarity = clockPolarity;
param.spiMode = spiMode;
EUSCI_SPI_initSlave(baseAddress, ¶m);
}
//*****************************************************************************
//
//! \brief Initializes the SPI Slave block.
//!
//! Upon successful initialization of the SPI slave block, this function will
//! have initialized the slave block, but the SPI Slave block still remains
//! disabled and must be enabled with EUSCI_SPI_enable()
//!
//! \param baseAddress is the base address of the EUSCI_SPI Slave module.
//! \param param is the pointer to struct for slave initialization.
//!
//! Modified bits are \b UCMSB, \b UCMST, \b UC7BIT, \b UCCKPL, \b UCCKPH, \b
//! UCMODE and \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return STATUS_SUCCESS
//
//*****************************************************************************
void EUSCI_SPI_initSlave(uint16_t baseAddress, EUSCI_SPI_initSlaveParam *param)
{
assert(param != 0);
assert(
(EUSCI_SPI_MSB_FIRST == param->msbFirst) ||
(EUSCI_SPI_LSB_FIRST == param->msbFirst)
);
assert(
(EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT == param->clockPhase) ||
(EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT == param->clockPhase)
);
assert(
(EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH == param->clockPolarity) ||
(EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW == param->clockPolarity)
);
assert(
(EUSCI_SPI_3PIN == param->spiMode) ||
(EUSCI_SPI_4PIN_UCxSTE_ACTIVE_HIGH == param->spiMode) ||
(EUSCI_SPI_4PIN_UCxSTE_ACTIVE_LOW == param->spiMode)
);
//Disable USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST;
//Reset OFS_UCAxCTLW0 register
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCMSB +
UC7BIT +
UCMST +
UCCKPL +
UCCKPH +
UCMODE_3
);
//Clock polarity, phase select, msbFirst, SYNC, Mode0
HWREG16(baseAddress + OFS_UCAxCTLW0) |= (param->clockPhase +
param->clockPolarity +
param->msbFirst +
UCSYNC +
param->spiMode
);
}
//*****************************************************************************
//
//! \brief Changes the SPI clock phase and polarity. At the end of this
//! function call, SPI module is left enabled.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param clockPhase is clock phase select.
//! Valid values are:
//! - \b EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT [Default]
//! - \b EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT
//! \param clockPolarity is clock polarity select
//! Valid values are:
//! - \b EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH
//! - \b EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW [Default]
//!
//! Modified bits are \b UCCKPL, \b UCCKPH and \b UCSWRST of \b UCAxCTLW0
//! register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_changeClockPhasePolarity(uint16_t baseAddress,
uint16_t clockPhase,
uint16_t clockPolarity
)
{
assert( (EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_HIGH == clockPolarity) ||
(EUSCI_SPI_CLOCKPOLARITY_INACTIVITY_LOW == clockPolarity)
);
assert( (EUSCI_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT == clockPhase) ||
(EUSCI_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT == clockPhase)
);
//Disable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST;
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCCKPH + UCCKPL);
HWREG16(baseAddress + OFS_UCAxCTLW0) |= (
clockPhase +
clockPolarity
);
//Reset the UCSWRST bit to enable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST);
}
//*****************************************************************************
//
//! \brief Transmits a byte from the SPI Module.
//!
//! This function will place the supplied data into SPI transmit data register
//! to start transmission.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param transmitData data to be transmitted from the SPI module
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_transmitData( uint16_t baseAddress,
uint8_t transmitData
)
{
HWREG16(baseAddress + OFS_UCAxTXBUF) = transmitData;
}
//*****************************************************************************
//
//! \brief Receives a byte that has been sent to the SPI Module.
//!
//! This function reads a byte of data from the SPI receive data Register.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//!
//! \return Returns the byte received from by the SPI module, cast as an
//! uint8_t.
//
//*****************************************************************************
uint8_t EUSCI_SPI_receiveData(uint16_t baseAddress)
{
return HWREG16(baseAddress + OFS_UCAxRXBUF);
}
//*****************************************************************************
//
//! \brief Enables individual SPI interrupt sources.
//!
//! Enables the indicated SPI interrupt sources. Only the sources that are
//! enabled can be reflected to the processor interrupt; disabled sources have
//! no effect on the processor. Does not clear interrupt flags.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param mask is the bit mask of the interrupt sources to be enabled.
//! Mask value is the logical OR of any of the following:
//! - \b EUSCI_SPI_TRANSMIT_INTERRUPT
//! - \b EUSCI_SPI_RECEIVE_INTERRUPT
//!
//! Modified bits of \b UCAxIFG register and bits of \b UCAxIE register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_enableInterrupt(uint16_t baseAddress,
uint8_t mask
)
{
assert(!(mask & ~(EUSCI_SPI_RECEIVE_INTERRUPT
| EUSCI_SPI_TRANSMIT_INTERRUPT)));
HWREG16(baseAddress + OFS_UCAxIE) |= mask;
}
//*****************************************************************************
//
//! \brief Disables individual SPI interrupt sources.
//!
//! Disables the indicated SPI interrupt sources. Only the sources that are
//! enabled can be reflected to the processor interrupt; disabled sources have
//! no effect on the processor.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param mask is the bit mask of the interrupt sources to be disabled.
//! Mask value is the logical OR of any of the following:
//! - \b EUSCI_SPI_TRANSMIT_INTERRUPT
//! - \b EUSCI_SPI_RECEIVE_INTERRUPT
//!
//! Modified bits of \b UCAxIE register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_disableInterrupt(uint16_t baseAddress,
uint8_t mask
)
{
assert(!(mask & ~(EUSCI_SPI_RECEIVE_INTERRUPT
| EUSCI_SPI_TRANSMIT_INTERRUPT)));
HWREG16(baseAddress + OFS_UCAxIE) &= ~mask;
}
//*****************************************************************************
//
//! \brief Gets the current SPI interrupt status.
//!
//! This returns the interrupt status for the SPI module based on which flag is
//! passed.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param mask is the masked interrupt flag status to be returned.
//! Mask value is the logical OR of any of the following:
//! - \b EUSCI_SPI_TRANSMIT_INTERRUPT
//! - \b EUSCI_SPI_RECEIVE_INTERRUPT
//!
//! \return Logical OR of any of the following:
//! - \b EUSCI_SPI_TRANSMIT_INTERRUPT
//! - \b EUSCI_SPI_RECEIVE_INTERRUPT
//! \n indicating the status of the masked interrupts
//
//*****************************************************************************
uint8_t EUSCI_SPI_getInterruptStatus(uint16_t baseAddress,
uint8_t mask
)
{
assert(!(mask & ~(EUSCI_SPI_RECEIVE_INTERRUPT
| EUSCI_SPI_TRANSMIT_INTERRUPT)));
return HWREG16(baseAddress + OFS_UCAxIFG) & mask;
}
//*****************************************************************************
//
//! \brief Clears the selected SPI interrupt status flag.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//! \param mask is the masked interrupt flag to be cleared.
//! Mask value is the logical OR of any of the following:
//! - \b EUSCI_SPI_TRANSMIT_INTERRUPT
//! - \b EUSCI_SPI_RECEIVE_INTERRUPT
//!
//! Modified bits of \b UCAxIFG register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_clearInterruptFlag(uint16_t baseAddress,
uint8_t mask
)
{
assert(!(mask & ~(EUSCI_SPI_RECEIVE_INTERRUPT
| EUSCI_SPI_TRANSMIT_INTERRUPT)));
HWREG16(baseAddress + OFS_UCAxIFG) &= ~mask;
}
//*****************************************************************************
//
//! \brief Enables the SPI block.
//!
//! This will enable operation of the SPI block.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//!
//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_enable(uint16_t baseAddress)
{
//Reset the UCSWRST bit to enable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) &= ~(UCSWRST);
}
//*****************************************************************************
//
//! \brief Disables the SPI block.
//!
//! This will disable operation of the SPI block.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//!
//! Modified bits are \b UCSWRST of \b UCAxCTLW0 register.
//!
//! \return None
//
//*****************************************************************************
void EUSCI_SPI_disable(uint16_t baseAddress)
{
//Set the UCSWRST bit to disable the USCI Module
HWREG16(baseAddress + OFS_UCAxCTLW0) |= UCSWRST;
}
//*****************************************************************************
//
//! \brief Returns the address of the RX Buffer of the SPI for the DMA module.
//!
//! Returns the address of the SPI RX Buffer. This can be used in conjunction
//! with the DMA to store the received data directly to memory.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//!
//! \return the address of the RX Buffer
//
//*****************************************************************************
uint32_t EUSCI_SPI_getReceiveBufferAddress(uint16_t baseAddress)
{
return baseAddress + OFS_UCAxRXBUF;
}
//*****************************************************************************
//
//! \brief Returns the address of the TX Buffer of the SPI for the DMA module.
//!
//! Returns the address of the SPI TX Buffer. This can be used in conjunction
//! with the DMA to obtain transmitted data directly from memory.
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//!
//! \return the address of the TX Buffer
//
//*****************************************************************************
uint32_t EUSCI_SPI_getTransmitBufferAddress(uint16_t baseAddress)
{
return baseAddress + OFS_UCAxTXBUF;
}
//*****************************************************************************
//
//! \brief Indicates whether or not the SPI bus is busy.
//!
//! This function returns an indication of whether or not the SPI bus is
//! busy.This function checks the status of the bus via UCBBUSY bit
//!
//! \param baseAddress is the base address of the EUSCI_SPI module.
//!
//! \return One of the following:
//! - \b EUSCI_SPI_BUSY
//! - \b EUSCI_SPI_NOT_BUSY
//! \n indicating if the EUSCI_SPI is busy
//
//*****************************************************************************
uint16_t EUSCI_SPI_isBusy(uint16_t baseAddress)
{
//Return the bus busy status.
return HWREG16(baseAddress + OFS_UCAxSTATW) & UCBUSY;
}
#endif
//*****************************************************************************
//
//! Close the doxygen group for eusci_spi_api
//! @}
//
//*****************************************************************************
| {
"content_hash": "6625fff0cbf5166ddda977517957a959",
"timestamp": "",
"source": "github",
"line_count": 661,
"max_line_length": 95,
"avg_line_length": 38.69894099848714,
"alnum_prop": 0.5028537920250196,
"repo_name": "vf42/Mikroproc_Labs_MSP-EXP430F5438",
"id": "e9fbab860f2dfe7c77feeef98e4ba659220753fc",
"size": "27257",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "driverlib/MSP430F5xx_6xx/eusci_spi.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2535855"
},
{
"name": "C++",
"bytes": "470029"
},
{
"name": "Shell",
"bytes": "13832"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_today"
android:orderInCategory="100"
android:title="@string/action_today"
app:showAsAction="always" />
<item
android:id="@+id/action_select_date"
android:orderInCategory="50"
android:title="@string/action_select_date"
app:showAsAction="never" />
</menu> | {
"content_hash": "5e38a39682f21daad6e55189a21a7d4b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 64,
"avg_line_length": 30.529411764705884,
"alnum_prop": 0.630057803468208,
"repo_name": "FlyingOsred/AndroidSimplePerpetualCalendar",
"id": "dd53d11de6cfc32477160001fbe1caa18042270c",
"size": "519",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/menu/menu_fragment_month_view.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "79827"
}
],
"symlink_target": ""
} |
@interface PodsDummy_Pods_LPCarouselViewSample : NSObject
@end
@implementation PodsDummy_Pods_LPCarouselViewSample
@end
| {
"content_hash": "d7ef8fb88271b560210dcf5e45ce44e5",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 57,
"avg_line_length": 30,
"alnum_prop": 0.8583333333333333,
"repo_name": "litt1e-p/LPCarouselView",
"id": "b7926eab51465639fa10be71e4efb14d78b3a25b",
"size": "154",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LPCarouselViewSample/Pods/Target Support Files/Pods-LPCarouselViewSample/Pods-LPCarouselViewSample-dummy.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "234222"
},
{
"name": "Ruby",
"bytes": "1024"
},
{
"name": "Shell",
"bytes": "8511"
}
],
"symlink_target": ""
} |
from google.appengine.ext import db
from hashlib import sha224
class Group(db.Model):
name = db.StringProperty(required=True)
# All memberships of a group in no particular order
@property
def memberships(self):
ret = Membership.gql("WHERE group = :1", self)
return ret.fetch(10000)
class Membership(db.Model):
user = db.UserProperty(required=True)
group = db.ReferenceProperty(Group)
balance = db.FloatProperty(required=True)
# The alias of the group name
alias = db.StringProperty()
# The nickname of the user in the group
nickname = db.StringProperty()
# The alias of the group name, or the group name if the
# alias is not defined
@property
def groupNick(self):
if self.alias and self.alias != "":
return self.alias
else:
return self.group.name
# The nickname of the user in the group, or the user's nickname
# if the membership's nickname is not defined
@property
def userNick(self):
if self.nickname and self.nickname != "":
return self.nickname
else:
return self.user.nickname()
class Transaction(db.Model):
group = db.ReferenceProperty(Group)
type = db.StringProperty(required=True, choices=set(["debt", "payment", "rejectedDebt", "rejectedPayment"]))
amount = db.FloatProperty(required=True)
reason = db.StringProperty()
isRejected = db.BooleanProperty()
date = db.DateTimeProperty(auto_now_add=True)
creatorMember = db.ReferenceProperty(Membership, collection_name="creatorMember_collection_name")
fromMember = db.ReferenceProperty(Membership, collection_name="fromMember_collection_name")
toMember = db.ReferenceProperty(Membership, collection_name="toMember_collection_name")
@property
def creator(self):
if self.creatorMember:
return self.creatorMember.user
else:
return None
@property
def fromUser(self):
if self.fromMember:
return self.fromMember.user
else:
return None
@property
def toUser(self):
if self.toMember:
return self.toMember.user
else:
return None
@property
def isRejectable(self):
return (self.type == "debt" or self.type == "payment") and not(self.isRejected)
@property
def hash(self):
m = sha224()
m.update(str(self.key()))
m.update(self.creator.email())
m.update(self.fromUser.email())
m.update(self.toUser.email())
m.update(self.type)
m.update(str(self.date))
return m.hexdigest()
def isValidHash(self, hash):
return self.hash == hash
def getCompensateFor(self, user):
if user == self.fromUser:
creatorMember = self.fromMember
else:
creatorMember = self.toMember
return Transaction(
group = self.group,
type = self.getCompensateType(self.type),
amount = self.amount,
reason = self.reason,
isRejected = False,
creatorMember = creatorMember,
fromMember = self.fromMember,
toMember = self.toMember
)
def getCompensateType(self, type):
if type == 'debt':
return 'rejectedDebt'
else:
return 'rejectedPayment' | {
"content_hash": "937115ab390d3b5562ab12e4dbbda811",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 109,
"avg_line_length": 27.04385964912281,
"alnum_prop": 0.6853713915017839,
"repo_name": "manastech/de-bee",
"id": "1d1a12bb7e258c27e0ef86e3508cd5b461ba0a2d",
"size": "3083",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "model.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5995"
},
{
"name": "CSS",
"bytes": "7772"
},
{
"name": "HTML",
"bytes": "28332"
},
{
"name": "JavaScript",
"bytes": "11995"
},
{
"name": "Python",
"bytes": "2412803"
}
],
"symlink_target": ""
} |
<?php
use Jchck\Excerpt;
/**
* (just) one thing
*
* The WordPress Query class.
* @link http://codex.wordpress.org/Function_Reference/WP_Query
*
*/
$args = array(
//Category Parameters
'category_name' => '1-thing',
//Type & Status Parameters
'post_type' => 'post',
//'post_status' => 'any',
//Order & Orderby Parameters
'order' => 'DESC',
'orderby' => 'date',
//Pagination Parameters
'posts_per_page' => 5,
'posts_per_archive_page' => 5
);
$one_query = new WP_Query( $args ); ?>
<div class="flex flex-wrap justify-center col-12">
<div class="col-12 sm-col-10 md-col-8 lg-col-6">
<h1 class="h1-fp mt0 mb1 center">1 Thing</h1>
<p class="h2">A weekly email on just one thing that's happened in the past seven days.
That's it, just minimalist reflections on the life of one creative.
(That's me.)
Want to try 1 Thing?
I need just 2 things from you first.</p>
<!-- Begin MailChimp Signup Form -->
<div id="mc_embed_signup">
<form action="//justinchick.us11.list-manage.com/subscribe/post?u=7e25f7d87fbbfde66043d4b76&id=3fda13180b" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="one-thing pb4 validate" target="_blank" novalidate>
<div class="flex flex-wrap" id="mc_embed_signup_scroll">
<div class="col-12 sm-col-6 relative mb3 pr0 sm-pr1 mc-field-group">
<input type="text" value="" name="FNAME" class="block h3 p1 border-bottom border-width-skinny bg-white" id="mce-FNAME" required>
<span class="highlight absolute col-12 left-0"></span>
<span class="bar relative block"></span>
<label class="h4 absolute" for="mce-FNAME">Name</label>
</div>
<div class="col-12 sm-col-6 relative mb3 mc-field-group">
<input type="email" value="" name="EMAIL" class="block h3 p1 border-bottom border-width-skinny bg-white required email" id="mce-EMAIL" required>
<span class="highlight absolute col-12 left-0"></span>
<span class="bar relative block"></span>
<label class="h4 absolute" for="mce-EMAIL">Email</label>
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_7e25f7d87fbbfde66043d4b76_3fda13180b" tabindex="-1" value="">
</div>
<div class="col-12 center">
<input type="submit" value="Yes, please" name="subscribe" id="mc-embedded-subscribe" class="btn btn-mnml">
</div>
</div>
</form>
</div>
<!--End mc_embed_signup-->
<?php if ( $one_query->have_posts()) : ?>
<h2 class="h2-fp center">Recient Things</h2>
<?php while ( $one_query->have_posts()) : $one_query->the_post(); ?>
<article class="col-12">
<h2 class="mt0 pt2 bold border-top border-width-skinny"><a href="<?= the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?= Excerpt\excerpt(); ?>
</article>
<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>
</div>
</div>
| {
"content_hash": "cd1f815e4082809e95efb47290c0f09d",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 252,
"avg_line_length": 31.58490566037736,
"alnum_prop": 0.6251493428912783,
"repo_name": "jchck/jchck_",
"id": "e372997029cd40fa55f8e24cb9818c457c483063",
"size": "3348",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "page-one-thing.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11340"
},
{
"name": "JavaScript",
"bytes": "3530"
},
{
"name": "PHP",
"bytes": "64647"
}
],
"symlink_target": ""
} |
#ifndef __RESERVERMAIN_H__
#define __RESERVERMAIN_H__
#include <app.h>
#include <Elementary.h>
#include <system_settings.h>
#include <efl_extension.h>
#include <dlog.h>
#include "OCPlatform.h"
#include "OCApi.h"
using namespace OC;
#ifdef LOG_TAG
#undef LOG_TAG
#endif
#define LOG_TAG "reservermain"
#if !defined(PACKAGE)
#define PACKAGE "org.tizen.resampleserver"
#endif
#define ELM_DEMO_EDJ "opt/usr/apps/org.tizen.resampleserver/res/ui_controls.edj"
void start_server(void *data, Evas_Object *obj, void *event_info);
void start_server_cb(void *data, Evas_Object *obj, void *event_info);
#endif // __RESERVERMAIN_H__
| {
"content_hash": "93140a1f4b70555e77de7feb74a52fe5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 80,
"avg_line_length": 19.75,
"alnum_prop": 0.7231012658227848,
"repo_name": "WojciechLuczkow/iotivity",
"id": "9a804ab91373b378cc1f97047997ced911a07d7e",
"size": "1398",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "service/resource-encapsulation/examples/tizen/RESampleServerApp/inc/reservermain.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Arduino",
"bytes": "2338"
},
{
"name": "Batchfile",
"bytes": "641"
},
{
"name": "C",
"bytes": "9970205"
},
{
"name": "C++",
"bytes": "5155255"
},
{
"name": "CMake",
"bytes": "14845"
},
{
"name": "CSS",
"bytes": "19388"
},
{
"name": "Groff",
"bytes": "2808"
},
{
"name": "HTML",
"bytes": "481757"
},
{
"name": "Java",
"bytes": "1091109"
},
{
"name": "JavaScript",
"bytes": "17194"
},
{
"name": "Makefile",
"bytes": "47804"
},
{
"name": "Perl",
"bytes": "13289"
},
{
"name": "Python",
"bytes": "546860"
},
{
"name": "Shell",
"bytes": "364986"
}
],
"symlink_target": ""
} |
package com.ideaknow.api.client.model.transfer;
import android.os.Parcel;
import android.os.Parcelable;
public class BeneficiaryResultModel implements Parcelable{
BeneficiaryModel beneficiary;
public BeneficiaryResultModel() {
}
public BeneficiaryModel getBeneficiary() {
return beneficiary;
}
public void setBeneficiary(BeneficiaryModel beneficiary) {
this.beneficiary = beneficiary;
}
@Override
public String toString() {
return "BeneficiaryResultModel{" +
"beneficiary=" + beneficiary +
'}';
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(this.beneficiary, 0);
}
private BeneficiaryResultModel(Parcel in) {
this.beneficiary = in.readParcelable(BeneficiaryModel.class.getClassLoader());
}
public static Creator<BeneficiaryResultModel> CREATOR = new Creator<BeneficiaryResultModel>() {
public BeneficiaryResultModel createFromParcel(Parcel source) {
return new BeneficiaryResultModel(source);
}
public BeneficiaryResultModel[] newArray(int size) {
return new BeneficiaryResultModel[size];
}
};
}
| {
"content_hash": "936dd7174fb44487c1d49c0d2fd74280",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 99,
"avg_line_length": 25.823529411764707,
"alnum_prop": 0.6681852695520122,
"repo_name": "kjohnson93/BSabadell",
"id": "7014caf983b73c11cd634c8c202a5a195cd74a84",
"size": "1317",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "idk-api-client/src/main/java/com/ideaknow/api/client/model/transfer/BeneficiaryResultModel.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1298548"
}
],
"symlink_target": ""
} |
Vec3d WorldOffset::local_to_world(const Vec3 &p) const
{
return offset + ToVec3d(p);
}
bool WorldOffset::player_position_update(const Vec3 &p, Vec3 *diff)
{
const Vec3i player_chunk_largest = point_to_chunk(p, LAST_LOD);
if (player_chunk_largest != Vec3i(0)) {
const Vec3 largest_size = chunk_size(LAST_LOD);
offset += ToVec3d(player_chunk_largest) * ToVec3d(largest_size);
if (diff)
*diff = -ToVec3(player_chunk_largest) * largest_size;
return true;
} else {
return false;
}
}
| {
"content_hash": "506f732aef482e14acd102b029eee27f",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 67,
"avg_line_length": 27.61111111111111,
"alnum_prop": 0.6941649899396378,
"repo_name": "nsf/nextgame",
"id": "22444fccd1fd68dfd757e084e056612af40a26ee",
"size": "580",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/Geometry/WorldOffset.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "573146"
},
{
"name": "C++",
"bytes": "491178"
},
{
"name": "Lua",
"bytes": "234958"
},
{
"name": "Objective-C",
"bytes": "3652"
},
{
"name": "Shell",
"bytes": "434"
}
],
"symlink_target": ""
} |
<?php
namespace N98\Util\Console\Helper;
use Magento\Framework\ObjectManager\ObjectManager;
use Symfony\Component\Console\Helper\Helper as AbstractHelper;
class InjectionHelper extends AbstractHelper
{
/**
* Returns the canonical name of this helper.
*
* @return string The canonical name
*
* @api
*/
public function getName()
{
return 'injection';
}
/**
* @param Object $object
* @param string $methodName
*/
public function methodInjection($object, $methodName, ObjectManager $objectManager)
{
$parameters = $this->getMethod($object, $methodName);
$argumentsToInject = [];
foreach ($parameters as $parameter) {
$argumentsToInject[] = $objectManager->get($parameter[1]);
}
call_user_func_array([$object, $methodName], $argumentsToInject);
}
/**
* Read class constructor signature
*
* @param Object $object
* @param string $methodName
* @return array|null
* @throws \ReflectionException
*/
protected function getMethod($object, $methodName)
{
$object = new \ReflectionObject($object);
$result = null;
$method = $object->getMethod($methodName);
if ($method) {
$result = [];
/** @var $parameter \ReflectionParameter */
foreach ($method->getParameters() as $parameter) {
try {
$result[] = [
$parameter->getName(),
$parameter->getClass() !== null ? $parameter->getClass()->getName() : null,
!$parameter->isOptional(),
$parameter->isOptional()
? ($parameter->isDefaultValueAvailable() ? $parameter->getDefaultValue() : null)
: null,
];
} catch (\ReflectionException $e) {
$message = $e->getMessage();
throw new \ReflectionException($message, 0, $e);
}
}
}
return $result;
}
}
| {
"content_hash": "caeb43ebf3e594f0d9cd2fff72eb1c76",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 29.356164383561644,
"alnum_prop": 0.5272981801213252,
"repo_name": "p-makowski/n98-magerun2",
"id": "ed9e83f49d63f37baf1529adc2089f38118876f2",
"size": "2143",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/N98/Util/Console/Helper/InjectionHelper.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "5078"
},
{
"name": "PHP",
"bytes": "612463"
},
{
"name": "Shell",
"bytes": "22628"
}
],
"symlink_target": ""
} |
import axios from "axios";
import cheerio from "cheerio";
import Event from "./event";
const debug = require("debug")("bot:yokohama-arena");
class YokohamaArena{
constructor(){
this.url = "https://www.yokohama-arena.co.jp"
}
async getEvents(){
const html = await this.getHtml();
return this.parseHtml(html);
}
async getMajorEvents(){
const events = await this.getEvents();
return events.filter((i) => { return !(/設営日/.test(i.title)) });
}
async getHtml(){
debug(`get ${this.url}`);
return (await axios.get(this.url)).data;
}
parseHtml (html) {
const $ = cheerio.load(html);
const lis = $('.event_scheduleArea li');
const events = []
lis.each((i, el) => {
let event = new Event()
let $ = cheerio.load(el);
event.title = $('strong').text().trim();
if (!event.title) throw new Error('cannot get title');
event.where = '横浜アリーナ';
let [, year, month, date] = $('.date-display-single').text().match(/(\d{4})\.(\d{2})\.(\d{2})/) || [];
if (!year || !month || !date) throw new Error('cannot get Date');
event.date = new Date(year, month - 1, date);
let [, openAt] = $('p').text().match(/開場:([^\s]+)/m) || [];
if (openAt) event.note += `開場${openAt}`
let [, startAt] = $('p').text().match(/開演:([^\s]+)/m) || [];
if (startAt) event.note += ` 開演${startAt}`
events.push(event);
debug(event);
})
return events;
}
}
export default new YokohamaArena;
if(process.argv[1] === __filename){
const arena = new YokohamaArena();
(async function(){
console.log(await arena.getMajorEvents());
})().catch((err) => {
console.error(err.stack || err)
});
}
| {
"content_hash": "7de723dd8def0c729f6957aff7a34102",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 108,
"avg_line_length": 28.45,
"alnum_prop": 0.5682483889865261,
"repo_name": "shokai/neoyokohama-bot",
"id": "9f45373d5fb6aabe5a9b24075b02012ed500f30f",
"size": "1745",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/yokohama-arena.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "12513"
}
],
"symlink_target": ""
} |
.plugin-skin-glob-bar {
display: block;
}
| {
"content_hash": "0c45269ed65252fe95731f73d4840508",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 23,
"avg_line_length": 14.666666666666666,
"alnum_prop": 0.6590909090909091,
"repo_name": "igoynawamreh/blogger-starter",
"id": "3e6acb19b6c95377ec391162ab7d08289660f301",
"size": "44",
"binary": false,
"copies": "1",
"ref": "refs/heads/dependabot/npm_and_yarn/minimist-1.2.6",
"path": "packages/bloggerpack/test/plugin/node_modules/plugin-skin/glob/bar.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "19524"
},
{
"name": "JavaScript",
"bytes": "2732"
}
],
"symlink_target": ""
} |
@interface JXInteractiveTransition ()
@property (nonatomic, weak) UIViewController *vc;//这里要用weak,不能用strong,不然无法释放
@property (nonatomic, assign) JXInteractiveTransitionType type;
@property (nonatomic, assign) JXInteractiveTransitionGestureDirection direction;
@end
@implementation JXInteractiveTransition
+ (instancetype)interactiveTransitionWithTransitionType:(JXInteractiveTransitionType)type gestureDirection:(JXInteractiveTransitionGestureDirection)direction
{
return [[self alloc] initWithTransitionType:type gestureDirection:direction];
}
- (instancetype)initWithTransitionType:(JXInteractiveTransitionType)type gestureDirection:(JXInteractiveTransitionGestureDirection)direction
{
self = [super init];
if (self) {
self.type = type;
self.direction = direction;
}
return self;
}
- (void)addGestureForViewController:(UIViewController *)viewController
{
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
self.vc = viewController;
[viewController.view addGestureRecognizer:pan];
}
- (void)handleGesture:(UIPanGestureRecognizer *)pan
{
CGFloat percent = 0;
CGFloat width = WindowSize.width;
switch (self.direction) {
case JXInteractiveTransitionGestureDirectionLeft:
{
CGFloat transitionX = -[pan translationInView:pan.view].x;
percent = transitionX/width;
}
break;
case JXInteractiveTransitionGestureDirectionRight:
{
CGFloat transitionX = [pan translationInView:pan.view].x;
percent = transitionX/width;
}
break;
case JXInteractiveTransitionGestureDirectionUp:
{
CGFloat transitionY = -[pan translationInView:pan.view].y;
percent = transitionY/width;
}
break;
case JXInteractiveTransitionGestureDirectionDown:
{
CGFloat transitionY = [pan translationInView:pan.view].y;
percent = transitionY/width;
}
break;
default:
break;
}
switch (pan.state) {
case UIGestureRecognizerStateBegan:
{
//isInteraction如果为YES表示触发了手势,用百分比手势进行交互,反之就返回nil,直接进行转场操作
self.isInteraction = YES;
//startGesture 表示转场进行何种操作(present\dismiss\push\pop)这些操作看作一个复杂的动画,然后由手势百分比对这个动画进行进度调整
[self startGesture];
}
break;
case UIGestureRecognizerStateChanged:
{
//根据手势百分比更新转场动画进度,在此手势交互状态不要调用[self cancelInteractiveTransition];
[self updateInteractiveTransition:percent];
}
break;
case UIGestureRecognizerStateCancelled:
case UIGestureRecognizerStateEnded:
{
self.isInteraction = NO;
//这里的finish和cancel影响,transition自定义转场动画的transitionWasCancelled
if (percent > 0.5) {
[self finishInteractiveTransition];
}else {
[self cancelInteractiveTransition];
}
}
break;
default:
break;
}
}
- (void)startGesture
{
switch (self.type) {
case JXInteractiveTransitionTypePresent:
{
if (self.presentConfig) {
self.presentConfig();
}
}
break;
case JXInteractiveTransitionTypeDismiss:
{
[_vc dismissViewControllerAnimated:YES completion:nil];
}
break;
case JXInteractiveTransitionTypePush:
{
if (self.pushConfig) {
self.pushConfig();
}
}
break;
case JXInteractiveTransitionTypePop:
{
[_vc.navigationController popViewControllerAnimated:YES];
}
break;
default:
break;
}
}
@end
| {
"content_hash": "b3044344ddfa71695c3947400de9bb8b",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 157,
"avg_line_length": 30.23076923076923,
"alnum_prop": 0.6221374045801527,
"repo_name": "pujiaxin33/JXTransition",
"id": "7c7d3bd999117fb7aa84d76c5e10570060598b39",
"size": "4400",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "JXNavigationTransition/JXInteractiveTransition.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "144554"
}
],
"symlink_target": ""
} |
using System;
namespace LinqToDB.SqlQuery
{
public class WalkOptions
{
public WalkOptions()
{
}
public WalkOptions(bool skipColumns)
{
SkipColumns = skipColumns;
}
public bool SkipColumns;
public bool ProcessParent;
}
public interface ISqlExpressionWalkable
{
ISqlExpression Walk(WalkOptions options, Func<ISqlExpression,ISqlExpression> func);
}
}
| {
"content_hash": "9636ab50fbef887a7755574176ad597a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 85,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.698019801980198,
"repo_name": "ronnyek/linq2db",
"id": "b9e47ebcd36850257731e834816c22c9652b45ee",
"size": "406",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/LinqToDB/SqlQuery/ISqlExpressionWalkable.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "3757"
},
{
"name": "C#",
"bytes": "10017750"
},
{
"name": "F#",
"bytes": "10476"
},
{
"name": "PLSQL",
"bytes": "22533"
},
{
"name": "PLpgSQL",
"bytes": "31781"
},
{
"name": "PowerShell",
"bytes": "6708"
},
{
"name": "SQLPL",
"bytes": "8458"
},
{
"name": "Visual Basic",
"bytes": "1660"
}
],
"symlink_target": ""
} |
sap.ui.define([
"sap/ui/test/Opa5",
"sap/ui/test/actions/Press",
"sap/ui/test/actions/EnterText",
"sap/ui/test/matchers/AggregationLengthEquals",
"sap/ui/test/matchers/AggregationFilled",
"sap/ui/test/matchers/PropertyStrictEquals",
"./Common",
"./shareOptions"
], function(Opa5, Press, EnterText, AggregationLengthEquals, AggregationFilled, PropertyStrictEquals, Common, shareOptions) {
"use strict";
var sViewName = "Worklist",
sTableId = "table",
sSearchFieldId = "searchField",
sSomethingThatCannotBeFound = "*#-Q@@||";
function allItemsInTheListContainTheSearchTerm (aControls) {
var oTable = aControls[0],
oSearchField = aControls[1],
aItems = oTable.getItems();
// table needs items
if (aItems.length === 0) {
return false;
}
return aItems.every(function (oItem) {
return oItem.getCells()[0].getTitle().indexOf(oSearchField.getValue()) !== -1;
});
}
function createWaitForItemAtPosition (oOptions) {
var iPosition = oOptions.position;
return {
id : sTableId,
viewName : sViewName,
matchers : function (oTable) {
return oTable.getItems()[iPosition];
},
actions : oOptions.actions,
success : oOptions.success,
errorMessage : "Table in view '" + sViewName + "' does not contain an Item at position '" + iPosition + "'"
};
}
Opa5.createPageObjects({
onTheWorklistPage : {
baseClass : Common,
actions : Object.assign({
iPressATableItemAtPosition : function (iPosition) {
return this.waitFor(createWaitForItemAtPosition({
position : iPosition,
actions : new Press()
}));
},
iRememberTheItemAtPosition : function (iPosition){
return this.waitFor(createWaitForItemAtPosition({
position : iPosition,
success : function (oTableItem) {
var oBindingContext = oTableItem.getBindingContext();
// Don't remember objects just strings since IE will not allow accessing objects of destroyed frames
this.getContext().currentItem = {
bindingPath: oBindingContext.getPath(),
id: oBindingContext.getProperty("ObjectID"),
name: oBindingContext.getProperty("Name")
};
}
}));
},
iPressOnMoreData : function (){
return this.waitFor({
id : sTableId,
viewName : sViewName,
matchers : function (oTable) {
return !!oTable.$("trigger").length;
},
actions : new Press(),
errorMessage : "The Table does not have a trigger"
});
},
iWaitUntilTheListIsNotVisible : function () {
return this.waitFor({
id : sTableId,
viewName : sViewName,
visible: false,
matchers : function (oTable) {
// visible false also returns visible controls so we need an extra check here
return !oTable.$().is(":visible");
},
errorMessage : "The Table is still visible"
});
},
iSearchForTheFirstObject: function() {
var sFirstObjectTitle;
return this.waitFor({
id: sTableId,
viewName: sViewName,
matchers: new AggregationFilled({
name: "items"
}),
success: function(oTable) {
sFirstObjectTitle = oTable.getItems()[0].getCells()[0].getTitle();
this.iSearchForValue(sFirstObjectTitle);
this.waitFor({
id: [sTableId, sSearchFieldId],
viewName: sViewName,
check : allItemsInTheListContainTheSearchTerm,
errorMessage: "Did not find any table entries or too many while trying to search for the first object."
});
},
errorMessage: "Did not find table entries while trying to search for the first object."
});
},
iSearchForValueWithActions : function (aActions) {
return this.waitFor({
id : sSearchFieldId,
viewName : sViewName,
actions: aActions,
errorMessage : "Failed to find search field in Worklist view.'"
});
},
iSearchForValue : function (sSearchString) {
return this.iSearchForValueWithActions([new EnterText({text : sSearchString}), new Press()]);
},
iTypeSomethingInTheSearchThatCannotBeFoundAndTriggerRefresh : function () {
var fnEnterTextAndFireRefreshButtonPressedOnSearchField = function (oSearchField) {
// set the search field value directly as EnterText action triggers a search event
oSearchField.setValue(sSomethingThatCannotBeFound);
// fire the search to simulate a refresh button press
oSearchField.fireSearch({refreshButtonPressed: true});
};
return this.iSearchForValueWithActions(fnEnterTextAndFireRefreshButtonPressedOnSearchField);
},
iClearTheSearch : function () {
return this.iSearchForValueWithActions([new EnterText({text: ""}), new Press()]);
},
iSearchForSomethingWithNoResults : function () {
return this.iSearchForValueWithActions([new EnterText({text: sSomethingThatCannotBeFound}), new Press()]);
}
}, shareOptions.createActions(sViewName)),
assertions: Object.assign({
iShouldSeeTheTable : function () {
return this.waitFor({
id : sTableId,
viewName : sViewName,
success : function (oTable) {
Opa5.assert.ok(oTable, "Found the object Table");
},
errorMessage : "Can't see the master Table."
});
},
theTableShowsOnlyObjectsWithTheSearchStringInTheirTitle : function () {
this.waitFor({
id : [sTableId, sSearchFieldId],
viewName : sViewName,
check: allItemsInTheListContainTheSearchTerm,
success : function () {
Opa5.assert.ok(true, "Every item did contain the title");
},
errorMessage : "The table did not have items"
});
},
theTableHasEntries : function () {
return this.waitFor({
viewName : sViewName,
id : sTableId,
matchers : new AggregationFilled({
name : "items"
}),
success : function () {
Opa5.assert.ok(true, "The table has entries");
},
errorMessage : "The table had no entries"
});
},
theTableShouldHaveAllEntries : function () {
var aAllEntities,
iExpectedNumberOfItems;
// retrieve all Objects to be able to check for the total amount
this.waitFor(this.createAWaitForAnEntitySet({
entitySet: "Objects",
success: function (aEntityData) {
aAllEntities = aEntityData;
}
}));
return this.waitFor({
id : sTableId,
viewName : sViewName,
matchers : function (oTable) {
// If there are less items in the list than the growingThreshold, only check for this number.
iExpectedNumberOfItems = Math.min(oTable.getGrowingThreshold(), aAllEntities.length);
return new AggregationLengthEquals({name : "items", length : iExpectedNumberOfItems}).isMatching(oTable);
},
success : function (oTable) {
Opa5.assert.strictEqual(oTable.getItems().length, iExpectedNumberOfItems, "The growing Table has " + iExpectedNumberOfItems + " items");
},
errorMessage : "Table does not have all entries."
});
},
theTitleShouldDisplayTheTotalAmountOfItems : function () {
return this.waitFor({
id : sTableId,
viewName : sViewName,
matchers : new AggregationFilled({name : "items"}),
success : function (oTable) {
var iObjectCount = oTable.getBinding("items").getLength();
this.waitFor({
id : "tableHeader",
viewName : sViewName,
matchers : function (oPage) {
var sExpectedText = oPage.getModel("i18n").getResourceBundle().getText("worklistTableTitleCount", [iObjectCount]);
return new PropertyStrictEquals({name : "text", value: sExpectedText}).isMatching(oPage);
},
success : function () {
Opa5.assert.ok(true, "The Page has a title containing the number " + iObjectCount);
},
errorMessage : "The Page's header does not container the number of items " + iObjectCount
});
},
errorMessage : "The table has no items."
});
},
theTableShouldHaveTheDoubleAmountOfInitialEntries : function () {
var iExpectedNumberOfItems;
return this.waitFor({
id : sTableId,
viewName : sViewName,
matchers : function (oTable) {
iExpectedNumberOfItems = oTable.getGrowingThreshold() * 2;
return new AggregationLengthEquals({name : "items", length : iExpectedNumberOfItems}).isMatching(oTable);
},
success : function () {
Opa5.assert.ok(true, "The growing Table had the double amount: " + iExpectedNumberOfItems + " of entries");
},
errorMessage : "Table does not have the double amount of entries."
});
},
theTableShouldContainOnlyFormattedUnitNumbers : function () {
return this.theUnitNumbersShouldHaveTwoDecimals("sap.m.ObjectNumber",
sViewName,
"Object numbers are properly formatted",
"Table has no entries which can be checked for their formatting");
},
iShouldSeeTheWorklistViewsBusyIndicator : function () {
return this.waitFor({
id : "page",
viewName : sViewName,
success : function (oPage) {
Opa5.assert.ok(oPage.getParent().getBusy(), "The worklist view is busy");
},
errorMessage : "The worklist view is not busy"
});
},
iShouldSeeTheWorklistTableBusyIndicator : function () {
return this.waitFor({
id : "table",
viewName : sViewName,
matchers : new PropertyStrictEquals({
name : "busy",
value: true
}),
autoWait : false,
success : function () {
Opa5.assert.ok(true, "The worklist table is busy");
},
errorMessage : "The worklist table is not busy"
});
},
iShouldSeeTheNoDataTextForNoSearchResults : function () {
return this.waitFor({
id : sTableId,
viewName : sViewName,
success : function (oTable) {
Opa5.assert.strictEqual(
oTable.getNoDataText(),
oTable.getModel("i18n").getProperty("worklistNoDataWithSearchText"),
"the table should show the no data text for search");
},
errorMessage : "table does not show the no data text for search"
});
}
}, shareOptions.createAssertions(sViewName))
}
});
}); | {
"content_hash": "772ea17b4b494156316e15eb05f709ef",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 143,
"avg_line_length": 32.0282131661442,
"alnum_prop": 0.6490163453068415,
"repo_name": "SAP/openui5-worklist-app",
"id": "063ff93958b1903e0b1ba80e03142bbf39ee9619",
"size": "10217",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "webapp/test/integration/pages/Worklist.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "4271"
},
{
"name": "JavaScript",
"bytes": "60100"
}
],
"symlink_target": ""
} |
layout: post
title: "Gas siphon surveillance"
date: 2018-05-15
image: "/img/raspberry-pi.jpg"
---
**Current status:** The components has been ordered
This blog post will explain the process of building a surveillance system using Raspberry Pi for when people steal gas from my car. I tried to limit the purchase of components to things that I will reuse in other places in my home when this issue has been resolved.
At three different occasions last year someone broke into the fuel tank of my car, siphoned the gas and threw away the cap. Back then I lived in a socioeconomic weaker area of Stockholm, so I hoped that I would avoid that problem when I moved to a better area this winter. But last weekend it happened again, so I decided to do something to mitigate it.
## Planning
The overall plan is to add a trigger on the gas lid that activates a Raspberry Pi, the RPI is located behind the head rest in the backseat to start record using a camera without an IR filter. Power will be drawn from the car battery.
### Surveillance laws in Sweden
In Sweden you need permission from the county council to perform surveillance in a public area. I called the Swedish police to ask about advice if my plan for surveillance was allowed, the response that I got was that it was kind of okay since the surveillance will be very limited (only trigged by someone actually stealing gas) and restricted to a small area of the parking lot outside my condo.
### The components
**Raspberry PI 3 Model B + Case + SD Card** - The Raspberry Pi will be placed in behind the back rest of the car
**Raspberry Pi PiNoir Camera Module V2** - The thefts usually happens at night, so it is better to get a camera without an IR filter.
**Nexa Magnet Contact Transmitter** - A magnetic contact that sends a 433 mhz signal when it is opened and closed. Usually used to control smart home lights when you open a door.
**433 Receiver Module** - Will be connected to the Raspberry Pi to trigger when the Nexa Magnet Contact signals open and close.
Total cost: 1115 SEK / 128 USD
### Battery life
I plan to power the Raspberry Pi using the car battery, the reason is that I do not have easy access to a power outlet where the car is located and that portable batteries for it are not powerful enough.
An Raspberry Pi 3 B consumes about 260mA in idle state
([source](https://www.pidramble.com/wiki/benchmarks/power-consumption)).
A car battery has about 60 000mAH capactity.
To calculate how long the battery will be able to power the RPI in idle I use the following equation:
```
60 000 mAH / 260 mA = 230,77h = 9,62 days
```
This is calculation is based on a random car battery I found on the web, my battery is old and these numbers are probably wishful thinking. So I will need to be very conservative with the energy usage if I don't want the battery to run out.
### Light
Nights in Sweden are pretty bright during the summer, there is also a lamp post where I park my car. So I hope that IR-lights are not required for the camera to get a good mugshot of the crook.
If the light turns out to not be enough I will add IR-LEDS that activate when the camera is trigged to be on. | {
"content_hash": "a8987ce307d8be7c7e989a0a905fd1e0",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 397,
"avg_line_length": 58.81481481481482,
"alnum_prop": 0.7714105793450882,
"repo_name": "robinwassen/robinwassen.github.io",
"id": "f4cb214ea9730dd8ca887d752e362f4afb7d62c9",
"size": "3180",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_drafts/2018-05-15-gas-siphon-surveillance.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "13092"
},
{
"name": "HTML",
"bytes": "6899"
},
{
"name": "JavaScript",
"bytes": "26172"
},
{
"name": "Ruby",
"bytes": "43"
}
],
"symlink_target": ""
} |
'use strict'
const debug = require('debug')('chix:actor')
const util = require('util')
const validate = require('../validate')
const Link = require('../link')
class Map {
/**
* Reads a map from JSON
*
* Will validate the JSON first then creates the nodes and it's links
*
* If the map itself contains nodeDefinitions those will be added to
* the loader.
*
* If the map itself does not have a provider property set it will
* be set to '@', which means internal lookup.
*
* A default view will be setup unmasking all nodes.
*
* If this Actor is the main actor it's status will be set to `created`
*
* If this Actor was not yet registered with the Process Manager it will be registered.
*
* @param {Object} map
* @public
*
*/
addMap (map) {
debug('%s: addMap()', this.identifier)
try {
validate.flow(map)
} catch (e) {
if (map.title) {
throw Error(
util.format('Flow `%s`: %s', map.title, e.message)
)
} else {
throw Error(
util.format('Flow %s:%s: %s', map.ns, map.name, e.message)
)
}
}
if (map.id) {
// xFlow contains it, direct actors don't perse
this.id = map.id
}
// allow a map to carry it's own definitions
if (map.nodeDefinitions) {
this.loader.addNodeDefinitions('@', map.nodeDefinitions)
}
// add nodes and links one by one so there is more control
map.nodes.forEach((node) => {
if (!node.id) {
throw new Error(
util.format('Node lacks an id: %s:%s', node.ns, node.name)
)
}
// give the node a default provider.
if (!node.provider) {
if (map.providers && map.providers.hasOwnProperty('@')) {
node.provider = map.providers['@'].url
}
}
const def = this.loader.getNodeDefinition(node, map)
if (!def) {
throw new Error(
util.format(
'Failed to get node definition for %s:%s', node.ns, node.name
)
)
}
debug('%s: Creating node %s:%s', this.identifier, node.ns, node.name)
this.createNode(node, def)
})
if (map.hasOwnProperty('links')) {
map.links.forEach((link) => {
this.addLink(
Link.create(link)
)
})
}
for (let i = 0; i < map.nodes.length; i++) {
this.view.push(map.nodes[i].id)
}
// fix later
if (this.constructor.name === 'Actor') {
this.setStatus('created')
}
if (!this.pid) { // re-run
this.processManager.register(this)
}
return this
}
}
module.exports = Map
| {
"content_hash": "6415dccacb1274ec11fdb755579de3b5",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 89,
"avg_line_length": 24.31192660550459,
"alnum_prop": 0.5592452830188679,
"repo_name": "psichi/chix",
"id": "087fb0971823ef4db32c9525a398fb48cfe758bd",
"size": "2650",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/chix-flow/src/actor/map.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1417898"
},
{
"name": "CoffeeScript",
"bytes": "762"
},
{
"name": "HTML",
"bytes": "761416"
},
{
"name": "JavaScript",
"bytes": "10492371"
},
{
"name": "Makefile",
"bytes": "1452"
},
{
"name": "PHP",
"bytes": "7869"
},
{
"name": "PowerShell",
"bytes": "471"
},
{
"name": "Ruby",
"bytes": "2556"
},
{
"name": "Shell",
"bytes": "1114"
},
{
"name": "Smarty",
"bytes": "10533"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#444"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="80dp"
android:layout_height="64dp"
android:layout_margin="5dp"
android:background="@android:color/transparent"
android:src="@drawable/application_icon" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Рецепты крафта"
android:textColor="#ff52de93"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="22sp" />
<TextView
android:id="@+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="true"
android:singleLine="true"
android:text="Оценить приложение"
android:textColor="#ff2f99de" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/recipe_result_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text=""
android:textSize="20sp" />
<ImageView
android:id="@+id/recipe_result_icon"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:orientation="horizontal"
android:background="@drawable/tabpanel_background">
<TextView
android:id="@+id/recipe_tab_recipe"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".25"
android:gravity="center"
android:text="Рецепт"
android:textColor="@color/TextLight"
android:background="@drawable/tabselected_background"/>
<TextView
android:id="@+id/recipe_tab_description"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".25"
android:gravity="center"
android:text="Описание" />
<TextView
android:id="@+id/recipe_tab_materials"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".25"
android:gravity="center"
android:text="Материалы" />
<TextView
android:id="@+id/recipe_tab_notes"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight=".25"
android:gravity="center"
android:text="Примечание" />
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/recipe_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp"
android:layout_margin="0dp"
android:gravity="center" />
</LinearLayout> | {
"content_hash": "284e320263b899caeb613b5cc9624613",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 79,
"avg_line_length": 39.018181818181816,
"alnum_prop": 0.537977632805219,
"repo_name": "liosha2007/recipes-craft",
"id": "273ded6b278f2357c6f31b30fd67cf23c297522d",
"size": "4355",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/layout_recipe.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "168783"
}
],
"symlink_target": ""
} |
/**
* Automatically generated file. Please do not edit.
* @author Highcharts Config Generator by Karasiq
* @see [[http://api.highcharts.com/highmaps]]
*/
package com.highmaps.config
import scalajs.js, js.`|`
import com.highcharts.CleanJsObject
import com.highcharts.HighchartsUtils._
/**
* @note JavaScript name: <code>plotOptions-cmf-states-hover</code>
*/
@js.annotation.ScalaJSDefined
class PlotOptionsCmfStatesHover extends com.highcharts.HighchartsGenericObject {
/**
* <p>Animation setting for hovering the graph in line-type series.</p>
* @since 5.0.8
*/
val animation: js.UndefOr[Boolean | js.Object] = js.undefined
/**
* <p>The additional line width for the graph of a hovered series.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-linewidthplus/">5 pixels wider</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-linewidthplus/">5 pixels wider</a>
* @since 4.0.3
*/
val lineWidthPlus: js.UndefOr[Double] = js.undefined
/**
* <p>In Highcharts 1.0, the appearance of all markers belonging to the
* hovered series. For settings on the hover state of the individual
* point, see
* <a href="#plotOptions.series.marker.states.hover">marker.states.hover</a>.</p>
* @since 6.0.0
*/
val marker: js.UndefOr[CleanJsObject[PlotOptionsCmfStatesHoverMarker]] = js.undefined
/**
* <p>Options for the halo appearing around the hovered point in line-
* type series as well as outside the hovered slice in pie charts.
* By default the halo is filled by the current point or series
* color with an opacity of 0.25. The halo can be disabled by
* setting the <code>halo</code> option to <code>false</code>.</p>
* <p>In styled mode, the halo is styled with the <code>.highcharts-halo</code>
* class, with colors inherited from <code>.highcharts-color-{n}</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/halo/">Halo options</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/halo/">Halo options</a>
* @since 4.0
*/
val halo: js.Any = js.undefined
/**
* <p>Enable separate styles for the hovered series to visualize that
* the user hovers either the series itself or the legend. .</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-enabled/">Line</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-enabled-column/">Column</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-enabled-pie/">Pie</a>
* @since 1.2
*/
val enabled: js.UndefOr[Boolean] = js.undefined
/**
* <p>Pixel width of the graph line. By default this property is
* undefined, and the <code>lineWidthPlus</code> property dictates how much
* to increase the linewidth from normal state.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-states-hover-linewidth/">5px line on hover</a>
* @since 6.0.0
*/
val lineWidth: js.UndefOr[Double] = js.undefined
/**
* <p>The color of the shape in this state</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/plotoptions/series-states-hover/">Hover options</a>
* @since 6.0.0
*/
val color: js.UndefOr[String | js.Object] = js.undefined
/**
* <p>The border color of the point in this state.</p>
* @since 6.0.0
*/
val borderColor: js.UndefOr[String | js.Object] = js.undefined
/**
* <p>The border width of the point in this state</p>
* @since 6.0.0
*/
val borderWidth: js.UndefOr[Double] = js.undefined
/**
* <p>The relative brightness of the point when hovered, relative to
* the normal point color.</p>
* @since 6.0.0
*/
val brightness: js.UndefOr[Double] = js.undefined
}
object PlotOptionsCmfStatesHover {
/**
* @param animation <p>Animation setting for hovering the graph in line-type series.</p>
* @param lineWidthPlus <p>The additional line width for the graph of a hovered series.</p>
* @param marker <p>In Highcharts 1.0, the appearance of all markers belonging to the. hovered series. For settings on the hover state of the individual. point, see. <a href="#plotOptions.series.marker.states.hover">marker.states.hover</a>.</p>
* @param halo <p>Options for the halo appearing around the hovered point in line-. type series as well as outside the hovered slice in pie charts.. By default the halo is filled by the current point or series. color with an opacity of 0.25. The halo can be disabled by. setting the <code>halo</code> option to <code>false</code>.</p>. <p>In styled mode, the halo is styled with the <code>.highcharts-halo</code>. class, with colors inherited from <code>.highcharts-color-{n}</code>.</p>
* @param enabled <p>Enable separate styles for the hovered series to visualize that. the user hovers either the series itself or the legend. .</p>
* @param lineWidth <p>Pixel width of the graph line. By default this property is. undefined, and the <code>lineWidthPlus</code> property dictates how much. to increase the linewidth from normal state.</p>
* @param color <p>The color of the shape in this state</p>
* @param borderColor <p>The border color of the point in this state.</p>
* @param borderWidth <p>The border width of the point in this state</p>
* @param brightness <p>The relative brightness of the point when hovered, relative to. the normal point color.</p>
*/
def apply(animation: js.UndefOr[Boolean | js.Object] = js.undefined, lineWidthPlus: js.UndefOr[Double] = js.undefined, marker: js.UndefOr[CleanJsObject[PlotOptionsCmfStatesHoverMarker]] = js.undefined, halo: js.UndefOr[js.Any] = js.undefined, enabled: js.UndefOr[Boolean] = js.undefined, lineWidth: js.UndefOr[Double] = js.undefined, color: js.UndefOr[String | js.Object] = js.undefined, borderColor: js.UndefOr[String | js.Object] = js.undefined, borderWidth: js.UndefOr[Double] = js.undefined, brightness: js.UndefOr[Double] = js.undefined): PlotOptionsCmfStatesHover = {
val animationOuter: js.UndefOr[Boolean | js.Object] = animation
val lineWidthPlusOuter: js.UndefOr[Double] = lineWidthPlus
val markerOuter: js.UndefOr[CleanJsObject[PlotOptionsCmfStatesHoverMarker]] = marker
val haloOuter: js.Any = halo
val enabledOuter: js.UndefOr[Boolean] = enabled
val lineWidthOuter: js.UndefOr[Double] = lineWidth
val colorOuter: js.UndefOr[String | js.Object] = color
val borderColorOuter: js.UndefOr[String | js.Object] = borderColor
val borderWidthOuter: js.UndefOr[Double] = borderWidth
val brightnessOuter: js.UndefOr[Double] = brightness
com.highcharts.HighchartsGenericObject.toCleanObject(new PlotOptionsCmfStatesHover {
override val animation: js.UndefOr[Boolean | js.Object] = animationOuter
override val lineWidthPlus: js.UndefOr[Double] = lineWidthPlusOuter
override val marker: js.UndefOr[CleanJsObject[PlotOptionsCmfStatesHoverMarker]] = markerOuter
override val halo: js.Any = haloOuter
override val enabled: js.UndefOr[Boolean] = enabledOuter
override val lineWidth: js.UndefOr[Double] = lineWidthOuter
override val color: js.UndefOr[String | js.Object] = colorOuter
override val borderColor: js.UndefOr[String | js.Object] = borderColorOuter
override val borderWidth: js.UndefOr[Double] = borderWidthOuter
override val brightness: js.UndefOr[Double] = brightnessOuter
})
}
}
| {
"content_hash": "0a18e0557d2eb0ce83cc9e5d58fd8c85",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 575,
"avg_line_length": 58.130434782608695,
"alnum_prop": 0.7231363749688356,
"repo_name": "Karasiq/scalajs-highcharts",
"id": "5c120b9b1a059ae9cec51fe4b8efa27579e46a0b",
"size": "8022",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/scala/com/highmaps/config/PlotOptionsCmfStatesHover.scala",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Scala",
"bytes": "131509301"
}
],
"symlink_target": ""
} |
function Get-TrustedHost
{
<#
.SYNOPSIS
Returns the current computer's trusted hosts list.
.DESCRIPTION
PowerShell stores its trusted hosts list as a comma-separated list of hostnames in the `WSMan` drive. That's not very useful. This function reads that list, splits it, and returns each item.
.OUTPUTS
System.String.
.EXAMPLE
Get-TrustedHost
If the trusted hosts lists contains `example.com`, `api.example.com`, and `docs.example.com`, returns the following:
example.com
api.example.com
docs.example.com
#>
[CmdletBinding()]
param(
)
Set-StrictMode -Version 'Latest'
Use-CallerPreference -Cmdlet $PSCmdlet -Session $ExecutionContext.SessionState
$trustedHosts = (Get-Item $TrustedHostsPath -Force).Value
if( $trustedHosts )
{
return $trustedHosts -split ','
}
}
Set-Alias -Name 'Get-TrustedHosts' -Value 'Get-TrustedHost'
| {
"content_hash": "4fed29db3391ec437a5a36b47d2f6a88",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 196,
"avg_line_length": 25.62162162162162,
"alnum_prop": 0.6751054852320675,
"repo_name": "lweniger/PowerShell",
"id": "ccf0d59c60051ba056c487c060aa8b4911fea79d",
"size": "1495",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/downloaded/powershellgallery/Carbon/2.2.0/Functions/Get-TrustedHost.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1031"
},
{
"name": "C#",
"bytes": "10888"
},
{
"name": "HTML",
"bytes": "5103"
},
{
"name": "NSIS",
"bytes": "638"
},
{
"name": "PowerShell",
"bytes": "2890615"
}
],
"symlink_target": ""
} |
// Copyright (C) by Housemarque, Inc.
namespace Hopac.Core {
using Microsoft.FSharp.Core;
using System;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
///
public abstract class BindTaskWithResult<X, Y> : Job<Y> {
private Task<X> xT;
///
public BindTaskWithResult(Task<X> xT) { this.xT = xT; }
///
public abstract Job<Y> Do(X x);
private sealed class State : Work {
private Scheduler sr;
private BindTaskWithResult<X, Y> yJ;
private Cont<Y> yK;
internal State(Scheduler sr, BindTaskWithResult<X, Y> yJ, Cont<Y> yK) {
this.sr = sr;
this.yJ = yJ;
this.yK = yK;
}
internal override Proc GetProc(ref Worker wr) {
return Handler.GetProc(ref wr, ref yK);
}
internal override void DoHandle(ref Worker wr, Exception e) {
Handler.DoHandle(yK, ref wr, e);
}
internal override void DoWork(ref Worker wr) {
var yJ = this.yJ;
yJ.Do(yJ.xT.Result).DoJob(ref wr, yK);
}
internal void Ready() {
Worker.RunOnThisThread(sr, this);
}
}
internal override void DoJob(ref Worker wr, Cont<Y> yK) {
var xT = this.xT;
if (TaskStatus.RanToCompletion == xT.Status)
Job.Do(Do(xT.Result), ref wr, yK);
else
xT.GetAwaiter().UnsafeOnCompleted(new State(wr.Scheduler, this, yK).Ready);
}
}
///
public abstract class BindTask<Y> : Job<Y> {
private Task uT;
///
public BindTask(Task uT) { this.uT = uT; }
///
public abstract Job<Y> Do();
private sealed class State : Work {
private Scheduler sr;
private BindTask<Y> yJ;
private Cont<Y> yK;
internal State(Scheduler sr, BindTask<Y> yJ, Cont<Y> yK) {
this.sr = sr;
this.yJ = yJ;
this.yK = yK;
}
internal override Proc GetProc(ref Worker wr) {
return Handler.GetProc(ref wr, ref yK);
}
internal override void DoHandle(ref Worker wr, Exception e) {
Handler.DoHandle(yK, ref wr, e);
}
internal override void DoWork(ref Worker wr) {
var yJ = this.yJ;
var uT = yJ.uT;
if (TaskStatus.RanToCompletion == uT.Status)
yJ.Do().DoJob(ref wr, yK);
else
Handler.DoHandle(yK, ref wr, uT.Exception);
}
internal void Ready() {
Worker.RunOnThisThread(sr, this);
}
}
internal override void DoJob(ref Worker wr, Cont<Y> yK) {
var uT = this.uT;
if (TaskStatus.RanToCompletion == uT.Status)
Job.Do(Do(), ref wr, yK);
else
uT.GetAwaiter().UnsafeOnCompleted(new State(wr.Scheduler, this, yK).Ready);
}
}
///
public sealed class AwaitTaskWithResult<X> : Job<X> {
private Task<X> xT;
///
[MethodImpl(AggressiveInlining.Flag)]
public AwaitTaskWithResult(Task<X> xT) { this.xT = xT; }
private sealed class State : Work {
private Task<X> xT;
private Cont<X> xK;
private Scheduler sr;
[MethodImpl(AggressiveInlining.Flag)]
public State(Task<X> xT, Cont<X> xK, Scheduler sr) {
this.xT = xT;
this.xK = xK;
this.sr = sr;
}
internal override Proc GetProc(ref Worker wr) {
return xK.GetProc(ref wr);
}
internal override void DoHandle(ref Worker wr, Exception e) {
xK.DoHandle(ref wr, e);
}
internal override void DoWork(ref Worker wr) {
xK.DoCont(ref wr, xT.Result);
}
public void Ready() {
Worker.RunOnThisThread(this.sr, this);
}
}
internal override void DoJob(ref Worker wr, Cont<X> xK) {
var xT = this.xT;
if (TaskStatus.RanToCompletion == xT.Status)
Cont.Do(xK, ref wr, xT.Result);
else
xT.GetAwaiter().UnsafeOnCompleted(new State(xT, xK, wr.Scheduler).Ready);
}
}
///
public sealed class AwaitTask : Job<Unit> {
private Task uT;
///
[MethodImpl(AggressiveInlining.Flag)]
public AwaitTask(Task uT) { this.uT = uT; }
private sealed class State : Work {
private Task uT;
private Cont<Unit> uK;
private Scheduler sr;
[MethodImpl(AggressiveInlining.Flag)]
public State(Task uT, Cont<Unit> uK, Scheduler sr) {
this.uT = uT;
this.uK = uK;
this.sr = sr;
}
internal override Proc GetProc(ref Worker wr) {
return uK.GetProc(ref wr);
}
internal override void DoHandle(ref Worker wr, Exception e) {
uK.DoHandle(ref wr, e);
}
internal override void DoWork(ref Worker wr) {
var uT = this.uT;
if (TaskStatus.RanToCompletion == uT.Status)
uK.DoWork(ref wr);
else
uK.DoHandle(ref wr, uT.Exception);
}
internal void Ready() {
Worker.RunOnThisThread(this.sr, this);
}
}
internal override void DoJob(ref Worker wr, Cont<Unit> uK) {
var uT = this.uT;
if (TaskStatus.RanToCompletion == uT.Status)
Work.Do(uK, ref wr);
else
uT.GetAwaiter().UnsafeOnCompleted(new State(uT, uK, wr.Scheduler).Ready);
}
}
}
| {
"content_hash": "99331114c5f0acefa3815f1e0d8cec90",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 83,
"avg_line_length": 31.188235294117646,
"alnum_prop": 0.5682761222180309,
"repo_name": "mmitkevich/Kvantor",
"id": "8d192bc7815ff86b8ce105073da054f803aa049d",
"size": "5304",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Hopac/Libs/Hopac.Core/External/Tasks.cs",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "108743"
},
{
"name": "F#",
"bytes": "315144"
},
{
"name": "Shell",
"bytes": "255"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Syll. fung. (Abellini) 1: 558 (1882)
#### Original name
Sphaeria refracta Cooke, 1877
### Remarks
null | {
"content_hash": "4190551d3dd87b40a61c31be7159f9cc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 14.692307692307692,
"alnum_prop": 0.7015706806282722,
"repo_name": "mdoering/backbone",
"id": "e5cb98f6acd5959f558b9d2bf8147c883d06e6a8",
"size": "259",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Didymella/Didymella proximella/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package retronym.lessons.collections
import _root_.org.spex.Specification
object ForComprehensions extends Specification {
val weekDays = List("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
val daySections = List("morning", "afternoon", "evening")
"ForComprehensions" should {
"should allow map, filter of collection" in {
val a = for {w <- weekDays if w startsWith "W"
wu = w.toUpperCase
} yield wu
a must containAll(List("WEDNESDAY"))
}
"List of Lists" in {
val a = for {w <- weekDays if w startsWith "T"
weekdaysUpperCaseLetters = w.toList
} yield weekdaysUpperCaseLetters
a must containAll(List('T', 'u', 'e', 's', 'd', 'a', 'y'), List('T', 'h', 'u', 'r', 's', 'd', 'a', 'y'))
}
"Same as 'List of Lists', but without the sugar" in {
val a = weekDays.filter(_ startsWith "T").map(_.toList)
a must containAll(List('T', 'u', 'e', 's', 'd', 'a', 'y'), List('T', 'h', 'u', 'r', 's', 'd', 'a', 'y'))
}
"Flat list by using <- operator twice" in {
val a = for {w <- weekDays if w startsWith "T"
weekdaysUpperCaseLetters <- w
} yield weekdaysUpperCaseLetters
a must containAll(List('T', 'u', 'e', 's', 'd', 'a', 'y', 'T', 'h', 'u', 'r', 's', 'd', 'a', 'y'))
}
"Same as 'Flat list by using <- operator twice', but without the sugar" in {
val a = weekDays.filter(_ startsWith "T").flatMap(_.toList)
a must containAll(List('T', 'u', 'e', 's', 'd', 'a', 'y', 'T', 'h', 'u', 'r', 's', 'd', 'a', 'y'))
}
}
}
| {
"content_hash": "64aed6b051c9fb070789ad4a8f9a9205",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 110,
"avg_line_length": 41.69230769230769,
"alnum_prop": 0.5412054120541205,
"repo_name": "retronym/scala-sandbox",
"id": "8fe8e4504b91e2051e53efb98043a6a00a576cd8",
"size": "1626",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lessons/src/main/scala/retronym/lessons/collections/ForComprehensions.scala",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Scala",
"bytes": "37368"
}
],
"symlink_target": ""
} |
using Eigen::Map;
using Eigen::MatrixBase;
using Eigen::MatrixXd;
using drake::systems::plants::inverseKinBackend;
template <typename DerivedA, typename DerivedB, typename DerivedC>
DRAKEIK_EXPORT void inverseKinPointwise(
RigidBodyTree* model, const int nT, const double* t,
const MatrixBase<DerivedA>& q_seed, const MatrixBase<DerivedB>& q_nom,
const int num_constraints, RigidBodyConstraint** const constraint_array,
const IKoptions& ikoptions, MatrixBase<DerivedC>* q_sol, int* info,
std::vector<std::string>* infeasible_constraint) {
inverseKinBackend(model, nT, t, q_seed, q_nom, num_constraints,
constraint_array, ikoptions, q_sol,
info, infeasible_constraint);
}
template DRAKEIK_EXPORT void inverseKinPointwise(
RigidBodyTree* model, const int nT, const double* t,
const MatrixBase<Map<MatrixXd>>& q_seed,
const MatrixBase<Map<MatrixXd>>& q_nom, const int num_constraints,
RigidBodyConstraint** const constraint_array,
const IKoptions& ikoptions, MatrixBase<Map<MatrixXd>>* q_sol, int *info,
std::vector<std::string>* infeasible_constraint);
template DRAKEIK_EXPORT void inverseKinPointwise(
RigidBodyTree* model, const int nT, const double* t,
const MatrixBase<MatrixXd>& q_seed, const MatrixBase<MatrixXd>& q_nom,
const int num_constraints, RigidBodyConstraint** const constraint_array,
const IKoptions& ikoptions, MatrixBase<MatrixXd>* q_sol, int* info,
std::vector<std::string>* infeasible_constraint);
| {
"content_hash": "54bae98265b4b63d7611cfc117c865a5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 49.193548387096776,
"alnum_prop": 0.7331147540983607,
"repo_name": "sheim/drake",
"id": "831d4bd205c35fb2aed6e2b9c6fd2f151179ac70",
"size": "1651",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "drake/systems/plants/inverseKinPointwise.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "329914"
},
{
"name": "C++",
"bytes": "3321947"
},
{
"name": "CMake",
"bytes": "322742"
},
{
"name": "CSS",
"bytes": "8598"
},
{
"name": "FORTRAN",
"bytes": "5597"
},
{
"name": "HTML",
"bytes": "13148"
},
{
"name": "Java",
"bytes": "29789"
},
{
"name": "M",
"bytes": "23582"
},
{
"name": "Makefile",
"bytes": "15099"
},
{
"name": "Mathematica",
"bytes": "115"
},
{
"name": "Matlab",
"bytes": "4322614"
},
{
"name": "Objective-C",
"bytes": "2755"
},
{
"name": "Perl",
"bytes": "22532"
},
{
"name": "Python",
"bytes": "54166"
},
{
"name": "Shell",
"bytes": "11322"
},
{
"name": "TeX",
"bytes": "38033"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_72-internal) on Mon Mar 14 13:22:18 GMT 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType (Apache Taverna Language APIs (Scufl2, Databundle) 0.15.1-incubating API)</title>
<meta name="date" content="2016-03-14">
<link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType (Apache Taverna Language APIs (Scufl2, Databundle) 0.15.1-incubating API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/apache/taverna/scufl2/xml/scufl/jaxb/class-use/WorkflowDescriptionType.html" target="_top">Frames</a></li>
<li><a href="WorkflowDescriptionType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType" class="title">Uses of Class<br>org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.taverna.scufl2.xml.scufl.jaxb">org.apache.taverna.scufl2.xml.scufl.jaxb</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.taverna.scufl2.xml.scufl.jaxb">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a> in <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/package-summary.html">org.apache.taverna.scufl2.xml.scufl.jaxb</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing fields, and an explanation">
<caption><span>Fields in <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/package-summary.html">org.apache.taverna.scufl2.xml.scufl.jaxb</a> declared as <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>protected <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></code></td>
<td class="colLast"><span class="typeNameLabel">ScuflType.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/ScuflType.html#workflowdescription">workflowdescription</a></span></code> </td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/package-summary.html">org.apache.taverna.scufl2.xml.scufl.jaxb</a> that return <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></code></td>
<td class="colLast"><span class="typeNameLabel">ObjectFactory.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/ObjectFactory.html#createWorkflowDescriptionType--">createWorkflowDescriptionType</a></span>()</code>
<div class="block">Create an instance of <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb"><code>WorkflowDescriptionType</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></code></td>
<td class="colLast"><span class="typeNameLabel">ScuflType.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/ScuflType.html#getWorkflowdescription--">getWorkflowdescription</a></span>()</code>
<div class="block">Gets the value of the workflowdescription property.</div>
</td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/package-summary.html">org.apache.taverna.scufl2.xml.scufl.jaxb</a> that return types with arguments of type <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/JAXBElement.html?is-external=true" title="class or interface in javax.xml.bind">JAXBElement</a><<a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a>></code></td>
<td class="colLast"><span class="typeNameLabel">ObjectFactory.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/ObjectFactory.html#createWorkflowdescription-org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType-">createWorkflowdescription</a></span>(<a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a> value)</code>
<div class="block">Create an instance of <a href="http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/JAXBElement.html?is-external=true" title="class or interface in javax.xml.bind"><code>JAXBElement</code></a><code><</code><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb"><code>WorkflowDescriptionType</code></a><code>></code>}</div>
</td>
</tr>
</tbody>
</table>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
<caption><span>Methods in <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/package-summary.html">org.apache.taverna.scufl2.xml.scufl.jaxb</a> with parameters of type <a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/JAXBElement.html?is-external=true" title="class or interface in javax.xml.bind">JAXBElement</a><<a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a>></code></td>
<td class="colLast"><span class="typeNameLabel">ObjectFactory.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/ObjectFactory.html#createWorkflowdescription-org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType-">createWorkflowdescription</a></span>(<a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a> value)</code>
<div class="block">Create an instance of <a href="http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/JAXBElement.html?is-external=true" title="class or interface in javax.xml.bind"><code>JAXBElement</code></a><code><</code><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb"><code>WorkflowDescriptionType</code></a><code>></code>}</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><span class="typeNameLabel">ScuflType.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/ScuflType.html#setWorkflowdescription-org.apache.taverna.scufl2.xml.scufl.jaxb.WorkflowDescriptionType-">setWorkflowdescription</a></span>(<a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">WorkflowDescriptionType</a> value)</code>
<div class="block">Sets the value of the workflowdescription property.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../../../org/apache/taverna/scufl2/xml/scufl/jaxb/WorkflowDescriptionType.html" title="class in org.apache.taverna.scufl2.xml.scufl.jaxb">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../../index.html?org/apache/taverna/scufl2/xml/scufl/jaxb/class-use/WorkflowDescriptionType.html" target="_top">Frames</a></li>
<li><a href="WorkflowDescriptionType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2015–2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "346225fab1c16a403e5edc393a386ea9",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 535,
"avg_line_length": 65.847533632287,
"alnum_prop": 0.6765867611005175,
"repo_name": "apache/incubator-taverna-site",
"id": "75d32c9cafea6108767002d6d4bcb4aa8bee666c",
"size": "14684",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "content/javadoc/taverna-language/org/apache/taverna/scufl2/xml/scufl/jaxb/class-use/WorkflowDescriptionType.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "10003"
},
{
"name": "Clojure",
"bytes": "49413"
},
{
"name": "Dockerfile",
"bytes": "1398"
},
{
"name": "HTML",
"bytes": "72209"
},
{
"name": "Perl",
"bytes": "2822"
},
{
"name": "Python",
"bytes": "31455"
},
{
"name": "Shell",
"bytes": "374"
}
],
"symlink_target": ""
} |
import {
getCleanedPathname,
getSortType,
getSortRange,
resolveSortTypePath,
resolveSortRangePath
} from "./reddit";
describe("getCleanedPathname", () => {
it("should handle a subreddit", () => {
const path = "/r/listentothis";
const cleaned = getCleanedPathname(path);
expect(cleaned).toEqual("/r/listentothis");
});
it("should handle a subreddit with sortType", () => {
const path = "/r/listentothis/new";
const cleaned = getCleanedPathname(path);
expect(cleaned).toEqual("/r/listentothis");
});
it("should handle a subreddit with sortRange", () => {
const path = "/r/listentothis/top/?t=week";
const cleaned = getCleanedPathname(path);
expect(cleaned).toEqual("/r/listentothis");
});
});
describe("getSortType", () => {
it("should handle root path", () => {
const path = "/";
const sortType = getSortType(path);
expect(sortType).toEqual("hot");
});
it("should handle root path with sortType", () => {
const path = "/top";
const sortType = getSortType(path);
expect(sortType).toEqual("top");
});
it("should handle subreddit root", () => {
const path = "/r/music";
const sortType = getSortType(path);
expect(sortType).toEqual("hot");
});
it("should handle subreddit with sortType", () => {
const path = "/r/music/top";
const sortType = getSortType(path);
expect(sortType).toEqual("top");
});
// TODO: trailing slashes
// TODO: multi-reddits
});
describe("getSortRange", () => {
it("should get default sortRange", () => {
const path = "/";
const sortRange = getSortRange(path);
expect(sortRange).toEqual("day");
});
it("should get sortRange", () => {
const path = "/?foo=bar&t=week";
const sortRange = getSortRange(path);
expect(sortRange).toEqual("week");
});
});
describe("resolveSortTypePath", () => {
it("should handle root path and new sortType hot", () => {
const path = "/";
const resolved = resolveSortTypePath(path, "hot");
expect(resolved).toEqual("/");
});
it("should handle root path and new sortType top", () => {
const path = "";
const resolved = resolveSortTypePath(path, "top");
expect(resolved).toEqual("/top");
});
it("should handle root path with existing sortType and new sortType hot", () => {
const path = "/hot";
const resolved = resolveSortTypePath(path, "hot");
expect(resolved).toEqual("/hot");
});
it("should handle root path with existing sortType and new sortType top", () => {
const path = "/hot";
const resolved = resolveSortTypePath(path, "top");
expect(resolved).toEqual("/top");
});
it("should handle subreddit root and new sortType hot", () => {
const path = "/r/music";
const resolved = resolveSortTypePath(path, "hot");
expect(resolved).toEqual("/r/music");
});
it("should handle subreddit root and new sortType top", () => {
const path = "/r/music";
const resolved = resolveSortTypePath(path, "top");
expect(resolved).toEqual("/r/music/top");
});
it("should handle subreddit with existing sortType and new sortType hot", () => {
const path = "/r/music/hot";
const resolved = resolveSortTypePath(path, "hot");
expect(resolved).toEqual("/r/music/hot");
});
it("should handle subreddit with existing sortType and new sortType top", () => {
const path = "/r/music/hot";
const resolved = resolveSortTypePath(path, "top");
expect(resolved).toEqual("/r/music/top");
});
// TODO: trailing slashes
// TODO: multi-reddits
});
describe("resolveSortRangePath", () => {
it("should set new sortRange", () => {
const path = "/";
const resolved = resolveSortRangePath(path, "week");
expect(resolved).toEqual("/?t=week");
});
it("should override existing sortRange", () => {
const path = "/?t=day";
const resolved = resolveSortRangePath(path, "week");
expect(resolved).toEqual("/?t=week");
});
it("should set new subreddit sortRange", () => {
const path = "/r/listentothis";
const resolved = resolveSortRangePath(path, "week");
expect(resolved).toEqual("/r/listentothis?t=week");
});
it("should override subreddit existing sortRange", () => {
const path = "/r/listentothis/?t=day";
const resolved = resolveSortRangePath(path, "week");
expect(resolved).toEqual("/r/listentothis/?t=week");
});
});
| {
"content_hash": "9d0739c270a614e039982f52a8329200",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 83,
"avg_line_length": 29.48993288590604,
"alnum_prop": 0.6272189349112426,
"repo_name": "yanglinz/reddio-next",
"id": "b73f238b799ebd094dccf2692a4b717408667256",
"size": "4394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/lib/reddit.test.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1022"
},
{
"name": "HTML",
"bytes": "527"
},
{
"name": "JavaScript",
"bytes": "80768"
},
{
"name": "TypeScript",
"bytes": "14248"
}
],
"symlink_target": ""
} |
package dto;
import lombok.Value;
/**
* Created by zzl on 16/11/20.
*/
@Value
public class User {
private String username;
private String password;
private int userType;
}
| {
"content_hash": "54e011fe4a307ff82dd7e32ff700bd6d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 30,
"avg_line_length": 14.461538461538462,
"alnum_prop": 0.675531914893617,
"repo_name": "lvjing2/javafx-darcula-theme",
"id": "33d908a221efc98122814a5e03cee26c2ecff311",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/dto/User.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7067"
},
{
"name": "Java",
"bytes": "6230"
},
{
"name": "Shell",
"bytes": "9"
}
],
"symlink_target": ""
} |
using Newtonsoft.Json;
namespace PROBot
{
public class Account
{
public string Name { get; set; }
public string Password { get; set; }
public string Server { get; set; }
public Socks Socks { get; set; }
[JsonIgnore]
public string FileName { get; set; }
public Account(string name)
{
Name = name;
Socks = new Socks();
}
}
} | {
"content_hash": "d41ea4690ae1d6a27888708bc9dc4897",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 44,
"avg_line_length": 21.61904761904762,
"alnum_prop": 0.4977973568281938,
"repo_name": "MeltWS/proshine",
"id": "1da777af7df2120ddd3fa50f4c25c7627994d12e",
"size": "456",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "PROBot/Account.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "690303"
}
],
"symlink_target": ""
} |
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3'), require('d3'), require('d3'), require('d3'), require('d3')) :
typeof define === 'function' && define.amd ? define('giottojs', ['exports', 'd3', 'd3', 'd3', 'd3', 'd3'], factory) :
(factory((global.giottojs = global.giottojs || {}),global.d3,global.d3$1,global.d3$2,global.d3$3,global.d3$4));
}(this, (function (exports,d3,d3$1,d3$2,d3$3,d3$4) { 'use strict';
var navbarTpl = "<nav class=\"navbar\" d3-class=\"[theme, ['navbar-fixed-top', fixedTop]]\">\n <a class=\"navbar-brand\" d3-if=\"brand.title || brand.image\" d3-attr-href=\"brand.href || '#'\" d3-html=\"brand.title\">\n <img d3-if=\"brand.image\" d3-attr-src=\"brand.image\" d3-attr-alt=\"brand.title\">\n </a>\n <ul class=\"nav navbar-nav\">\n <li d3-for=\"item in items\" class=\"nav-item\" d3-class=\"item.class\" d3-active>\n <a class=\"nav-link\"\n d3-attr-href=\"item.href || '#'\"\n d3-html=\"item.title\"\n d3-if=\"item.show ? item.show() : true\"\n d3-on-click=\"item.click ? item.click() : null\"></a>\n </li>\n </ul>\n</nav>";
var navbar = {
model: {
fixedTop: true,
theme: "navbar-light bg-faded",
brand: {},
items: []
},
render: function render() {
return d3.viewElement(navbarTpl);
}
};
var messagesTpl = '<div class="messages"></div>';
var levels = {
error: 'danger'
};
// component render function
var messages = function () {
var self = this;
this.root.events.on('message', function (data) {
self.sel.append(function () {
return messageEl(data);
}).call(fadeIn);
});
return d3.viewElement(messagesTpl);
};
function messageEl(data) {
var level = data.level;
if (!level) {
if (data.error) level = 'error';else if (data.success) level = 'success';
}
level = levels[level] || level || 'info';
return d3.viewElement('<div class="alert alert-' + level + '" role="alert" style="opacity: 0">\n' + data.message + '\n</div>');
}
function fadeIn(selection) {
return selection.transition().duration(300).style("opacity", 1);
}
var year = {
render: function render() {
var year = new Date().getFullYear();
return this.viewElement("<span>" + year + "</span>");
}
};
var grid = {
props: ['json'],
render: function render(data) {
var json = data.json,
container = this.createElement('div').classed('d3-grid', true),
self = this;
// grid properties are remote
if (d3$3.isString(json)) {
this.fetch(json).then(self.build);
}
return container;
},
build: function build(data) {
if (data.target) this.fetch(data.target);
}
};
var components = {
install: function install(vm) {
vm.addComponent('navbar', navbar);
vm.addComponent('messages', messages);
vm.addComponent('year', year);
vm.addComponent('d3grid', grid);
}
};
var fullpage = {
create: function create(expression) {
return expression || "true";
},
refresh: function refresh() {
var height = d3$4.window(this.el).innerHeight;
this.sel.style('min-height', height + 'px');
}
};
var highlight = {
create: function create(expression) {
return expression || 'true';
},
refresh: function refresh() {
var el = this.el;
require(['/highlight.js'], function (hljs) {
highlight$1(hljs, el);
});
}
};
function highlight$1(hljs, elem) {
d3$4.select(elem).selectAll('code').selectAll(function () {
if (this.parentNode.tagName === 'PRE') {
hljs.highlightBlock(this);
d3$4.select(this.parentNode).classed('hljs', true);
}
// Don't modify inlines
//else {
// select(this).classed('hljs inline', true);
//}
});
d3$4.select(elem).selectAll('.highlight pre').selectAll(function () {
var div = this.parentNode,
parent = div ? div.parentNode : null;
d3$4.select(this).classed('hljs', true);
if (parent && parent.className.substring(0, 10) === 'highlight-') d3$4.select(div).classed('language-' + parent.className.substring(10), true);
hljs.highlightBlock(this);
});
}
var directives = {
install: function install(vm) {
vm.addDirective('fullpage', fullpage);
vm.addDirective('highlight', highlight);
}
};
// model for the giottojs application
var modelApp = function () {
var model = {
d3: d3$1,
mainNavbar: {
brand: {
href: '/',
image: '/giotto-banner.svg'
},
theme: 'navbar-dark',
items: [{
href: '/examples',
title: 'examples',
'class': 'float-xs-right'
}]
}
};
return model;
};
d3.viewReady(start);
// Start the application
function start() {
// Build the model-view pair
var vm = d3.view({
model: modelApp()
});
//
// Mount the UI
vm.use(components).use(directives).use(d3$1.fluidPlugin).mount('body');
}
exports.directives = directives;
exports.components = components;
Object.defineProperty(exports, '__esModule', { value: true });
})));
require(['giottojs']);
| {
"content_hash": "eae0b9d2fc3192eaa609bd3ec9da1bae",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 741,
"avg_line_length": 29.28723404255319,
"alnum_prop": 0.5535779150018162,
"repo_name": "quantmind/giottojs.org",
"id": "795dc64708991127e8bc07ed8a567c77e77babbc",
"size": "5506",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "giottojs.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "85509"
},
{
"name": "JavaScript",
"bytes": "3055591"
},
{
"name": "Python",
"bytes": "4216"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>regexp: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.0 / regexp - 8.7.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
regexp
<small>
8.7.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-30 01:13:34 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-30 01:13:34 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/regexp"
license: "LGPL"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/RegExp"]
depends: [
"ocaml"
"coq" {>= "8.7" & < "8.8~"}
]
tags: [
"keyword: regular expressions"
"keyword: Kleene algebra"
"category: Computer Science/Formal Languages Theory and Automata"
]
authors: [ "Takashi Miyamoto <[email protected]> [http://study-func-prog.blogspot.com/]" ]
bug-reports: "https://github.com/coq-contribs/regexp/issues"
dev-repo: "git+https://github.com/coq-contribs/regexp.git"
synopsis: "Regular Expression"
description: """
The Library RegExp is a Coq library for regular expression. The implementation is based on the Janusz Brzozowski's algorithm ("Derivatives of Regular Expressions", Journal of the ACM 1964).
The RegExp library satisfies the axioms of Kleene Algebra. The proofs are shown in the library."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/regexp/archive/v8.7.0.tar.gz"
checksum: "md5=ea5fb8370ee2f55d922cdff26faea9c3"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-regexp.8.7.0 coq.8.5.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0).
The following dependencies couldn't be met:
- coq-regexp -> coq >= 8.7
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-regexp.8.7.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "ef22a841aacb8b797baf17d3cded2f73",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 203,
"avg_line_length": 41.875739644970416,
"alnum_prop": 0.5481136074607885,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "cf75bca75e832c01eb3020d03325a9a679ed60ce",
"size": "7102",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.5.0/regexp/8.7.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
if __name__ == '__main__':
num_integers = int(input())
integers = tuple(map(int, input().split()))
print(hash(integers))
| {
"content_hash": "374494f60280445da7d02371f0d4618c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 47,
"avg_line_length": 33.25,
"alnum_prop": 0.5639097744360902,
"repo_name": "rootulp/hackerrank",
"id": "f0e278e06fe751e785ca9e03a11ba76bffad5166",
"size": "133",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "python/python-tuples.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "695"
},
{
"name": "HTML",
"bytes": "3180"
},
{
"name": "Java",
"bytes": "55554"
},
{
"name": "JavaScript",
"bytes": "18863"
},
{
"name": "Python",
"bytes": "116652"
},
{
"name": "Ruby",
"bytes": "44389"
},
{
"name": "Shell",
"bytes": "1226"
}
],
"symlink_target": ""
} |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/interior_components/shared_alarm_interior.iff"
result.attribute_template_id = 8
result.stfName("space/space_item","alarm_interior_n")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "5610583ed929f866217f7d8ad050eae5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 25.384615384615383,
"alnum_prop": 0.7121212121212122,
"repo_name": "anhstudios/swganh",
"id": "ba76e88658ee572738b1f149c662a5741c649bce",
"size": "475",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "data/scripts/templates/object/tangible/ship/interior_components/shared_alarm_interior.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "11887"
},
{
"name": "C",
"bytes": "7699"
},
{
"name": "C++",
"bytes": "2357839"
},
{
"name": "CMake",
"bytes": "41264"
},
{
"name": "PLSQL",
"bytes": "42065"
},
{
"name": "Python",
"bytes": "7503510"
},
{
"name": "SQLPL",
"bytes": "42770"
}
],
"symlink_target": ""
} |
package uk.gov.ons.ctp.response.casesvc.scheduled.distribution;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
import ma.glasnost.orika.MapperFacade;
import uk.gov.ons.ctp.common.distributed.DistributedListManager;
import uk.gov.ons.ctp.common.state.StateTransitionManager;
import uk.gov.ons.ctp.response.casesvc.config.AppConfig;
import uk.gov.ons.ctp.response.casesvc.config.CaseDistribution;
import uk.gov.ons.ctp.response.casesvc.config.InternetAccessCodeSvc;
import uk.gov.ons.ctp.response.casesvc.domain.repository.CaseRepository;
import uk.gov.ons.ctp.response.casesvc.message.CaseNotificationPublisher;
import uk.gov.ons.ctp.response.casesvc.representation.CaseDTO.CaseState;
import uk.gov.ons.ctp.response.casesvc.service.InternetAccessCodeSvcClientService;
/**
* Test the action distributor
*/
@RunWith(MockitoJUnitRunner.class)
public class CaseDistributorTest {
private static final int I_HATE_CHECKSTYLE_TEN = 10;
private static final long I_HATE_CHECKSTYLE_TEN_LONG = 10L;
@Spy
private AppConfig appConfig = new AppConfig();
@Mock
private CaseNotificationPublisher caseNotificationPublisher;
@Mock
Tracer tracer;
@Mock
Span span;
@Mock
DistributedListManager<Integer> caseDistributionListManager;
@Mock
private StateTransitionManager<CaseState, uk.gov.ons.ctp.response.casesvc.representation.CaseDTO.CaseEvent> caseSvcStateTransitionManager;
@Mock
private MapperFacade mapperFacade;
@Mock
private InternetAccessCodeSvcClientService internetAccessCodeSvcClientService;
@Mock
private CaseRepository caseRepo;
@Mock
private TransactionTemplate transactionTemplate;
@Mock
private PlatformTransactionManager platformTransactionManager;
@InjectMocks
private CaseDistributor caseDistributor;
/**
* A Test
*/
@Before
public void setup() {
InternetAccessCodeSvc internetAccessCodeSvc = new InternetAccessCodeSvc();
CaseDistribution caseDistributionConfig = new CaseDistribution();
caseDistributionConfig.setDelayMilliSeconds(I_HATE_CHECKSTYLE_TEN_LONG);
caseDistributionConfig.setRetrySleepSeconds(I_HATE_CHECKSTYLE_TEN);
caseDistributionConfig.setRetrievalMax(10);
caseDistributionConfig.setDistributionMax(2);
caseDistributionConfig.setIacMax(5);
appConfig.setInternetAccessCodeSvc(internetAccessCodeSvc);
appConfig.setCaseDistribution(caseDistributionConfig);
MockitoAnnotations.initMocks(this);
}
@Test
public void removeThisDummyTestOnceAllTestsReinstated() {
}
// /**
// * Test BlueSky scenario
// *
// * @throws Exception oops
// */
// @SuppressWarnings("unchecked")
// @Test
// public void testBlueSkyRetrieve10Iac2Publish5() throws Exception {
//
// Mockito.when(hazelcastInstance.getMap(any(String.class))).thenReturn(Mockito.mock(MapProxyImpl.class));
// Mockito.when(hazelcastInstance.getLocalEndpoint()).thenReturn(Mockito.mock(Endpoint.class));
//
// appConfig.getCaseDistribution().setIacMax(2);
// appConfig.getCaseDistribution().setDistributionMax(5);
//
// List<Case> cases = FixtureHelper.loadClassFixtures(Case[].class);
// List<Questionnaire> questionnaires = FixtureHelper.loadClassFixtures(Questionnaire[].class);
// List<String> iacs = Arrays.asList("bcdf-2345-lkjh", "bcdf-2345-lkjh");
//
// // wire up mock responses
// Mockito.when(
// caseSvcStateTransitionManager.transition(CaseState.SAMPLED_INIT, CaseDTO.CaseEvent.ACTIVATED))
// .thenReturn(CaseState.ACTIVE);
//
// List<CaseDTO.CaseState> states = Arrays.asList(CaseDTO.CaseState.SAMPLED_INIT);
// Mockito.when(
// caseRepo.findByStateInAndCaseIdNotIn(eq(states), anyListOf(Integer.class), any(Pageable.class)))
// .thenReturn(cases);
// Mockito.when(
// internetAccessCodeSvcClientService.generateIACs(2))
// .thenReturn(iacs);
// Mockito.when(
// questionnaireRepo.findByCaseId(1))
// .thenReturn(Arrays.asList(questionnaires.get(0)));
// Mockito.when(
// questionnaireRepo.findByCaseId(2))
// .thenReturn(Arrays.asList(questionnaires.get(1)));
// Mockito.when(
// questionnaireRepo.findByCaseId(3))
// .thenReturn(Arrays.asList(questionnaires.get(2)));
// Mockito.when(
// questionnaireRepo.findByCaseId(4))
// .thenReturn(Arrays.asList(questionnaires.get(3)));
// Mockito.when(
// questionnaireRepo.findByCaseId(5))
// .thenReturn(Arrays.asList(questionnaires.get(4)));
// Mockito.when(
// questionnaireRepo.findByCaseId(6))
// .thenReturn(Arrays.asList(questionnaires.get(5)));
// Mockito.when(
// questionnaireRepo.findByCaseId(7))
// .thenReturn(Arrays.asList(questionnaires.get(6)));
// Mockito.when(
// questionnaireRepo.findByCaseId(8))
// .thenReturn(Arrays.asList(questionnaires.get(7)));
// Mockito.when(
// questionnaireRepo.findByCaseId(9))
// .thenReturn(Arrays.asList(questionnaires.get(8)));
// Mockito.when(
// questionnaireRepo.findByCaseId(10))
// .thenReturn(Arrays.asList(questionnaires.get(9)));
//
// // let it roll
// caseDistributor.distribute();
//
// verify(caseRepo).findByStateInAndCaseIdNotIn(eq(states), anyListOf(Integer.class), any(Pageable.class));
// verify(internetAccessCodeSvcClientService, times(5)).generateIACs(2);
// verify(questionnaireRepo).findByCaseId(1);
// verify(questionnaireRepo).findByCaseId(2);
// verify(questionnaireRepo).findByCaseId(3);
// verify(questionnaireRepo).findByCaseId(4);
// verify(questionnaireRepo).findByCaseId(5);
// verify(questionnaireRepo).findByCaseId(6);
// verify(questionnaireRepo).findByCaseId(7);
// verify(questionnaireRepo).findByCaseId(8);
// verify(questionnaireRepo).findByCaseId(9);
// verify(questionnaireRepo).findByCaseId(10);
// verify(questionnaireRepo, times(10)).save(any(Questionnaire.class));
// verify(caseRepo, times(10)).saveAndFlush(any(Case.class));
// verify(caseNotificationPublisher, times(2)).sendNotifications(anyListOf(CaseNotification.class));
// }
//
// /**
// * Test BlueSky scenario
// *
// * @throws Exception oops
// */
// @SuppressWarnings("unchecked")
// @Test
// public void testBlueSkyRetrieve10Iac5Publish2() throws Exception {
//
// Mockito.when(hazelcastInstance.getMap(any(String.class))).thenReturn(Mockito.mock(MapProxyImpl.class));
// Mockito.when(hazelcastInstance.getLocalEndpoint()).thenReturn(Mockito.mock(Endpoint.class));
//
// List<Case> cases = FixtureHelper.loadClassFixtures(Case[].class);
// List<Questionnaire> questionnaires = FixtureHelper.loadClassFixtures(Questionnaire[].class);
// List<String> iacs = Arrays.asList("bcdf-2345-lkjh", "bcdf-2345-lkjh", "bcdf-2345-lkjh", "bcdf-2345-lkjh",
// "bcdf-2345-lkjh");
//
// // wire up mock responses
// Mockito.when(
// caseSvcStateTransitionManager.transition(CaseState.SAMPLED_INIT, CaseDTO.CaseEvent.ACTIVATED))
// .thenReturn(CaseState.ACTIVE);
//
// List<CaseDTO.CaseState> states = Arrays.asList(CaseDTO.CaseState.SAMPLED_INIT);
// Mockito.when(
// caseRepo.findByStateInAndCaseIdNotIn(eq(states), anyListOf(Integer.class), any(Pageable.class)))
// .thenReturn(cases);
// Mockito.when(
// internetAccessCodeSvcClientService.generateIACs(5))
// .thenReturn(iacs);
// Mockito.when(
// questionnaireRepo.findByCaseId(1))
// .thenReturn(Arrays.asList(questionnaires.get(0)));
// Mockito.when(
// questionnaireRepo.findByCaseId(2))
// .thenReturn(Arrays.asList(questionnaires.get(1)));
// Mockito.when(
// questionnaireRepo.findByCaseId(3))
// .thenReturn(Arrays.asList(questionnaires.get(2)));
// Mockito.when(
// questionnaireRepo.findByCaseId(4))
// .thenReturn(Arrays.asList(questionnaires.get(3)));
// Mockito.when(
// questionnaireRepo.findByCaseId(5))
// .thenReturn(Arrays.asList(questionnaires.get(4)));
// Mockito.when(
// questionnaireRepo.findByCaseId(6))
// .thenReturn(Arrays.asList(questionnaires.get(5)));
// Mockito.when(
// questionnaireRepo.findByCaseId(7))
// .thenReturn(Arrays.asList(questionnaires.get(6)));
// Mockito.when(
// questionnaireRepo.findByCaseId(8))
// .thenReturn(Arrays.asList(questionnaires.get(7)));
// Mockito.when(
// questionnaireRepo.findByCaseId(9))
// .thenReturn(Arrays.asList(questionnaires.get(8)));
// Mockito.when(
// questionnaireRepo.findByCaseId(10))
// .thenReturn(Arrays.asList(questionnaires.get(9)));
//
// // let it roll
// caseDistributor.distribute();
//
// verify(caseRepo).findByStateInAndCaseIdNotIn(eq(states), anyListOf(Integer.class), any(Pageable.class));
// verify(internetAccessCodeSvcClientService, times(2)).generateIACs(5);
// verify(questionnaireRepo).findByCaseId(1);
// verify(questionnaireRepo).findByCaseId(2);
// verify(questionnaireRepo).findByCaseId(3);
// verify(questionnaireRepo).findByCaseId(4);
// verify(questionnaireRepo).findByCaseId(5);
// verify(questionnaireRepo).findByCaseId(6);
// verify(questionnaireRepo).findByCaseId(7);
// verify(questionnaireRepo).findByCaseId(8);
// verify(questionnaireRepo).findByCaseId(9);
// verify(questionnaireRepo).findByCaseId(10);
// verify(questionnaireRepo, times(10)).save(any(Questionnaire.class));
// verify(caseRepo, times(10)).saveAndFlush(any(Case.class));
// verify(caseNotificationPublisher, times(5)).sendNotifications(anyListOf(CaseNotification.class));
// }
//
// /**
// * Test that when we fail at first hurdle to load Cases we do not go on to
// * call anything else In reality the wakeup method would then be called again
// * after a sleep interval by spring but we cannot test that here
// *
// * @throws Exception oops
// */
// @SuppressWarnings("unchecked")
// @Test
// public void testDBFailure() throws Exception {
//
// Mockito.when(hazelcastInstance.getMap(any(String.class))).thenReturn(Mockito.mock(MapProxyImpl.class));
// Mockito.when(hazelcastInstance.getLocalEndpoint()).thenReturn(Mockito.mock(Endpoint.class));
//
// // wire up mock responses
// List<CaseDTO.CaseState> states = Arrays.asList(CaseDTO.CaseState.SAMPLED_INIT);
// Mockito.when(
// caseRepo.findByStateInAndCaseIdNotIn(eq(states), anyListOf(Integer.class), any(Pageable.class)))
// .thenThrow(new RuntimeException("Database access failed"));
//
// // let it roll
// caseDistributor.distribute();
//
// verify(caseRepo).findByStateInAndCaseIdNotIn(eq(states), anyListOf(Integer.class), any(Pageable.class));
// verify(internetAccessCodeSvcClientService, times(0)).generateIACs(any(Integer.class));
// verify(questionnaireRepo, times(0)).findByCaseId(any(Integer.class));
// verify(questionnaireRepo, times(0)).save(any(Questionnaire.class));
// verify(caseRepo, times(0)).saveAndFlush(any(Case.class));
// verify(caseNotificationPublisher, times(0)).sendNotifications(anyListOf(CaseNotification.class));
// }
//
}
| {
"content_hash": "e6a008762a49a2cbfc09c45b0eb582d1",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 140,
"avg_line_length": 40.31707317073171,
"alnum_prop": 0.7223230490018149,
"repo_name": "ONSdigital/response-management-service",
"id": "a2043e40f628e69dc25b55dda4b300c43e125535",
"size": "11571",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "casesvc/src/test/java/uk/gov/ons/ctp/response/casesvc/scheduled/distribution/CaseDistributorTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "FreeMarker",
"bytes": "1332"
},
{
"name": "Java",
"bytes": "561715"
},
{
"name": "PLpgSQL",
"bytes": "17317"
},
{
"name": "Ruby",
"bytes": "1376"
},
{
"name": "Shell",
"bytes": "36693"
}
],
"symlink_target": ""
} |
typedef void(^SuccessHandle)(NSURLSessionDataTask *task, id responseObject);
typedef void(^FailureHandle)(NSError *error);
typedef NS_ENUM(NSUInteger, YFRequestDataType) {
YFRequestDataTypeDay = 0,
YFRequestDataTypeWeek,
YFRequestDataTypeMonth,
};
@interface YFSessionManager : AFHTTPSessionManager
+ (instancetype)sharedSessionManager;
- (void)get:(NSString *)stockCode dataType:(YFRequestDataType)dataType success:(SuccessHandle)successHandle failure:(FailureHandle)failureHandle;
@end
| {
"content_hash": "56b7efb01887ee2a54da9b4689e27fe7",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 145,
"avg_line_length": 29.764705882352942,
"alnum_prop": 0.8043478260869565,
"repo_name": "OceanHorn/chartee",
"id": "932426f030eb309a8b745eb880f2144f440e9bb1",
"size": "685",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ios/Classes/lib/NetworkTool/YFSessionManager.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "147937"
},
{
"name": "Ruby",
"bytes": "308"
}
],
"symlink_target": ""
} |
package kubelet
import (
"encoding/json"
"net/http/httptest"
"strconv"
"strings"
"testing"
"time"
cadvisor_api "github.com/google/cadvisor/info/v1"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/heapster/metrics/core"
kube_api "k8s.io/kubernetes/pkg/api"
util "k8s.io/kubernetes/pkg/util/testing"
)
func TestDecodeMetrics1(t *testing.T) {
kMS := kubeletMetricsSource{
nodename: "test",
hostname: "test-hostname",
}
c1 := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "/",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
Cpu: cadvisor_api.CpuStats{
Usage: cadvisor_api.CpuUsage{
Total: 100,
PerCpu: []uint64{5, 10},
User: 1,
System: 1,
},
LoadAverage: 20,
},
},
},
}
metricSetKey, metricSet := kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "node:test")
assert.Equal(t, metricSet.Labels[core.LabelMetricSetType.Key], core.MetricSetTypeNode)
}
func TestDecodeMetrics2(t *testing.T) {
kMS := kubeletMetricsSource{
nodename: "test",
hostname: "test-hostname",
}
c1 := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "/",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
Cpu: cadvisor_api.CpuStats{
Usage: cadvisor_api.CpuUsage{
Total: 100,
PerCpu: []uint64{5, 10},
User: 1,
System: 1,
},
LoadAverage: 20,
},
},
},
}
metricSetKey, metricSet := kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "node:test")
assert.Equal(t, metricSet.Labels[core.LabelMetricSetType.Key], core.MetricSetTypeNode)
}
func TestDecodeMetrics3(t *testing.T) {
kMS := kubeletMetricsSource{
nodename: "test",
hostname: "test-hostname",
}
c1 := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "/docker-daemon",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
Cpu: cadvisor_api.CpuStats{
Usage: cadvisor_api.CpuUsage{
Total: 100,
PerCpu: []uint64{5, 10},
User: 1,
System: 1,
},
LoadAverage: 20,
},
},
},
}
metricSetKey, _ := kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "node:test/container:docker-daemon")
}
func TestDecodeMetrics4(t *testing.T) {
kMS := kubeletMetricsSource{
nodename: "test",
hostname: "test-hostname",
}
c1 := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "testKubelet",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
Labels: make(map[string]string),
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
Cpu: cadvisor_api.CpuStats{
Usage: cadvisor_api.CpuUsage{
Total: 100,
PerCpu: []uint64{5, 10},
User: 1,
System: 1,
},
LoadAverage: 20,
},
},
},
}
c1.Spec.Labels[kubernetesContainerLabel] = "testContainer"
c1.Spec.Labels[kubernetesPodNamespaceLabel] = "testPodNS"
c1.Spec.Labels[kubernetesPodNameLabel] = "testPodName"
metricSetKey, metricSet := kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "namespace:testPodNS/pod:testPodName/container:testContainer")
assert.Equal(t, metricSet.Labels[core.LabelMetricSetType.Key], core.MetricSetTypePodContainer)
}
func TestDecodeMetrics5(t *testing.T) {
kMS := kubeletMetricsSource{
nodename: "test",
hostname: "test-hostname",
}
c1 := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "k8s_test.testkubelet",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
Labels: make(map[string]string),
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
Cpu: cadvisor_api.CpuStats{
Usage: cadvisor_api.CpuUsage{
Total: 100,
PerCpu: []uint64{5, 10},
User: 1,
System: 1,
},
LoadAverage: 20,
},
},
},
}
c1.Spec.Labels[kubernetesContainerLabel] = "POD"
c1.Spec.Labels[kubernetesPodNameLabel] = "testnamespace/testPodName"
metricSetKey, metricSet := kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "namespace:testnamespace/pod:testPodName")
assert.Equal(t, metricSet.Labels[core.LabelMetricSetType.Key], core.MetricSetTypePod)
c1.Spec.Labels[kubernetesContainerLabel] = ""
c1.Spec.Labels[kubernetesPodNameLabel] = "testnamespace/testPodName"
metricSetKey, metricSet = kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "namespace:testnamespace/pod:testPodName/container:test")
assert.Equal(t, metricSet.Labels[core.LabelMetricSetType.Key], core.MetricSetTypePodContainer)
}
func TestDecodeMetrics6(t *testing.T) {
kMS := kubeletMetricsSource{
nodename: "test",
hostname: "test-hostname",
}
c1 := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "/",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCustomMetrics: true,
CustomMetrics: []cadvisor_api.MetricSpec{
{
Name: "test1",
Type: cadvisor_api.MetricGauge,
Format: cadvisor_api.IntType,
},
{
Name: "test2",
Type: cadvisor_api.MetricCumulative,
Format: cadvisor_api.IntType,
},
{
Name: "test3",
Type: cadvisor_api.MetricGauge,
Format: cadvisor_api.FloatType,
},
{
Name: "test4",
Type: cadvisor_api.MetricCumulative,
Format: cadvisor_api.FloatType,
},
},
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
Cpu: cadvisor_api.CpuStats{
Usage: cadvisor_api.CpuUsage{
Total: 100,
PerCpu: []uint64{5, 10},
User: 1,
System: 1,
},
LoadAverage: 20,
},
CustomMetrics: map[string][]cadvisor_api.MetricVal{
"test1": {
{
Label: "test1",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
"test2": {
{
Label: "test2",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
"test3": {
{
Label: "test3",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
"test4": {
{
Label: "test4",
Timestamp: time.Now(),
IntValue: 1,
FloatValue: 1.0,
},
},
},
},
},
}
metricSetKey, metricSet := kMS.decodeMetrics(&c1)
assert.Equal(t, metricSetKey, "node:test")
assert.Equal(t, metricSet.Labels[core.LabelMetricSetType.Key], core.MetricSetTypeNode)
}
var nodes = []kube_api.Node{
{
ObjectMeta: kube_api.ObjectMeta{
Name: "testNode",
},
Status: kube_api.NodeStatus{
Conditions: []kube_api.NodeCondition{
{
Type: "NotReady",
Status: kube_api.ConditionTrue,
},
},
Addresses: []kube_api.NodeAddress{
{
Type: kube_api.NodeHostName,
Address: "testNode",
},
{
Type: kube_api.NodeInternalIP,
Address: "127.0.0.1",
},
},
},
},
{
ObjectMeta: kube_api.ObjectMeta{
Name: "testNode",
},
Status: kube_api.NodeStatus{
Conditions: []kube_api.NodeCondition{
{
Type: "NotReady",
Status: kube_api.ConditionTrue,
},
},
Addresses: []kube_api.NodeAddress{
{
Type: kube_api.NodeHostName,
Address: "testNode",
},
{
Type: kube_api.NodeLegacyHostIP,
Address: "127.0.0.1",
},
},
},
},
{
ObjectMeta: kube_api.ObjectMeta{
Name: "testNode",
},
Status: kube_api.NodeStatus{
Conditions: []kube_api.NodeCondition{
{
Type: "NotReady",
Status: kube_api.ConditionTrue,
},
},
Addresses: []kube_api.NodeAddress{
{
Type: kube_api.NodeHostName,
Address: "testNode",
},
{
Type: kube_api.NodeLegacyHostIP,
Address: "127.0.0.2",
},
{
Type: kube_api.NodeInternalIP,
Address: "127.0.0.1",
},
},
},
},
}
func TestGetNodeHostnameAndIP(t *testing.T) {
for _, node := range nodes {
hostname, ip, err := getNodeHostnameAndIP(&node)
assert.NoError(t, err)
assert.Equal(t, hostname, "testNode")
assert.Equal(t, ip, "127.0.0.1")
}
}
func TestScrapeMetrics(t *testing.T) {
rootContainer := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "/",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
HasMemory: true,
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
},
},
}
subcontainer := cadvisor_api.ContainerInfo{
ContainerReference: cadvisor_api.ContainerReference{
Name: "/docker-daemon",
},
Spec: cadvisor_api.ContainerSpec{
CreationTime: time.Now(),
HasCpu: true,
HasMemory: true,
},
Stats: []*cadvisor_api.ContainerStats{
{
Timestamp: time.Now(),
},
},
}
response := map[string]cadvisor_api.ContainerInfo{
rootContainer.Name: {
ContainerReference: cadvisor_api.ContainerReference{
Name: rootContainer.Name,
},
Spec: rootContainer.Spec,
Stats: []*cadvisor_api.ContainerStats{
rootContainer.Stats[0],
},
},
subcontainer.Name: {
ContainerReference: cadvisor_api.ContainerReference{
Name: subcontainer.Name,
},
Spec: subcontainer.Spec,
Stats: []*cadvisor_api.ContainerStats{
subcontainer.Stats[0],
},
},
}
data, err := json.Marshal(&response)
require.NoError(t, err)
handler := util.FakeHandler{
StatusCode: 200,
RequestBody: "",
ResponseBody: string(data),
T: t,
}
server := httptest.NewServer(&handler)
defer server.Close()
var client KubeletClient
mtrcSrc := kubeletMetricsSource{
kubeletClient: &client,
}
split := strings.SplitN(strings.Replace(server.URL, "http://", "", 1), ":", 2)
mtrcSrc.host.IP = split[0]
mtrcSrc.host.Port, err = strconv.Atoi(split[1])
start := time.Now()
end := start.Add(5 * time.Second)
res := mtrcSrc.ScrapeMetrics(start, end)
assert.Equal(t, res.MetricSets["node:/container:docker-daemon"].Labels["type"], "sys_container")
assert.Equal(t, res.MetricSets["node:/container:docker-daemon"].Labels["container_name"], "docker-daemon")
}
| {
"content_hash": "a243efa23a56203daa82d89eb27bf1a5",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 107,
"avg_line_length": 23.633333333333333,
"alnum_prop": 0.6320639398213446,
"repo_name": "jackzampolin/heapster",
"id": "d8bf280e5376b0c5822d25b05133e18910a34e55",
"size": "11244",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "metrics/sources/kubelet/kubelet_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Clojure",
"bytes": "4146"
},
{
"name": "Go",
"bytes": "724094"
},
{
"name": "Makefile",
"bytes": "10052"
},
{
"name": "Shell",
"bytes": "15325"
}
],
"symlink_target": ""
} |
NS_ASSUME_NONNULL_BEGIN
NSBundle *TNKImagePickerControllerBundle();
UIImage *__nullable TNKImagePickerControllerImageNamed(NSString *imageName);
NS_ASSUME_NONNULL_END
| {
"content_hash": "19338a486a7ce518211f3b21226c997e",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 76,
"avg_line_length": 28.166666666666668,
"alnum_prop": 0.8402366863905325,
"repo_name": "a2/TNKImagePickerController",
"id": "7a33be4d0bfb20229a7ba5a45cb2edc296a424c3",
"size": "291",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/TNKImagePickerControllerBundle.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "190093"
},
{
"name": "Ruby",
"bytes": "1308"
},
{
"name": "Shell",
"bytes": "16646"
},
{
"name": "Swift",
"bytes": "2980"
}
],
"symlink_target": ""
} |
name 'travis_postgresql'
maintainer 'Travis CI Team'
maintainer_email '[email protected]'
license 'Apache 2.0'
description 'Installs PostgreSQL instance(s) for Continuation Integration purposes'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '3.0.0'
depends 'apt'
| {
"content_hash": "811256d509ad05f77530e26269f90e39",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 83,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.7818181818181819,
"repo_name": "spurti-chopra/travis-cookbooks",
"id": "8582c843d83520ae235bf9c5fe159452a9606037",
"size": "330",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "cookbooks/travis_postgresql/metadata.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "141754"
},
{
"name": "Ruby",
"bytes": "177472"
},
{
"name": "Shell",
"bytes": "10546"
}
],
"symlink_target": ""
} |
import pycurl
import StringIO
curl = pycurl.Curl()
curl.setopt(pycurl.URL, "http://hq.sinajs.cn/list=sh601006")
string = StringIO.StringIO()
curl.setopt(pycurl.WRITEFUNCTION,string.write)
curl.setopt(pycurl.FOLLOWLOCATION, 1)
curl.perform()
print curl.getinfo(pycurl.EFFECTIVE_URL)
html = string.getvalue();
#print html | {
"content_hash": "7be793f66a63e1130250e1919858a512",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 60,
"avg_line_length": 23,
"alnum_prop": 0.7763975155279503,
"repo_name": "CornerZhang/Learning_Python",
"id": "ce401c8b92864451482bfb444a95a833cf534534",
"size": "322",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "stock_price.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "1711"
}
],
"symlink_target": ""
} |
from unittest import TestCase
from chatterbot.conversation import Statement
from chatterbot.adapters.io import JsonAdapter
class JsonAdapterTests(TestCase):
def setUp(self):
self.adapter = JsonAdapter()
def test_response_json_returned(self):
statement = Statement("Robot ipsum datus scan amet.")
response = self.adapter.process_response(statement)
self.assertEqual(statement.text, response["text"])
self.assertIn("in_response_to", response)
| {
"content_hash": "1558c069b871f941f0ee2b6fc220ff87",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 61,
"avg_line_length": 29.11764705882353,
"alnum_prop": 0.7232323232323232,
"repo_name": "DarkmatterVale/ChatterBot",
"id": "fb89df38f35b5e90ab0705fe9782f8780b4c1896",
"size": "495",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/io_adapter_tests/test_json_adapter.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "113984"
}
],
"symlink_target": ""
} |
@interface CSViewController ()
@end
@implementation CSViewController {
GoogleChromeIACClient *chromeClient;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.urlField.text = @"http://tapsandswipes.com";
[self openURLString:self.urlField.text];
chromeClient = [GoogleChromeIACClient client];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (![chromeClient isAppInstalled]) {
self.openButton.title = @"Install chrome";
}
}
- (IBAction)openInChrome:(id)sender {
if ([chromeClient isAppInstalled]) {
[chromeClient openURL:self.urlField.text
onSuccess:^{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Back from Chrome"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
onFailure:^(NSError *error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}];
} else {
if (NSClassFromString(@"SKStoreProductViewController")) {
self.openButton.enabled = NO;
SKStoreProductViewController *controller = [[SKStoreProductViewController alloc] init];
controller.delegate = self;
[controller loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier: @"535886823"} completionBlock:^(BOOL result, NSError *error){
if (result) {
[self presentModalViewController:controller animated:YES];
} else {
self.openButton.enabled = YES;
}
}];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=535886823"]];
}
}
}
- (void)openURLString:(NSString*)url {
[self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
if ([[request.URL scheme] hasPrefix:@"http"]) {
self.urlField.text = [request.URL absoluteString];
}
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[self openURLString:self.urlField.text];
[textField resignFirstResponder];
return YES;
}
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[self dismissModalViewControllerAnimated:YES];
self.openButton.enabled = YES;
}
@end
| {
"content_hash": "16dbd634cb2c2a57dd003982434a67d0",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 165,
"avg_line_length": 37.108695652173914,
"alnum_prop": 0.546572934973638,
"repo_name": "ngocluu/InterAppCommunication",
"id": "6a45cac0664d96b22eb8bfd05f5896e0fb4d9b99",
"size": "3647",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Samples/Google Chrome Integration/ChromeSample/CSViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "25940"
},
{
"name": "Ruby",
"bytes": "574"
}
],
"symlink_target": ""
} |
Rack::Attack.safelist_ip('127.0.0.1')
Rack::Attack.safelist_ip('::1')
# Set a long block period for any client that is explicitly looking for security holes
Rack::Attack.blocklist('malicious_clients') do |req|
Rack::Attack::Fail2Ban.filter("fail2ban_malicious_#{req.ip}", maxretry: 1, findtime: 1.day, bantime: 1.day) do
CGI.unescape(req.query_string) =~ %r{/etc/passwd} ||
req.path.include?('/etc/passwd') ||
req.path.include?('wp-admin') ||
req.path.include?('wp-login') ||
/\S+\.php/.match?(req.path)
end
end
### Configure Cache ###
# If you don't want to use Rails.cache (Rack::Attack's default), then
# configure it here.
#
# Note: The store is only used for throttling (not blocklisting and
# safelisting). It must implement .increment and .write like
# ActiveSupport::Cache::Store
# Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
### Throttle Spammy Clients ###
# If any single client IP is making tons of requests, then they're
# probably malicious or a poorly-configured scraper. Either way, they
# don't deserve to hog all of the app server's CPU. Cut them off!
#
# Note: If you're serving assets through rack, those requests may be
# counted by rack-attack and this throttle may be activated too
# quickly. If so, enable the condition to exclude them from tracking.
# Throttle all requests by IP (60rpm)
#
# Key: "rack::attack:#{Time.now.to_i/:period}:req/ip:#{req.ip}"
Rack::Attack.throttle('req/ip', limit: 100, period: 1.minute) do |req|
req.ip unless req.path.start_with?('/assets')
end
### Prevent Brute-Force Login Attacks ###
# The most common brute-force login attack is a brute-force password
# attack where an attacker simply tries a large number of emails and
# passwords to see if any credentials match.
#
# Another common method of attack is to use a swarm of computers with
# different IPs to try brute-forcing a password for a specific account.
# Throttle POST requests to /login by IP address
#
# Key: "rack::attack:#{Time.now.to_i/:period}:logins/ip:#{req.ip}"
Rack::Attack.throttle('logins/ip', limit: 5, period: 20.seconds) do |req|
secure_paths = %w[/oauth/authorize /oauth/token /users/sign_in /users/auth/shibboleth
/users/auth/orcid /users/password /users]
req.ip if secure_paths.include?(req.path) && req.post?
end
# Throttle POST requests to /login by email param
#
# Key: "rack::attack:#{Time.now.to_i/:period}:logins/email:#{normalized_email}"
#
# Note: This creates a problem where a malicious user could intentionally
# throttle logins for another user and force their login requests to be
# denied, but that's not very common and shouldn't happen to you. (Knock
# on wood!)
# throttle('logins/email', limit: 5, period: 20.seconds) do |req|
# if req.path == '/login' && req.post?
# # Normalize the email, using the same logic as your authentication process, to
# # protect against rate limit bypasses. Return the normalized email if present, nil otherwise.
# req.params['email'].to_s.downcase.gsub(/\s+/, "").presence
# end
# end
### Custom Throttle Response ###
# By default, Rack::Attack returns an HTTP 429 for throttled responses,
# which is just fine.
#
# If you want to return 503 so that the attacker might be fooled into
# believing that they've successfully broken your app (or you just want to
# customize the response), then uncomment these lines.
# self.throttled_response = lambda do |env|
# [ 503, # status
# {}, # headers
# ['']] # body
# end
# Log the blocked requests
ActiveSupport::Notifications.subscribe(/rack_attack/) do |name, _start, _finish, _request_id, payload|
req = payload[:request]
Rails.logger.info "[Rack::Attack][Blocked] name: #{name}, rule: #{req.env['rack.attack.matched']} " \
"remote_ip: #{req.ip}, path: #{req.path}, agent: #{req.user_agent}"
end
| {
"content_hash": "b9f01e1b9440a0750a7cc30ee8c3a5f6",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 112,
"avg_line_length": 40.291666666666664,
"alnum_prop": 0.7001034126163392,
"repo_name": "CDLUC3/dmptool",
"id": "6e0025a28609f4566c8fd236babfaabd1c24f540",
"size": "3923",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "config/initializers/rack_attack.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "147592"
},
{
"name": "HTML",
"bytes": "744911"
},
{
"name": "JavaScript",
"bytes": "354862"
},
{
"name": "Procfile",
"bytes": "67"
},
{
"name": "Ruby",
"bytes": "2611915"
},
{
"name": "SCSS",
"bytes": "31628"
},
{
"name": "Shell",
"bytes": "289"
},
{
"name": "XSLT",
"bytes": "11471"
}
],
"symlink_target": ""
} |
import numpy as np
import scipy
import scipy.spatial
import Bio.PDB as PDB
def angle(v1, v2):
'''Return the angle between two vectors in radian.'''
cos = max(-1, min(1, np.dot(normalize(v1), normalize(v2))))
return np.arccos(cos)
def dihedral(p1, p2, p3, p4):
'''Return the dihedral defined by 4 points in
range [-pi, pi].
'''
v1 = normalize(p2 - p1)
v2 = normalize(p3 - p2)
v3 = normalize(p4 - p3)
n1 = normalize(np.cross(v1, v2))
n2 = normalize(np.cross(v2, v3))
c = np.dot(n1, n2)
s = np.dot(v2, np.cross(n1, n2))
return np.arctan2(s, c)
def get_phi(chain, residue):
'''Calculate the phi torsion of a residue.'''
# Get the previous residue
res_id = residue.get_id()
prev_res = chain[res_id[1] - 1]
prev_flag = prev_res.get_id()[0]
if prev_flag == 'W' or prev_flag.startswith('H_'):
raise Exception('Hetero residue type!')
# Calculate the torsion
c_prev = prev_res['C'].get_vector()
n = residue['N'].get_vector()
ca = residue['CA'].get_vector()
c = residue['C'].get_vector()
return PDB.calc_dihedral(c_prev, n, ca, c)
def get_psi(chain, residue):
'''Calculate the psi torsion of a residue.'''
# Get the next residue
res_id = residue.get_id()
next_res = chain[res_id[1] + 1]
next_flag = next_res.get_id()[0]
if next_flag == 'W' or next_flag.startswith('H_'):
raise Exception('Hetero residue type!')
# Calculate the torsion
n = residue['N'].get_vector()
ca = residue['CA'].get_vector()
c = residue['C'].get_vector()
n_next = next_res['N'].get_vector()
return PDB.calc_dihedral(n, ca, c, n_next)
def get_distance_matrix(atom_list):
'''Get the distance matrix of a list of atoms.'''
return scipy.spatial.distance.squareform(scipy.spatial.distance.pdist(
np.array([a.get_coord() for a in atom_list]), 'euclidean'))
def get_nearest_nonbonded_residues(model):
'''Return a list of 2-tuples. Each the first element of each tuple is a
residue and the second element is its nearest nonbonded residue.'''
# Get all CA atoms which are used to be the center of residues
ca_list = []
for residue in model.get_residues():
flag = residue.get_id()[0]
if flag == 'W' or flag.startswith('H_'): continue
for a in residue:
if a.get_id() == 'CA':
ca_list.append(a)
ca_coords = [a.get_coord() for a in ca_list]
# Make a KDTree for neighbor searching
kd_tree = scipy.spatial.KDTree(ca_coords)
# Find the nearest nonbonded neighbor of all residues
nearest_nb_list = []
for i in range(len(ca_list)):
res1 = ca_list[i].get_parent()
distance, indices = kd_tree.query(ca_coords[i], k=4)
for j in range(1, 4):
res2 = ca_list[indices[j]].get_parent()
if res1.get_parent().get_id() == res2.get_parent().get_id() \
and (res1.get_id()[1] + 1 == res2.get_id()[1] \
or res1.get_id()[1] - 1 == res2.get_id()[1]) : # Bonded residues
continue
nearest_nb_list.append((res1, res2))
return nearest_nb_list
def normalize(v):
'''Normalize a numpy array.'''
norm=np.linalg.norm(v)
if norm==0:
return v
return v/norm
def get_stub_matrix(p1, p2, p3):
'''Get a matrix corresponding to a coordinate frame formed by 3 points.
The origin is on p2, the y-axis is from p2 to p3; the z-axis is the
cross product of vector p1-p2 and the y-axis; the x-axis is the product
of y-axis and z-axis. The axis vectors will be the columns of the returned
matrix.
'''
y = normalize(p3 - p2)
z = normalize(np.cross(p1 - p2, y))
x = np.cross(y, z)
return np.matrix([x, y, z]).T
def get_residue_stub_matrix(residue):
'''Constructure a coordinate frame on a residue. The origin is on the CA atom;
the y-axis is from CA to C; the z-axis is the cross product of the CA-N vector and the
y-axis; the x-axis is thus defined by requiring the frame to be right handed.
Return a 3x3 matrix and a vector that transforms coordinates in the local frame to
coordinates in the global frame.
'''
n = residue['N'].get_coord()
ca = residue['CA'].get_coord()
c = residue['C'].get_coord()
return get_stub_matrix(n, ca, c), ca
def rotation_matrix_to_euler_angles(m):
'''Return the euler angles corresponding to a rotation matrix.'''
theta_x = np.arctan2(m[2][1], m[2][2])
theta_y = np.arctan2(-m[2][0], np.sqrt(m[2][1]**2 + m[2][2]**2))
theta_z = np.arctan2(m[1][0], m[0][0])
return theta_x, theta_y, theta_z
def euler_angles_to_rotation_matrix(theta_x, theta_y, theta_z):
'''Return the rotation matrix corresponding to 3 Euler angles.'''
cx = np.cos(theta_x)
sx = np.sin(theta_x)
cy = np.cos(theta_y)
sy = np.sin(theta_y)
cz = np.cos(theta_z)
sz = np.sin(theta_z)
X = np.array([[ 1, 0, 0],
[ 0, cx, -sx],
[ 0, sx, cx]])
Y = np.array([[ cy, 0, sy],
[ 0, 1, 0],
[-sy, 0, cy]])
Z = np.array([[ cz, -sz, 0],
[ sz, cz, 0],
[ 0, 0, 1]])
return np.matmul(Z, np.matmul(Y, X))
def random_unit_vector(dim=3):
'''Generate a random unit vector following the
uniform distribution on the (dim - 1) dimension sphere.
'''
while True:
v = np.random.normal(size=dim)
if np.linalg.norm(v) > 0: break
return normalize(v)
def random_rotation_matrix():
'''Generate a random rotation matrix following the
uniform distribution in SO(3).
'''
x = random_unit_vector()
t = random_unit_vector()
while np.linalg.norm(x - t) == 0:
t = random_unit_vector()
y = normalize(np.cross(x, t))
z = np.cross(x, y)
return np.array([x, y, z])
def random_euler_angles():
'''Generate a random euler angles following the
uniform distribution in SO(3).
'''
return rotation_matrix_to_euler_angles(random_rotation_matrix())
def rotation_matrix_from_axis_and_angle(u, theta):
'''Calculate a rotation matrix from an axis and an angle.'''
u = normalize(u)
x = u[0]
y = u[1]
z = u[2]
s = np.sin(theta)
c = np.cos(theta)
return np.array([[c + x**2 * (1 - c), x * y * (1 - c) - z * s, x * z * (1 - c) + y * s],
[y * x * (1 - c) + z * s, c + y**2 * (1 - c), y * z * (1 - c) - x * s ],
[z * x * (1 - c) - y * s, z * y * (1 - c) + x * s, c + z**2 * (1 - c) ]])
def rotation_matrix_to_axis_and_angle(M):
'''Calculate the axis and angle of a rotation matrix.'''
u = np.array([M[2][1] - M[1][2],
M[0][2] - M[2][0],
M[1][0] - M[0][1]])
sin_theta = np.linalg.norm(u) / 2
cos_theta = (np.trace(M) - 1) / 2
return normalize(u), np.arctan2(sin_theta, cos_theta)
def cartesian_coord_from_internal_coord(p1, p2, p3, d, theta, tau):
'''Calculate the cartesian coordinates of an atom from
three internal coordinates and three reference points.
'''
axis1 = np.cross(p1 - p2, p3 - p2)
axis2 = p3 - p2
M1 = rotation_matrix_from_axis_and_angle(axis1, theta - np.pi)
M2 = rotation_matrix_from_axis_and_angle(axis2, tau)
return p3 + d * np.dot(M2, np.dot(M1, normalize(p3 - p2)))
def cartesian_coord_to_internal_coord(p1, p2, p3, p):
'''Cacluate internal coordinates of a point from its
cartesian coordinates based on three reference points.
'''
return [np.linalg.norm(p - p3), angle(p - p3, p2 - p3), dihedral(p1, p2, p3, p)]
def calc_discrete_curvatures(p, neighbors):
'''Calculate discrete curvatures of a point p
given its neighbors in a cyclic order. Return the Gaussian
curvature at the vertex and curvatures at the edges.
'''
n = len(neighbors)
edges = [n - p for n in neighbors]
# Cacluate the Gaussian curvature
gaussian_curvature = 2 * np.pi
for i in range(n):
gaussian_curvature -= angle(edges[i], edges[(i + 1) % n])
# Calculate edge curvatures
edge_curvatures = []
for i in range(n):
edge_curvatures.append(angle(np.cross(edges[i], edges[(i + 1) % n]),
np.cross(edges[(i + 1) % n], edges[(i + 2) % n])))
return gaussian_curvature, edge_curvatures
def projection(direction, v):
'''Return the projection of vector v to the plane perpendicular
to the given direction.
'''
direction = normalize(direction)
return v - np.dot(direction, v) * direction
| {
"content_hash": "392bd5a6097e8eab3afaa500da499549",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 92,
"avg_line_length": 29.318021201413426,
"alnum_prop": 0.6091358322285163,
"repo_name": "Kortemme-Lab/protein_feature_analysis",
"id": "68db9d786d073907e00b2652f2c101230a5474bd",
"size": "8297",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ProteinFeatureAnalyzer/features/geometry.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "139416"
},
{
"name": "Shell",
"bytes": "271"
}
],
"symlink_target": ""
} |
package groovy.json;
import groovy.json.internal.CharBuf;
import groovy.json.internal.Chr;
import groovy.lang.Closure;
import groovy.util.Expando;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import java.io.File;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
import static groovy.json.JsonOutput.CLOSE_BRACE;
import static groovy.json.JsonOutput.CLOSE_BRACKET;
import static groovy.json.JsonOutput.COMMA;
import static groovy.json.JsonOutput.EMPTY_LIST_CHARS;
import static groovy.json.JsonOutput.EMPTY_MAP_CHARS;
import static groovy.json.JsonOutput.EMPTY_STRING_CHARS;
import static groovy.json.JsonOutput.OPEN_BRACE;
import static groovy.json.JsonOutput.OPEN_BRACKET;
/**
* A JsonGenerator that can be configured with various {@link JsonGenerator.Options}.
* If the default options are sufficient consider using the static {@code JsonOutput.toJson}
* methods.
*
* @see JsonGenerator.Options#build()
* @since 2.5
*/
public class DefaultJsonGenerator implements JsonGenerator {
protected final boolean excludeNulls;
protected final boolean disableUnicodeEscaping;
protected final String dateFormat;
protected final Locale dateLocale;
protected final TimeZone timezone;
protected final Set<Converter> converters = new LinkedHashSet<Converter>();
protected final Set<String> excludedFieldNames = new HashSet<String>();
protected final Set<Class<?>> excludedFieldTypes = new HashSet<Class<?>>();
protected DefaultJsonGenerator(Options options) {
excludeNulls = options.excludeNulls;
disableUnicodeEscaping = options.disableUnicodeEscaping;
dateFormat = options.dateFormat;
dateLocale = options.dateLocale;
timezone = options.timezone;
if (!options.converters.isEmpty()) {
converters.addAll(options.converters);
}
if (!options.excludedFieldNames.isEmpty()) {
excludedFieldNames.addAll(options.excludedFieldNames);
}
if (!options.excludedFieldTypes.isEmpty()) {
excludedFieldTypes.addAll(options.excludedFieldTypes);
}
}
/**
* {@inheritDoc}
*/
@Override
public String toJson(Object object) {
CharBuf buffer = CharBuf.create(255);
writeObject(object, buffer);
return buffer.toString();
}
/**
* {@inheritDoc}
*/
@Override
public boolean isExcludingFieldsNamed(String name) {
return excludedFieldNames.contains(name);
}
/**
* {@inheritDoc}
*/
@Override
public boolean isExcludingValues(Object value) {
if (value == null) {
return excludeNulls;
} else {
return shouldExcludeType(value.getClass());
}
}
/**
* Serializes Number value and writes it into specified buffer.
*/
protected void writeNumber(Class<?> numberClass, Number value, CharBuf buffer) {
if (numberClass == Integer.class) {
buffer.addInt((Integer) value);
} else if (numberClass == Long.class) {
buffer.addLong((Long) value);
} else if (numberClass == BigInteger.class) {
buffer.addBigInteger((BigInteger) value);
} else if (numberClass == BigDecimal.class) {
buffer.addBigDecimal((BigDecimal) value);
} else if (numberClass == Double.class) {
Double doubleValue = (Double) value;
if (doubleValue.isInfinite()) {
throw new JsonException("Number " + value + " can't be serialized as JSON: infinite are not allowed in JSON.");
}
if (doubleValue.isNaN()) {
throw new JsonException("Number " + value + " can't be serialized as JSON: NaN are not allowed in JSON.");
}
buffer.addDouble(doubleValue);
} else if (numberClass == Float.class) {
Float floatValue = (Float) value;
if (floatValue.isInfinite()) {
throw new JsonException("Number " + value + " can't be serialized as JSON: infinite are not allowed in JSON.");
}
if (floatValue.isNaN()) {
throw new JsonException("Number " + value + " can't be serialized as JSON: NaN are not allowed in JSON.");
}
buffer.addFloat(floatValue);
} else if (numberClass == Byte.class) {
buffer.addByte((Byte) value);
} else if (numberClass == Short.class) {
buffer.addShort((Short) value);
} else { // Handle other Number implementations
buffer.addString(value.toString());
}
}
protected void writeObject(Object object, CharBuf buffer) {
writeObject(null, object, buffer);
}
/**
* Serializes object and writes it into specified buffer.
*/
protected void writeObject(String key, Object object, CharBuf buffer) {
if (isExcludingValues(object)) {
return;
}
if (object == null) {
buffer.addNull();
return;
}
Class<?> objectClass = object.getClass();
Converter converter = findConverter(objectClass);
if (converter != null) {
writeRaw(converter.convert(object, key), buffer);
return;
}
if (CharSequence.class.isAssignableFrom(objectClass)) { // Handle String, StringBuilder, GString and other CharSequence implementations
writeCharSequence((CharSequence) object, buffer);
} else if (objectClass == Boolean.class) {
buffer.addBoolean((Boolean) object);
} else if (Number.class.isAssignableFrom(objectClass)) {
writeNumber(objectClass, (Number) object, buffer);
} else if (Date.class.isAssignableFrom(objectClass)) {
writeDate((Date) object, buffer);
} else if (Calendar.class.isAssignableFrom(objectClass)) {
writeDate(((Calendar) object).getTime(), buffer);
} else if (Map.class.isAssignableFrom(objectClass)) {
writeMap((Map) object, buffer);
} else if (Iterable.class.isAssignableFrom(objectClass)) {
writeIterator(((Iterable<?>) object).iterator(), buffer);
} else if (Iterator.class.isAssignableFrom(objectClass)) {
writeIterator((Iterator) object, buffer);
} else if (objectClass == Character.class) {
buffer.addJsonEscapedString(Chr.array((Character) object), disableUnicodeEscaping);
} else if (objectClass == URL.class) {
buffer.addJsonEscapedString(object.toString(), disableUnicodeEscaping);
} else if (objectClass == UUID.class) {
buffer.addQuoted(object.toString());
} else if (objectClass == JsonOutput.JsonUnescaped.class) {
buffer.add(object.toString());
} else if (Closure.class.isAssignableFrom(objectClass)) {
writeMap(JsonDelegate.cloneDelegateAndGetContent((Closure<?>) object), buffer);
} else if (Expando.class.isAssignableFrom(objectClass)) {
writeMap(((Expando) object).getProperties(), buffer);
} else if (Enumeration.class.isAssignableFrom(objectClass)) {
List<?> list = Collections.list((Enumeration<?>) object);
writeIterator(list.iterator(), buffer);
} else if (objectClass.isArray()) {
writeArray(objectClass, object, buffer);
} else if (Enum.class.isAssignableFrom(objectClass)) {
buffer.addQuoted(((Enum<?>) object).name());
} else if (File.class.isAssignableFrom(objectClass)) {
Map<?, ?> properties = getObjectProperties(object);
//Clean up all recursive references to File objects
Iterator<? extends Map.Entry<?, ?>> iterator = properties.entrySet().iterator();
while(iterator.hasNext()) {
Map.Entry<?,?> entry = iterator.next();
if(entry.getValue() instanceof File) {
iterator.remove();
}
}
writeMap(properties, buffer);
} else {
Map<?, ?> properties = getObjectProperties(object);
writeMap(properties, buffer);
}
}
protected Map<?, ?> getObjectProperties(Object object) {
Map<?, ?> properties = DefaultGroovyMethods.getProperties(object);
properties.remove("class");
properties.remove("declaringClass");
properties.remove("metaClass");
return properties;
}
/**
* Serializes any char sequence and writes it into specified buffer.
*/
protected void writeCharSequence(CharSequence seq, CharBuf buffer) {
if (seq.length() > 0) {
buffer.addJsonEscapedString(seq.toString(), disableUnicodeEscaping);
} else {
buffer.addChars(EMPTY_STRING_CHARS);
}
}
/**
* Serializes any char sequence and writes it into specified buffer
* without performing any manipulation of the given text.
*/
protected void writeRaw(CharSequence seq, CharBuf buffer) {
if (seq != null) {
buffer.add(seq.toString());
}
}
/**
* Serializes date and writes it into specified buffer.
*/
protected void writeDate(Date date, CharBuf buffer) {
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat, dateLocale);
formatter.setTimeZone(timezone);
buffer.addQuoted(formatter.format(date));
}
/**
* Serializes array and writes it into specified buffer.
*/
protected void writeArray(Class<?> arrayClass, Object array, CharBuf buffer) {
if (Object[].class.isAssignableFrom(arrayClass)) {
Object[] objArray = (Object[]) array;
writeIterator(Arrays.asList(objArray).iterator(), buffer);
return;
}
buffer.addChar(OPEN_BRACKET);
if (int[].class.isAssignableFrom(arrayClass)) {
int[] intArray = (int[]) array;
if (intArray.length > 0) {
buffer.addInt(intArray[0]);
for (int i = 1; i < intArray.length; i++) {
buffer.addChar(COMMA).addInt(intArray[i]);
}
}
} else if (long[].class.isAssignableFrom(arrayClass)) {
long[] longArray = (long[]) array;
if (longArray.length > 0) {
buffer.addLong(longArray[0]);
for (int i = 1; i < longArray.length; i++) {
buffer.addChar(COMMA).addLong(longArray[i]);
}
}
} else if (boolean[].class.isAssignableFrom(arrayClass)) {
boolean[] booleanArray = (boolean[]) array;
if (booleanArray.length > 0) {
buffer.addBoolean(booleanArray[0]);
for (int i = 1; i < booleanArray.length; i++) {
buffer.addChar(COMMA).addBoolean(booleanArray[i]);
}
}
} else if (char[].class.isAssignableFrom(arrayClass)) {
char[] charArray = (char[]) array;
if (charArray.length > 0) {
buffer.addJsonEscapedString(Chr.array(charArray[0]), disableUnicodeEscaping);
for (int i = 1; i < charArray.length; i++) {
buffer.addChar(COMMA).addJsonEscapedString(Chr.array(charArray[i]), disableUnicodeEscaping);
}
}
} else if (double[].class.isAssignableFrom(arrayClass)) {
double[] doubleArray = (double[]) array;
if (doubleArray.length > 0) {
buffer.addDouble(doubleArray[0]);
for (int i = 1; i < doubleArray.length; i++) {
buffer.addChar(COMMA).addDouble(doubleArray[i]);
}
}
} else if (float[].class.isAssignableFrom(arrayClass)) {
float[] floatArray = (float[]) array;
if (floatArray.length > 0) {
buffer.addFloat(floatArray[0]);
for (int i = 1; i < floatArray.length; i++) {
buffer.addChar(COMMA).addFloat(floatArray[i]);
}
}
} else if (byte[].class.isAssignableFrom(arrayClass)) {
byte[] byteArray = (byte[]) array;
if (byteArray.length > 0) {
buffer.addByte(byteArray[0]);
for (int i = 1; i < byteArray.length; i++) {
buffer.addChar(COMMA).addByte(byteArray[i]);
}
}
} else if (short[].class.isAssignableFrom(arrayClass)) {
short[] shortArray = (short[]) array;
if (shortArray.length > 0) {
buffer.addShort(shortArray[0]);
for (int i = 1; i < shortArray.length; i++) {
buffer.addChar(COMMA).addShort(shortArray[i]);
}
}
}
buffer.addChar(CLOSE_BRACKET);
}
/**
* Serializes map and writes it into specified buffer.
*/
protected void writeMap(Map<?, ?> map, CharBuf buffer) {
if (map.isEmpty()) {
buffer.addChars(EMPTY_MAP_CHARS);
return;
}
buffer.addChar(OPEN_BRACE);
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (entry.getKey() == null) {
throw new IllegalArgumentException("Maps with null keys can\'t be converted to JSON");
}
String key = entry.getKey().toString();
Object value = entry.getValue();
if (isExcludingValues(value) || isExcludingFieldsNamed(key)) {
continue;
}
writeMapEntry(key, value, buffer);
buffer.addChar(COMMA);
}
buffer.removeLastChar(COMMA); // dangling comma
buffer.addChar(CLOSE_BRACE);
}
/**
* Serializes a map entry and writes it into specified buffer.
*/
protected void writeMapEntry(String key, Object value, CharBuf buffer) {
buffer.addJsonFieldName(key, disableUnicodeEscaping);
writeObject(key, value, buffer);
}
/**
* Serializes iterator and writes it into specified buffer.
*/
protected void writeIterator(Iterator<?> iterator, CharBuf buffer) {
if (!iterator.hasNext()) {
buffer.addChars(EMPTY_LIST_CHARS);
return;
}
buffer.addChar(OPEN_BRACKET);
while (iterator.hasNext()) {
Object it = iterator.next();
if (!isExcludingValues(it)) {
writeObject(it, buffer);
buffer.addChar(COMMA);
}
}
buffer.removeLastChar(COMMA); // dangling comma
buffer.addChar(CLOSE_BRACKET);
}
/**
* Finds a converter that can handle the given type. The first converter
* that reports it can handle the type is returned, based on the order in
* which the converters were specified. A {@code null} value will be returned
* if no suitable converter can be found for the given type.
*
* @param type that this converter can handle
* @return first converter that can handle the given type; else {@code null}
* if no compatible converters are found for the given type.
*/
protected Converter findConverter(Class<?> type) {
for (Converter c : converters) {
if (c.handles(type)) {
return c;
}
}
return null;
}
/**
* Indicates whether the given type should be excluded from the generated output.
*
* @param type the type to check
* @return {@code true} if the given type should not be output, else {@code false}
*/
protected boolean shouldExcludeType(Class<?> type) {
for (Class<?> t : excludedFieldTypes) {
if (t.isAssignableFrom(type)) {
return true;
}
}
return false;
}
/**
* A converter that handles converting a given type to a JSON value
* using a closure.
*
* @since 2.5
*/
protected static class ClosureConverter implements Converter {
protected final Class<?> type;
protected final Closure<? extends CharSequence> closure;
protected final int paramCount;
protected ClosureConverter(Class<?> type, Closure<? extends CharSequence> closure) {
if (type == null) {
throw new NullPointerException("Type parameter must not be null");
}
if (closure == null) {
throw new NullPointerException("Closure parameter must not be null");
}
int paramCount = closure.getMaximumNumberOfParameters();
if (paramCount < 1) {
throw new IllegalArgumentException("Closure must accept at least one parameter");
}
Class<?> param1 = closure.getParameterTypes()[0];
if (!param1.isAssignableFrom(type)) {
throw new IllegalArgumentException("Expected first parameter to be of type: " + type.toString());
}
if (paramCount > 1) {
Class<?> param2 = closure.getParameterTypes()[1];
if (!param2.isAssignableFrom(String.class)) {
throw new IllegalArgumentException("Expected second parameter to be of type: " + String.class.toString());
}
}
this.type = type;
this.closure = closure;
this.paramCount = paramCount;
}
/**
* Returns {@code true} if this converter can handle conversions
* of the given type.
*
* @param type the type of the object to convert
* @return true if this converter can successfully convert values of
* the given type to a JSON value
*/
public boolean handles(Class<?> type) {
return this.type.isAssignableFrom(type);
}
/**
* Converts a given value to a JSON value.
*
* @param value the object to convert
* @return a JSON value representing the value
*/
public CharSequence convert(Object value) {
return convert(value, null);
}
/**
* Converts a given value to a JSON value.
*
* @param value the object to convert
* @param key the key name for the value, may be {@code null}
* @return a JSON value representing the value
*/
public CharSequence convert(Object value, String key) {
return (paramCount == 1) ?
closure.call(value) :
closure.call(value, key);
}
/**
* Any two Converter instances registered for the same type are considered
* to be equal. This comparison makes managing instances in a Set easier;
* since there is no chaining of Converters it makes sense to only allow
* one per type.
*
* @param o the object with which to compare.
* @return {@code true} if this object contains the same class; {@code false} otherwise.
*/
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof ClosureConverter)) {
return false;
}
return this.type == ((ClosureConverter)o).type;
}
@Override
public int hashCode() {
return this.type.hashCode();
}
@Override
public String toString() {
return super.toString() + "<" + this.type.toString() + ">";
}
}
}
| {
"content_hash": "8760d4b37eeca85c8970b9e226848fec",
"timestamp": "",
"source": "github",
"line_count": 532,
"max_line_length": 143,
"avg_line_length": 37.82518796992481,
"alnum_prop": 0.5856979575609998,
"repo_name": "alien11689/incubator-groovy",
"id": "1dbd0ad9bca59020dd8e5b3f5f9870742aff3ab5",
"size": "20944",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "18768"
},
{
"name": "CSS",
"bytes": "132839"
},
{
"name": "GAP",
"bytes": "221401"
},
{
"name": "Groovy",
"bytes": "7770244"
},
{
"name": "HTML",
"bytes": "180758"
},
{
"name": "Java",
"bytes": "11322825"
},
{
"name": "JavaScript",
"bytes": "1191"
},
{
"name": "Shell",
"bytes": "22275"
},
{
"name": "Smarty",
"bytes": "7699"
}
],
"symlink_target": ""
} |
const { Command } = require('discord.js-commando');
const Currency = require('../../currency/Currency');
module.exports = class MoneyAddCommand extends Command {
constructor(client) {
super(client, {
name: 'add-money',
aliases: [
'money-add',
'add-donut',
'add-donuts',
'add-doughnut',
'add-doughnuts',
'donut-add',
'donuts-add',
'doughnut-add',
'doughnuts-add'
],
group: 'economy',
memberName: 'add',
description: `Add ${Currency.textPlural} to a certain user.`,
details: `Add amount of ${Currency.textPlural} to a certain user.`,
guildOnly: true,
throttling: {
usages: 2,
duration: 3
},
args: [
{
key: 'member',
prompt: `what user would you like to give ${Currency.textPlural}?\n`,
type: 'member'
},
{
key: 'donuts',
label: 'amount of donuts to add',
prompt: `how many ${Currency.textPlural} do you want to give that user?\n`,
type: 'integer'
}
]
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
async run(msg, args) {
const user = args.member;
const donuts = args.donuts;
Currency._changeBalance(user.id, donuts);
return msg.reply(`successfully added ${Currency.convert(donuts)} to ${user.displayName}'s balance.`);
}
};
| {
"content_hash": "d890cc510a5c7dc29341dc19936af0a3",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 103,
"avg_line_length": 22.448275862068964,
"alnum_prop": 0.6144393241167435,
"repo_name": "LostNTime/Commando",
"id": "bdf3c5ebabf69f0205c340a2ac24a67a9988cd92",
"size": "1302",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "commands/economy/add.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "155757"
}
],
"symlink_target": ""
} |
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_gpio.h>
#include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include "pinctrl-spear.h"
#define DRIVER_NAME "spear-pinmux"
static void muxregs_endisable(struct spear_pmx *pmx,
struct spear_muxreg *muxregs, u8 count, bool enable)
{
struct spear_muxreg *muxreg;
u32 val, temp, j;
for (j = 0; j < count; j++) {
muxreg = &muxregs[j];
val = pmx_readl(pmx, muxreg->reg);
val &= ~muxreg->mask;
if (enable)
temp = muxreg->val;
else
temp = ~muxreg->val;
val |= muxreg->mask & temp;
pmx_writel(pmx, val, muxreg->reg);
}
}
static int set_mode(struct spear_pmx *pmx, int mode)
{
struct spear_pmx_mode *pmx_mode = NULL;
int i;
u32 val;
if (!pmx->machdata->pmx_modes || !pmx->machdata->npmx_modes)
return -EINVAL;
for (i = 0; i < pmx->machdata->npmx_modes; i++) {
if (pmx->machdata->pmx_modes[i]->mode == (1 << mode)) {
pmx_mode = pmx->machdata->pmx_modes[i];
break;
}
}
if (!pmx_mode)
return -EINVAL;
val = pmx_readl(pmx, pmx_mode->reg);
val &= ~pmx_mode->mask;
val |= pmx_mode->val;
pmx_writel(pmx, val, pmx_mode->reg);
pmx->machdata->mode = pmx_mode->mode;
dev_info(pmx->dev, "Configured Mode: %s with id: %x\n\n",
pmx_mode->name ? pmx_mode->name : "no_name",
pmx_mode->reg);
return 0;
}
void pmx_init_gpio_pingroup_addr(struct spear_gpio_pingroup *gpio_pingroup,
unsigned count, u16 reg)
{
int i, j;
for (i = 0; i < count; i++)
for (j = 0; j < gpio_pingroup[i].nmuxregs; j++)
gpio_pingroup[i].muxregs[j].reg = reg;
}
void pmx_init_addr(struct spear_pinctrl_machdata *machdata, u16 reg)
{
struct spear_pingroup *pgroup;
struct spear_modemux *modemux;
int i, j, group;
for (group = 0; group < machdata->ngroups; group++) {
pgroup = machdata->groups[group];
for (i = 0; i < pgroup->nmodemuxs; i++) {
modemux = &pgroup->modemuxs[i];
for (j = 0; j < modemux->nmuxregs; j++)
if (modemux->muxregs[j].reg == 0xFFFF)
modemux->muxregs[j].reg = reg;
}
}
}
static int spear_pinctrl_get_groups_cnt(struct pinctrl_dev *pctldev)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
return pmx->machdata->ngroups;
}
static const char *spear_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
unsigned group)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
return pmx->machdata->groups[group]->name;
}
static int spear_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
unsigned group, const unsigned **pins, unsigned *num_pins)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
*pins = pmx->machdata->groups[group]->pins;
*num_pins = pmx->machdata->groups[group]->npins;
return 0;
}
static void spear_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned offset)
{
seq_printf(s, " " DRIVER_NAME);
}
static int spear_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np_config,
struct pinctrl_map **map,
unsigned *num_maps)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
struct device_node *np;
struct property *prop;
const char *function, *group;
int ret, index = 0, count = 0;
/* calculate number of maps required */
for_each_child_of_node(np_config, np) {
ret = of_property_read_string(np, "st,function", &function);
if (ret < 0)
return ret;
ret = of_property_count_strings(np, "st,pins");
if (ret < 0)
return ret;
count += ret;
}
if (!count) {
dev_err(pmx->dev, "No child nodes passed via DT\n");
return -ENODEV;
}
*map = kzalloc(sizeof(**map) * count, GFP_KERNEL);
if (!*map)
return -ENOMEM;
for_each_child_of_node(np_config, np) {
of_property_read_string(np, "st,function", &function);
of_property_for_each_string(np, "st,pins", prop, group) {
(*map)[index].type = PIN_MAP_TYPE_MUX_GROUP;
(*map)[index].data.mux.group = group;
(*map)[index].data.mux.function = function;
index++;
}
}
*num_maps = count;
return 0;
}
static void spear_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
struct pinctrl_map *map,
unsigned num_maps)
{
kfree(map);
}
static const struct pinctrl_ops spear_pinctrl_ops = {
.get_groups_count = spear_pinctrl_get_groups_cnt,
.get_group_name = spear_pinctrl_get_group_name,
.get_group_pins = spear_pinctrl_get_group_pins,
.pin_dbg_show = spear_pinctrl_pin_dbg_show,
.dt_node_to_map = spear_pinctrl_dt_node_to_map,
.dt_free_map = spear_pinctrl_dt_free_map,
};
static int spear_pinctrl_get_funcs_count(struct pinctrl_dev *pctldev)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
return pmx->machdata->nfunctions;
}
static const char *spear_pinctrl_get_func_name(struct pinctrl_dev *pctldev,
unsigned function)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
return pmx->machdata->functions[function]->name;
}
static int spear_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
unsigned function, const char *const **groups,
unsigned * const ngroups)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
*groups = pmx->machdata->functions[function]->groups;
*ngroups = pmx->machdata->functions[function]->ngroups;
return 0;
}
static int spear_pinctrl_endisable(struct pinctrl_dev *pctldev,
unsigned function, unsigned group, bool enable)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
const struct spear_pingroup *pgroup;
const struct spear_modemux *modemux;
int i;
bool found = false;
pgroup = pmx->machdata->groups[group];
for (i = 0; i < pgroup->nmodemuxs; i++) {
modemux = &pgroup->modemuxs[i];
/* SoC have any modes */
if (pmx->machdata->modes_supported) {
if (!(pmx->machdata->mode & modemux->modes))
continue;
}
found = true;
muxregs_endisable(pmx, modemux->muxregs, modemux->nmuxregs,
enable);
}
if (!found) {
dev_err(pmx->dev, "pinmux group: %s not supported\n",
pgroup->name);
return -ENODEV;
}
return 0;
}
static int spear_pinctrl_set_mux(struct pinctrl_dev *pctldev, unsigned function,
unsigned group)
{
return spear_pinctrl_endisable(pctldev, function, group, true);
}
/* gpio with pinmux */
static struct spear_gpio_pingroup *get_gpio_pingroup(struct spear_pmx *pmx,
unsigned pin)
{
struct spear_gpio_pingroup *gpio_pingroup;
int i, j;
if (!pmx->machdata->gpio_pingroups)
return NULL;
for (i = 0; i < pmx->machdata->ngpio_pingroups; i++) {
gpio_pingroup = &pmx->machdata->gpio_pingroups[i];
for (j = 0; j < gpio_pingroup->npins; j++) {
if (gpio_pingroup->pins[j] == pin)
return gpio_pingroup;
}
}
return NULL;
}
static int gpio_request_endisable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned offset, bool enable)
{
struct spear_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
struct spear_pinctrl_machdata *machdata = pmx->machdata;
struct spear_gpio_pingroup *gpio_pingroup;
/*
* Some SoC have configuration options applicable to group of pins,
* rather than a single pin.
*/
gpio_pingroup = get_gpio_pingroup(pmx, offset);
if (gpio_pingroup)
muxregs_endisable(pmx, gpio_pingroup->muxregs,
gpio_pingroup->nmuxregs, enable);
/*
* SoC may need some extra configurations, or configurations for single
* pin
*/
if (machdata->gpio_request_endisable)
machdata->gpio_request_endisable(pmx, offset, enable);
return 0;
}
static int gpio_request_enable(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned offset)
{
return gpio_request_endisable(pctldev, range, offset, true);
}
static void gpio_disable_free(struct pinctrl_dev *pctldev,
struct pinctrl_gpio_range *range, unsigned offset)
{
gpio_request_endisable(pctldev, range, offset, false);
}
static const struct pinmux_ops spear_pinmux_ops = {
.get_functions_count = spear_pinctrl_get_funcs_count,
.get_function_name = spear_pinctrl_get_func_name,
.get_function_groups = spear_pinctrl_get_func_groups,
.set_mux = spear_pinctrl_set_mux,
.gpio_request_enable = gpio_request_enable,
.gpio_disable_free = gpio_disable_free,
};
static struct pinctrl_desc spear_pinctrl_desc = {
.name = DRIVER_NAME,
.pctlops = &spear_pinctrl_ops,
.pmxops = &spear_pinmux_ops,
.owner = THIS_MODULE,
};
int spear_pinctrl_probe(struct platform_device *pdev,
struct spear_pinctrl_machdata *machdata)
{
struct device_node *np = pdev->dev.of_node;
struct resource *res;
struct spear_pmx *pmx;
if (!machdata)
return -ENODEV;
pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
if (!pmx) {
dev_err(&pdev->dev, "Can't alloc spear_pmx\n");
return -ENOMEM;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pmx->vbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->vbase))
return PTR_ERR(pmx->vbase);
pmx->dev = &pdev->dev;
pmx->machdata = machdata;
/* configure mode, if supported by SoC */
if (machdata->modes_supported) {
int mode = 0;
if (of_property_read_u32(np, "st,pinmux-mode", &mode)) {
dev_err(&pdev->dev, "OF: pinmux mode not passed\n");
return -EINVAL;
}
if (set_mode(pmx, mode)) {
dev_err(&pdev->dev, "OF: Couldn't configure mode: %x\n",
mode);
return -EINVAL;
}
}
platform_set_drvdata(pdev, pmx);
spear_pinctrl_desc.pins = machdata->pins;
spear_pinctrl_desc.npins = machdata->npins;
pmx->pctl = pinctrl_register(&spear_pinctrl_desc, &pdev->dev, pmx);
if (IS_ERR(pmx->pctl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(pmx->pctl);
}
return 0;
}
int spear_pinctrl_remove(struct platform_device *pdev)
{
struct spear_pmx *pmx = platform_get_drvdata(pdev);
pinctrl_unregister(pmx->pctl);
return 0;
}
| {
"content_hash": "3cdd7e01ed308d9cb9edf69d8fe980b8",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 80,
"avg_line_length": 24.41645885286783,
"alnum_prop": 0.6796037176999286,
"repo_name": "publicloudapp/csrutil",
"id": "0afaf79a4e5175f99233726d07ea086758e72623",
"size": "10192",
"binary": false,
"copies": "595",
"ref": "refs/heads/master",
"path": "linux-4.3/drivers/pinctrl/spear/pinctrl-spear.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "3984"
},
{
"name": "Awk",
"bytes": "29136"
},
{
"name": "C",
"bytes": "532969471"
},
{
"name": "C++",
"bytes": "3352303"
},
{
"name": "Clojure",
"bytes": "1489"
},
{
"name": "Cucumber",
"bytes": "4701"
},
{
"name": "Groff",
"bytes": "46775"
},
{
"name": "Lex",
"bytes": "55199"
},
{
"name": "Makefile",
"bytes": "1576284"
},
{
"name": "Objective-C",
"bytes": "521540"
},
{
"name": "Perl",
"bytes": "715196"
},
{
"name": "Perl6",
"bytes": "3783"
},
{
"name": "Python",
"bytes": "273092"
},
{
"name": "Shell",
"bytes": "343618"
},
{
"name": "SourcePawn",
"bytes": "4687"
},
{
"name": "UnrealScript",
"bytes": "12797"
},
{
"name": "XS",
"bytes": "1239"
},
{
"name": "Yacc",
"bytes": "114559"
}
],
"symlink_target": ""
} |
#import "UITableView+WebVideoCache.h"
@implementation UITableView (WebVideoCache)
@end | {
"content_hash": "d6590a947cfbe16f86fda2aa847254d8",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 43,
"avg_line_length": 12.857142857142858,
"alnum_prop": 0.8,
"repo_name": "Chris-Pan/JPVideoPlayer",
"id": "4fd573af1400f1053f4370cb63ee41461ef94b6a",
"size": "430",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "JPVideoPlayer/UITableView+WebVideoCache.m",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "587633"
},
{
"name": "Ruby",
"bytes": "1479"
},
{
"name": "Shell",
"bytes": "17787"
},
{
"name": "Swift",
"bytes": "27972"
}
],
"symlink_target": ""
} |
struct AppOptions
{
// Verbosity level. 0 -- quiet, 1 -- normal, 2 -- verbose, 3 -- very verbose.
int verbosity;
// The first (and only) argument of the program is stored here.
seqan::CharString text;
AppOptions() :
verbosity(1)
{}
};
// ==========================================================================
// Functions
// ==========================================================================
// --------------------------------------------------------------------------
// Function parseCommandLine()
// --------------------------------------------------------------------------
seqan::ArgumentParser::ParseResult
parseCommandLine(AppOptions & options, int argc, char const ** argv)
{
// Setup ArgumentParser.
seqan::ArgumentParser parser("2.2");
// Set short description, version, and date.
setShortDescription(parser, "Put a Short Description Here");
setVersion(parser, "0.1");
setDate(parser, "July 2012");
// Define usage line and long description.
addUsageLine(parser, "[\\fIOPTIONS\\fP] \"\\fITEXT\\fP\"");
addDescription(parser, "This is the application skelleton and you should modify this string.");
// We require one argument.
addArgument(parser, seqan::ArgParseArgument(seqan::ArgParseArgument::STRING, "TEXT"));
addOption(parser, seqan::ArgParseOption("q", "quiet", "Set verbosity to a minimum."));
addOption(parser, seqan::ArgParseOption("v", "verbose", "Enable verbose output."));
addOption(parser, seqan::ArgParseOption("vv", "very-verbose", "Enable very verbose output."));
// Add Examples Section.
addTextSection(parser, "Examples");
addListItem(parser, "\\fB2.2\\fP \\fB-v\\fP \\fItext\\fP",
"Call with \\fITEXT\\fP set to \"text\" with verbose output.");
// Parse command line.
seqan::ArgumentParser::ParseResult res = seqan::parse(parser, argc, argv);
// Only extract options if the program will continue after parseCommandLine()
if (res != seqan::ArgumentParser::PARSE_OK)
return res;
// Extract option values.
if (isSet(parser, "quiet"))
options.verbosity = 0;
if (isSet(parser, "verbose"))
options.verbosity = 2;
if (isSet(parser, "very-verbose"))
options.verbosity = 3;
seqan::getArgumentValue(options.text, parser, 0);
return seqan::ArgumentParser::PARSE_OK;
}
// --------------------------------------------------------------------------
// Function main()
// --------------------------------------------------------------------------
// Program entry point.
int main(int argc, char const ** argv)
{
// Parse the command line.
seqan::ArgumentParser parser;
AppOptions options;
seqan::ArgumentParser::ParseResult res = parseCommandLine(options, argc, argv);
// If there was an error parsing or built-in argument parser functionality
// was triggered then we exit the program. The return code is 1 if there
// were errors and 0 if there were none.
if (res != seqan::ArgumentParser::PARSE_OK)
return res == seqan::ArgumentParser::PARSE_ERROR;
std::cout << "EXAMPLE PROGRAM\n"
<< "===============\n\n";
// Print the command line arguments back to the user.
if (options.verbosity > 0)
{
std::cout << "__OPTIONS____________________________________________________________________\n"
<< '\n'
<< "VERBOSITY\t" << options.verbosity << '\n'
<< "TEXT \t" << options.text << "\n\n";
}
return 0;
}
| {
"content_hash": "0fd496f48705eba65a179525b3ac9577",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 102,
"avg_line_length": 36.18181818181818,
"alnum_prop": 0.536571747627024,
"repo_name": "bkahlert/seqan-research",
"id": "64222849d1c3f5ebbd696bef680bb2e6d939ffae",
"size": "6155",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "raw/pmsb13/pmsb13-data-20130530/sources/qhuulr654q26tohr/2013-04-09T15-02-07.873+0200/sandbox/PMSB13/apps/2.2/2.2.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "39014"
},
{
"name": "Awk",
"bytes": "44044"
},
{
"name": "Batchfile",
"bytes": "37736"
},
{
"name": "C",
"bytes": "1261223"
},
{
"name": "C++",
"bytes": "277576131"
},
{
"name": "CMake",
"bytes": "5546616"
},
{
"name": "CSS",
"bytes": "271972"
},
{
"name": "GLSL",
"bytes": "2280"
},
{
"name": "Groff",
"bytes": "2694006"
},
{
"name": "HTML",
"bytes": "15207297"
},
{
"name": "JavaScript",
"bytes": "362928"
},
{
"name": "LSL",
"bytes": "22561"
},
{
"name": "Makefile",
"bytes": "6418610"
},
{
"name": "Objective-C",
"bytes": "3730085"
},
{
"name": "PHP",
"bytes": "3302"
},
{
"name": "Perl",
"bytes": "10468"
},
{
"name": "PostScript",
"bytes": "22762"
},
{
"name": "Python",
"bytes": "9267035"
},
{
"name": "R",
"bytes": "230698"
},
{
"name": "Rebol",
"bytes": "283"
},
{
"name": "Shell",
"bytes": "437340"
},
{
"name": "Tcl",
"bytes": "15439"
},
{
"name": "TeX",
"bytes": "738415"
},
{
"name": "VimL",
"bytes": "12685"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60) on Thu Dec 03 15:37:45 EST 2015 -->
<title>M-Index</title>
<meta name="date" content="2015-12-03">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
<script type="text/javascript" src="../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="M-Index";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-10.html">Prev Letter</a></li>
<li><a href="index-12.html">Next Letter</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-files/index-11.html" target="_top">Frames</a></li>
<li><a href="index-11.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="contentContainer"><a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">H</a> <a href="index-9.html">I</a> <a href="index-10.html">L</a> <a href="index-11.html">M</a> <a href="index-12.html">N</a> <a href="index-13.html">P</a> <a href="index-14.html">R</a> <a href="index-15.html">S</a> <a href="index-16.html">T</a> <a href="index-17.html">U</a> <a href="index-18.html">V</a> <a href="index-19.html">W</a> <a name="I:M">
<!-- -->
</a>
<h2 class="title">M</h2>
<dl>
<dt><span class="memberNameLink"><a href="../thefourmarauders/WebServer.html#main-java.lang.String:A-">main(String[])</a></span> - Static method in class thefourmarauders.<a href="../thefourmarauders/WebServer.html" title="class in thefourmarauders">WebServer</a></dt>
<dd>
<div class="block">The main method for executing</div>
</dd>
<dt><a href="../storage/MemoryStorageService.html" title="class in storage"><span class="typeNameLink">MemoryStorageService</span></a> - Class in <a href="../storage/package-summary.html">storage</a></dt>
<dd>
<div class="block">Implementation of StorageService that simply uses datastructures in memory, does not persist, use at risk</div>
</dd>
<dt><span class="memberNameLink"><a href="../storage/MemoryStorageService.html#MemoryStorageService-controller.AuthConfig-">MemoryStorageService(AuthConfig)</a></span> - Constructor for class storage.<a href="../storage/MemoryStorageService.html" title="class in storage">MemoryStorageService</a></dt>
<dd>
<div class="block">constructor that takes in an authorization config</div>
</dd>
<dt><a href="../storage/MongoDBStorageService.html" title="class in storage"><span class="typeNameLink">MongoDBStorageService</span></a> - Class in <a href="../storage/package-summary.html">storage</a></dt>
<dd>
<div class="block">Implementation of storage service that uses mongjodb using the given configuration as the database config</div>
</dd>
<dt><span class="memberNameLink"><a href="../storage/MongoDBStorageService.html#MongoDBStorageService-controller.StorageConfig-controller.AuthConfig-">MongoDBStorageService(StorageConfig, AuthConfig)</a></span> - Constructor for class storage.<a href="../storage/MongoDBStorageService.html" title="class in storage">MongoDBStorageService</a></dt>
<dd>
<div class="block">Constructor that takes in both the db and auth config</div>
</dd>
</dl>
<a href="index-1.html">A</a> <a href="index-2.html">B</a> <a href="index-3.html">C</a> <a href="index-4.html">D</a> <a href="index-5.html">E</a> <a href="index-6.html">F</a> <a href="index-7.html">G</a> <a href="index-8.html">H</a> <a href="index-9.html">I</a> <a href="index-10.html">L</a> <a href="index-11.html">M</a> <a href="index-12.html">N</a> <a href="index-13.html">P</a> <a href="index-14.html">R</a> <a href="index-15.html">S</a> <a href="index-16.html">T</a> <a href="index-17.html">U</a> <a href="index-18.html">V</a> <a href="index-19.html">W</a> </div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li><a href="../overview-tree.html">Tree</a></li>
<li><a href="../deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Index</li>
<li><a href="../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="index-10.html">Prev Letter</a></li>
<li><a href="index-12.html">Next Letter</a></li>
</ul>
<ul class="navList">
<li><a href="../index.html?index-files/index-11.html" target="_top">Frames</a></li>
<li><a href="index-11.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "63823aa2b037d8c9820d471f9b15211e",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 700,
"avg_line_length": 47.00689655172414,
"alnum_prop": 0.6552230046948356,
"repo_name": "TheFourMarauders/MaraudersApp-WebServer",
"id": "2b7b07740f70ab6667b80df1de76a4a63828dc43",
"size": "6816",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/index-files/index-11.html",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Java",
"bytes": "106450"
}
],
"symlink_target": ""
} |
/***************************************************************************/
/* */
/* ftsmooth.h */
/* */
/* Anti-aliasing renderer interface (specification). */
/* */
/* Copyright 1996-2001 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
#ifndef __FTSMOOTH_H__
#define __FTSMOOTH_H__
#include <plugin/FT_fontsys/ft2build.h>
#include FT_RENDER_H
FT_BEGIN_HEADER
#ifndef FT_CONFIG_OPTION_NO_STD_RASTER
FT_DECLARE_RENDERER( ft_std_renderer_class )
#endif
#ifndef FT_CONFIG_OPTION_NO_SMOOTH_RASTER
FT_DECLARE_RENDERER( ft_smooth_renderer_class )
FT_DECLARE_RENDERER( ft_smooth_lcd_renderer_class )
FT_DECLARE_RENDERER( ft_smooth_lcd_v_renderer_class )
#endif
FT_END_HEADER
#endif /* __FTSMOOTH_H__ */
/* END */
| {
"content_hash": "ad9ba782a164fe2811a129ca2c0c0285",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 35.55102040816327,
"alnum_prop": 0.39552238805970147,
"repo_name": "dreamsxin/ultimatepp",
"id": "7b4c4fd2f80b2db27e20ac1afa2f8d8bd1cf6197",
"size": "1742",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "uppsrc/plugin/FT_fontsys/src/smooth/ftsmooth.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "8477"
},
{
"name": "C",
"bytes": "47921993"
},
{
"name": "C++",
"bytes": "28354499"
},
{
"name": "CSS",
"bytes": "659"
},
{
"name": "JavaScript",
"bytes": "7006"
},
{
"name": "Objective-C",
"bytes": "178854"
},
{
"name": "Perl",
"bytes": "65041"
},
{
"name": "Python",
"bytes": "38142"
},
{
"name": "Shell",
"bytes": "91097"
},
{
"name": "Smalltalk",
"bytes": "101"
},
{
"name": "Turing",
"bytes": "661569"
}
],
"symlink_target": ""
} |
package edas
//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// Role is a nested struct in edas response
type Role struct {
UpdateTime int64 `json:"UpdateTime" xml:"UpdateTime"`
IsDefault bool `json:"IsDefault" xml:"IsDefault"`
AdminUserId string `json:"AdminUserId" xml:"AdminUserId"`
CreateTime int64 `json:"CreateTime" xml:"CreateTime"`
Name string `json:"Name" xml:"Name"`
Id int `json:"Id" xml:"Id"`
}
| {
"content_hash": "5f5e602fb08a723477cbc108316590b3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 84,
"avg_line_length": 41.5,
"alnum_prop": 0.7349397590361446,
"repo_name": "aliyun/alibaba-cloud-sdk-go",
"id": "fabb05b1cf996712c7f4fc10aee77fb3424645f5",
"size": "1079",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services/edas/struct_role.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "734307"
},
{
"name": "Makefile",
"bytes": "183"
}
],
"symlink_target": ""
} |
title: Cached Components
description: Cached Components example with Nuxt.js
github: cached-components
documentation: /api/configuration-cache
--- | {
"content_hash": "618f340242f574f4310b1a3eff9ca824",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 51,
"avg_line_length": 29.2,
"alnum_prop": 0.8287671232876712,
"repo_name": "jbruni/docs",
"id": "1f95cb11033f42255287b366a4ea3ea6a9107c51",
"size": "150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "en/examples/cached-components.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "8396"
}
],
"symlink_target": ""
} |
from __future__ import print_function
import glob
import os
import unittest
import ipuz
import puz
import crossword
class FormatUnitTest(unittest.TestCase):
def test_to_ipuz_only_include_ipuz_specific_data(self):
puz_object = puz.read('fixtures/puz/chronicle_20140815.puz')
puzzle = crossword.from_puz(puz_object)
ipuz_dict = crossword.to_ipuz(puzzle)
self.assertNotIn('puzzletype', ipuz_dict)
self.assertNotIn('fileversion', ipuz_dict)
self.assertNotIn('extensions', ipuz_dict)
def test_to_puz_only_include_puz_specific_data(self):
with open('fixtures/ipuz/example.ipuz') as f:
ipuz_dict = ipuz.read(f.read())
puzzle = crossword.from_ipuz(ipuz_dict)
puz_object = crossword.to_puz(puzzle)
self.assertFalse(hasattr(puz_object, "kind"))
def test_to_puz_only_works_if_numbering_system_matches(self):
with open('fixtures/ipuz/first.ipuz') as f:
ipuz_dict = ipuz.read(f.read())
puzzle = crossword.from_ipuz(ipuz_dict)
with self.assertRaises(crossword.CrosswordException):
crossword.to_puz(puzzle)
@unittest.skipIf(not os.path.exists('../puzfiles/'),
'fixture files not found')
def test_all_fixtures(self):
for f in glob.glob('../puzfiles/*.puz'):
puz_obj = puz.read(f)
loaded_obj = crossword.to_puz(crossword.from_puz(puz_obj))
for attr in dir(puz_obj):
if not callable(getattr(puz_obj, attr)):
eq = getattr(puz_obj, attr) == getattr(loaded_obj, attr)
if not eq:
print(attr, eq)
| {
"content_hash": "cc7c50098b6807ef7c08639f7772e798",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 76,
"avg_line_length": 35.1875,
"alnum_prop": 0.6163410301953819,
"repo_name": "svisser/crossword",
"id": "708f8749a95805bb81b1bb1d36a219bef41c3c77",
"size": "1689",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/test_format.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "31316"
}
],
"symlink_target": ""
} |
package org.vaadin.addons.scrollablepanel;
import java.io.Serializable;
import java.lang.reflect.Method;
import org.vaadin.addons.scrollablepanel.client.ScrollData;
import org.vaadin.addons.scrollablepanel.client.ScrollablePanelServerRpc;
import org.vaadin.addons.scrollablepanel.client.ScrollablePanelState;
import com.vaadin.ui.AbstractSingleComponentContainer;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.util.ReflectTools;
/**
* The scrollable panel is a simple single component widget which supports
* reading and writing the scroll position data (when scrolling is enabled).
*
* @author Christian Thiel
*
*/
public class ScrollablePanel extends AbstractSingleComponentContainer {
private static final long serialVersionUID = -3031229036782875607L;
/**
* The client side fires the scroll change after a given delay when no
* additional scroll event occurred.
*/
public static final int DEFAULT_SCROLL_EVENT_DELAY = 200;
private ScrollData scrollData;
/**
* Creates a new empty scrollable panel with horizontal and vertical
* scrolling set to AUTO.
*/
public ScrollablePanel() {
this((ComponentContainer) null);
}
/**
* Creates a new empty panel which contains the given content and horizontal
* and vertical scrolling set to AUTO.
*
* @param content
* the content for the panel.
*/
public ScrollablePanel(final Component content) {
registerRpc(rpc);
setContent(content);
setWidth(100, Unit.PERCENTAGE);
setScrollEventDelayMillis(DEFAULT_SCROLL_EVENT_DELAY);
}
@Override
protected ScrollablePanelState getState() {
return (ScrollablePanelState) super.getState();
}
/**
* Returns the top scroll amount in pixels (the number of top pixel rows
* that are hidden because of the scroll position).
*
* @return the top scroll amount in pixels
*/
public Integer getScrollTop() {
return scrollData != null ? scrollData.getTop() : null;
}
/**
* Returns the left scroll amount in pixels (the number of left pixel
* columns that are hidden because of the scroll position).
*
* @return the left scroll amount in pixels
*/
public Integer getScrollLeft() {
return scrollData != null ? scrollData.getLeft() : null;
}
/**
* Returns the width of the scrollable area in pixels.
*
* @return the width of the scrollable area in pixels
*/
public Integer getScrollWidth() {
return scrollData != null ? scrollData.getScrollWidth() : null;
}
/**
* Returns the height of the scrollable area in pixels.
*
* @return the height of the scrollable area in pixels
*/
public Integer getScrollHeight() {
return scrollData != null ? scrollData.getScrollHeight() : null;
}
/**
* Sets the top scroll position in pixel. This method does not check if the
* target scroll position is a valid value. If an invalid value (out of
* scroll range) is given, the result will depend on the executing browser.
*
* @param top
* the top scroll position
*/
public void setScrollTop(final int top) {
if (scrollData == null) {
scrollData = new ScrollData();
}
scrollData.setTop(top);
getState().scrollTop = top;
}
/**
* Sets the left scroll position in pixel. This method does not check if the
* target scroll position is a valid value. If an invalid value (out of
* scroll range) is given, the result will depend on the executing browser.
*
* @param left
* the left scroll position
*/
public void setScrollLeft(final int left) {
if (scrollData == null) {
scrollData = new ScrollData();
}
scrollData.setLeft(left);
getState().scrollLeft = left;
}
/**
* Defines, if horizontal scrolling is enabled. If true, the CSS overflow is
* set to AUTO, otherwise HIDDEN.
*
* @param horizontalScrollingEnabled
* scrollOption
*/
public void setHorizontalScrollingEnabled(final boolean horizontalScrollingEnabled) {
getState().horizontalScrollingEnabled = horizontalScrollingEnabled;
}
/**
* Defines, if vertical scrolling is enabled. If true, the CSS overflow is
* set to AUTO, otherwise HIDDEN.
*
* @param verticalScrollingEnabled
* scrollOption
*/
public void setVerticalScrollingEnabled(final boolean verticalScrollingEnabled) {
getState().verticalScrollingEnabled = verticalScrollingEnabled;
}
/**
* The current event delay in milliseconds.
*
* @return the current event delay in milliseconds
*/
public Integer getScrollEventDelayMillis() {
return getState().scrollEventDelayMillis;
}
/**
* Sets the event delay in millisenconds. The client side will wait the
* given amount of milliseconds for any other scroll event on this component
* before triggering an event.
*
* @param millis
* delay in ms
*/
public void setScrollEventDelayMillis(final int millis) {
getState().scrollEventDelayMillis = millis;
}
// Listener
@SuppressWarnings("serial")
private final ScrollablePanelServerRpc rpc = new ScrollablePanelServerRpc() {
@Override
public void scrolled(final ScrollData detail) {
scrollData = detail;
((ScrollablePanelState) getState(false)).scrollTop = detail.getTop();
((ScrollablePanelState) getState(false)).scrollLeft = detail.getLeft();
ScrollablePanel.this.fireEvent(new ScrollEvent(ScrollablePanel.this, detail));
}
};
public static class ScrollEvent extends Component.Event {
private static final long serialVersionUID = -4717161002326588670L;
private final ScrollData scrollData;
public ScrollEvent(final Component component, final ScrollData scrollData) {
super(component);
this.scrollData = scrollData;
}
/**
* The ScrollablePanel itself
*
* @return the scrollable panel
*/
public ScrollablePanel getScrollablePanel() {
return (ScrollablePanel) getSource();
}
/**
* Returns the top scroll amount in pixels (the number of top pixel rows
* that are hidden because of the scroll position).
*
* @return the top scroll amount in pixels
*/
public Integer getTop() {
return scrollData.getTop();
}
/**
* Returns the left scroll amount in pixels (the number of left pixel
* columns that are hidden because of the scroll position).
*
* @return the left scroll amount in pixels
*/
public Integer getLeft() {
return scrollData.getLeft();
}
/**
* Returns the right scroll amount in pixels (the number of right pixel
* columns that are hidden because of the scroll position).
*
* @return the right scroll amount in pixels
*/
public Integer getRight() {
return scrollData.getRight();
}
/**
* Returns the bottom scroll amount in pixels (the number of bottom
* pixel rows that are hidden because of the scroll position).
*
* @return the bottom scroll amount in pixels
*/
public Integer getBottom() {
return scrollData.getBottom();
}
/**
* Returns the height of the scrollable area in pixels.
*
* @return the height of the scrollable area in pixels
*/
public Integer getScrollHeight() {
return scrollData.getScrollHeight();
}
/**
* Returns the width of the scrollable area in pixels.
*
* @return the width of the scrollable area in pixels
*/
public Integer getScrollWidth() {
return scrollData.getScrollWidth();
}
/**
* Returns the scroll data object.
*
* @return the scroll data object
*/
public ScrollData getScrollData() {
return scrollData;
}
};
public interface ScrollListener extends Serializable {
public static final Method SCROLLPANEL_SCROLL_METHOD = ReflectTools.findMethod(ScrollListener.class, "onScroll", ScrollEvent.class);
public void onScroll(final ScrollEvent event);
}
/**
* Adds a scroll listener. This listener will be called when a scrollEvent
* occurs.
*
* @param listener
* the listener to add
*/
public void addScrollListener(final ScrollListener listener) {
addListener(ScrollablePanelState.EVENT_SCOLLED, ScrollEvent.class, listener, ScrollListener.SCROLLPANEL_SCROLL_METHOD);
}
/**
* Removes a scroll listener
*
* @param listener
* the listener to remove
*/
public void removeScrollListener(final ScrollListener listener) {
removeListener(ScrollEvent.class, listener, ScrollListener.SCROLLPANEL_SCROLL_METHOD);
}
}
| {
"content_hash": "c0db04cff7e977dbcb118d6da8830671",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 134,
"avg_line_length": 28.274509803921568,
"alnum_prop": 0.6901294498381877,
"repo_name": "bonprix/vaadin-scrollable-panel",
"id": "8b968cd0a1772df5c97386d738a2f44c1fdf9b2e",
"size": "8652",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vaadin-scrollable-panel/src/main/java/org/vaadin/addons/scrollablepanel/ScrollablePanel.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1118"
},
{
"name": "Java",
"bytes": "24674"
}
],
"symlink_target": ""
} |
<?php
use Respect\Validation\Validator as v;
session_start();
require __DIR__ . '/../vendor/autoload.php';
try {
$dotenv = (new \Dotenv\Dotenv(__DIR__ . '/../'))->load();
} catch (\Dotenv\Exception\InvalidPathException $e) {
//
}
$app = new \Slim\App([
'settings' => [
'displayErrorDetails' => true,
'mailer' => [
'host' => getenv('MAIL_HOST'),
'username' => getenv('MAIL_USERNAME'),
'password' => getenv('MAIL_PASSWORD')
],
'baseUrl' => getenv('BASE_URL')
],
]);
require_once __DIR__ . '/database.php';
$container = $app->getContainer();
$container['db'] = function ($container) use ($capsule) {
return $capsule;
};
$container['auth'] = function($container) {
return new \App\Auth\Auth;
};
$container['flash'] = function($container) {
return new \Slim\Flash\Messages;
};
$container['mailer'] = function($container) {
return new Nette\Mail\SmtpMailer($container['settings']['mailer']);
};
$container['view'] = function ($container) {
$view = new \Slim\Views\Twig(__DIR__ . '/../resources/views/', [
'cache' => false,
]);
$view->addExtension(new \Slim\Views\TwigExtension(
$container->router,
$container->request->getUri()
));
$view->getEnvironment()->addGlobal('auth',[
'check' => $container->auth->check(),
'user' => $container->auth->user()
]);
$view->getEnvironment()->addGlobal('flash',$container->flash);
return $view;
};
$container['validator'] = function ($container) {
return new App\Validation\Validator;
};
$container['HomeController'] = function($container) {
return new \App\Controllers\HomeController($container);
};
$container['AuthController'] = function($container) {
return new \App\Controllers\Auth\AuthController($container);
};
$container['PasswordController'] = function($container) {
return new \App\Controllers\Auth\PasswordController($container);
};
$container['csrf'] = function($container) {
return new \Slim\Csrf\Guard;
};
$app->add(new \App\Middleware\ValidationErrorsMiddleware($container));
$app->add(new \App\Middleware\OldInputMiddleware($container));
$app->add(new \App\Middleware\CsrfViewMiddleware($container));
$app->add($container->csrf);
v::with('App\\Validation\\Rules\\');
require __DIR__ . '/../app/routes.php';
| {
"content_hash": "205c6d1de84c127cfe5d411d84b58f33",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 70,
"avg_line_length": 22.959183673469386,
"alnum_prop": 0.6546666666666666,
"repo_name": "brtsos/slim-auth",
"id": "d1a83dd74a852db8d27646b76185d8deedee246d",
"size": "2250",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bootstrap/app.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "120"
},
{
"name": "CSS",
"bytes": "176"
},
{
"name": "HTML",
"bytes": "7454"
},
{
"name": "PHP",
"bytes": "16167"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="sah" version="2.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+39"/>
<source><b>EverGreenCoin</b> version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Copyright © 2009-2014 The Bitcoin developers
Copyright © 2012-2014 The NovaCoin developers
Copyright © 2015-2017 The EverGreenCoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Double-click to edit address or label</source>
<translation>Аадырыскын уларытаргар иккитэ баттаа</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-46"/>
<source>These are your EverGreenCoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>&Copy Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own an EverGreenCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Verify a message to ensure it was signed with a specified EverGreenCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+65"/>
<source>Copy &Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Edit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+250"/>
<source>Export Address Book Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Repeat new password</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<source>Serves to disable the trivial sendmoney when OS account compromised. Provides no real security.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unlock for staking only (not sending).</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+35"/>
<source>Enter the new password to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>This operation needs your password to unlock your EverGreenCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Unlock EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Change password</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new password to the wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+103"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-133"/>
<location line="+60"/>
<source>Wallet encrypted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-58"/>
<source>EverGreenCoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your coins from being stolen by malware infecting your computer.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+44"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-56"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<location line="+50"/>
<source>The supplied passphrases do not match.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>Wallet unlock failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+12"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+282"/>
<source>Sign &message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>Synchronizing with network...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-319"/>
<source>&Overview</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show general overview of your EverGreenCoin balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>&Transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Browse your EverGreenCoin transaction history</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>&Address Book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit the list of your stored EverGreenCoin addresses and labels</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-13"/>
<source>&Receive coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show your list of EverGreenCoin addresses for receiving payments</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-7"/>
<source>&Send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>E&xit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show information about EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>&Encrypt Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+259"/>
<source>~%n block(s) remaining</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Downloaded %1 of %2 blocks of transaction history (%3% done).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-256"/>
<source>&Export...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Send EverGreenCoins to an EverGreenCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Modify configuration options for EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Export the data in the current tab to a file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-14"/>
<source>Encrypt or decrypt wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup wallet to another location</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-202"/>
<source>EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+180"/>
<source>&About EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Unlock EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>&Lock Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Lock wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>&File</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Settings</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>&Help</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Tabs toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Actions toolbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+9"/>
<source>[testnet]</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+60"/>
<source>EverGreenCoin client</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+75"/>
<source>%n active connection(s) to the EverGreenCoin network</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+40"/>
<source>Downloaded %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+413"/>
<source>Staking.<br>Your weight is %1<br>Network weight is %2<br>Expected time to earn reward is %3</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Not staking because wallet is locked</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because wallet is syncing</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Not staking because you don't have mature coins</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-403"/>
<source>%n second(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="-312"/>
<source>About EverGreenCoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show information about EverGreenCoin card</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>&Unlock Wallet...</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+297"/>
<source>%n minute(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s) ago</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Up to date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Catching up...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Last received block was generated %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Sent transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Incoming transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<location line="+15"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<location line="+15"/>
<source>URI can not be parsed! This can be caused by an invalid EverGreenCoin address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+76"/>
<source>%n second(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n minute(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+18"/>
<source>Not staking</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../bitcoin.cpp" line="+109"/>
<source>A fatal error occurred. EverGreenCoin can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+90"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>CoinControlDialog</name>
<message>
<location filename="../forms/coincontroldialog.ui" line="+14"/>
<source>Coin Control</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+48"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="+551"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../forms/coincontroldialog.ui" line="+51"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+69"/>
<source>(un)select all</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Tree mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>List mode</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+45"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Priority</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../coincontroldialog.cpp" line="-515"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+26"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+317"/>
<source>highest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium-high</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>low-medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>low</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>lowest</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+155"/>
<source>DUST</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>yes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>This label turns red, if the transaction size is bigger than 10000 bytes.
This means a fee of at least %1 per kb is required.
Can vary +/- 1 Byte per input.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transactions with higher priority get more likely into a block.
This label turns red, if the priority is smaller than "medium".
This means a fee of at least %1 per kb is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if any recipient receives an amount smaller than %1.
This means a fee of at least %2 is required.
Amounts below 0.546 times the minimum relay fee are shown as DUST.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This label turns red, if the change is smaller than %1.
This means a fee of at least %2 is required.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+66"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<source>change from %1 (%2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>(change)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+20"/>
<source>New receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid EverGreenCoin address.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+420"/>
<location line="+12"/>
<source>EverGreenCoin-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB. Fee 0.01 recommended.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Reserved amount does not participate in staking and is therefore spendable at any time.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Reserve</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Automatically start EverGreenCoin after logging in to the system.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Start EverGreenCoin on system login</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Detach block and address databases at shutdown. This means they can be moved to another data directory, but it slows down shutdown. The wallet is always detached.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Detach databases at shutdown</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the EverGreenCoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Connect to the EverGreenCoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting EverGreenCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>Whether to show EverGreenCoin addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Whether to show coin control features or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Display coin &control features (experts only!)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+55"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+149"/>
<location line="+9"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting EverGreenCoin.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+33"/>
<location line="+231"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the EverGreenCoin network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-160"/>
<source>Stake:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-107"/>
<source>Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Spendable:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current spendable balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>Immature:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Total:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Your current total balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-108"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Total of coins that was staked, and do not yet count toward the current balance</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../overviewpage.cpp" line="+113"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+348"/>
<source>N/A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Show the EverGreenCoin-Qt help message to get a list with possible EverGreenCoin command-line options.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-104"/>
<source>EverGreenCoin - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>EverGreenCoin Core</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Open the EverGreenCoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-33"/>
<source>Welcome to the EverGreenCoin RPC console.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+182"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+76"/>
<source>Coin Control Features</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Inputs...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>automatically selected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Insufficient funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Quantity:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+35"/>
<source>0</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-19"/>
<source>Bytes:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Amount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<location line="+86"/>
<location line="+86"/>
<location line="+32"/>
<source>0.00 EGC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-191"/>
<source>Priority:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>medium</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Low Output:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>no</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+32"/>
<source>After Fee:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>Change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+50"/>
<source>custom change address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+106"/>
<source>Send to multiple recipients at once</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Balance:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>123.456 EGC</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-173"/>
<source>Enter an EverGreenCoin address (e.g. EdFwYw4Mo2Zq6CFM2yNJgXvE2DTJxgdBRX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Copy quantity</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy after fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy bytes</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy priority</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy low output</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy change</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+86"/>
<source><b>%1</b> to %2 (%3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+29"/>
<source>The recipient address is not valid, please recheck.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+251"/>
<source>WARNING: Invalid EverGreenCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>(no label)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>WARNING: unknown change address</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<location filename="../sendcoinsentry.cpp" line="+25"/>
<source>Enter a label for this address to add it to your address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+9"/>
<source>&Label:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to send the payment to (e.g. EdFwYw4Mo2Zq6CFM2yNJgXvE2DTJxgdBRX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Choose address from address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter an EverGreenCoin address (e.g. EdFwYw4Mo2Zq6CFM2yNJgXvE2DTJxgdBRX)</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<location line="+124"/>
<source>&Sign Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-118"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. EdFwYw4Mo2Zq6CFM2yNJgXvE2DTJxgdBRX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<location line="+203"/>
<source>Choose an address from the address book</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<location line="+203"/>
<source>Alt+A</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-193"/>
<source>Paste address from clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+24"/>
<source>Copy the current signature to the system clipboard</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this EverGreenCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<location line="+70"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-64"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. EdFwYw4Mo2Zq6CFM2yNJgXvE2DTJxgdBRX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified EverGreenCoin address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter an EverGreenCoin address (e.g. EdFwYw4Mo2Zq6CFM2yNJgXvE2DTJxgdBRX)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Enter EverGreenCoin signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+19"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-2"/>
<source>Open for %n block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+8"/>
<source>conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 60 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-211"/>
<source>, has not been successfully broadcast yet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>unknown</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+226"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<source>Open until %1</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Confirmed (%1 confirmations)</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="-15"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform></translation>
</message>
<message>
<location line="+6"/>
<source>Offline</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Confirming (%1 of %2 recommended confirmations)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Conflicted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Immature (%1 confirmations, will be available after %2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+190"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+55"/>
<location line="+16"/>
<source>All</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+144"/>
<source>Export Transaction Data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+206"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+33"/>
<source>EverGreenCoin version</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Usage:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send command to -server or evergreencoind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>List commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Get help for a command</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify configuration file (default: evergreencoin.conf)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify pid file (default: evergreencoind.pid)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify wallet file (within data directory)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set database disk log size in megabytes (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Listen for connections on <port> (default: 15714 or testnet: 25714)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Bind to given address. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Stake your coins to support network and gain reward (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Detach block and address databases. Increases shutdown time (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-87"/>
<source>Listen for JSON-RPC connections on <port> (default: 15715 or testnet: 25715)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-11"/>
<source>Accept command line and JSON-RPC commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+101"/>
<source>Error: Transaction creation failed </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-5"/>
<source>Error: Wallet locked, unable to create transaction </source>
<translation type="unfinished"/>
</message>
<message>
<location line="-8"/>
<source>Importing blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Importing bootstrap blockchain data file.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-88"/>
<source>Run in the background as a daemon and accept commands</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Use the test network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-24"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-38"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+117"/>
<source>Error initializing database environment %s! To recover, BACKUP THAT DIRECTORY, then remove everything from it except for wallet.dat.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-20"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+61"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong EverGreenCoin will not work properly.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-31"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-18"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-30"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-62"/>
<source>Connect only to the specified node(s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+94"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-90"/>
<source>Find peers using DNS lookup (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync checkpoints policy (default: strict)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+83"/>
<source>Invalid -tor address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Invalid amount for -reservebalance=<amount></source>
<translation type="unfinished"/>
</message>
<message>
<location line="-82"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Prepend debug output with timestamp</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+35"/>
<source>SSL options: (see the Bitcoin Wiki for SSL setup instructions)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+41"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-42"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+109"/>
<source>Unable to sign checkpoint, wrong checkpointkey?
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-25"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<source>Username for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+47"/>
<source>Verifying database integrity...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+57"/>
<source>WARNING: syncronized checkpoint violation detected, but skipped!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-2"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-48"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-54"/>
<source>Password for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-84"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=evergreencoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "EverGreenCoin Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+51"/>
<source>Find peers using internet relay chat (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Sync time with other nodes. Disable if time on your system is precise e.g. syncing with NTP (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>When creating transactions, ignore inputs with value less than this (default: 0.01)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Require a confirmations for change (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Enforce transaction scripts to use canonical PUSH operators (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Upgrade wallet to latest format</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 2500, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-6, default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Imports blocks from external blk000?.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server certificate file (default: server.cert)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+53"/>
<source>Error: Wallet unlocked for staking only, unable to create transaction.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+18"/>
<source>WARNING: Invalid checkpoint found! Displayed transactions may not be correct! You may need to upgrade, or notify developers.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-158"/>
<source>This help message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+95"/>
<source>Wallet %s resides outside data directory %s.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot obtain a lock on data directory %s. EverGreenCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-98"/>
<source>EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+140"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-130"/>
<source>Connect through socks proxy</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+122"/>
<source>Loading addresses...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-15"/>
<source>Error loading blkindex.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error loading wallet.dat: Wallet requires newer version of EverGreenCoin</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Wallet needed to be rewritten: restart EverGreenCoin to complete</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-16"/>
<source>Invalid -proxy address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-24"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Error: could not start node</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Sending...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Invalid amount</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Insufficient funds</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-34"/>
<source>Loading block index...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-103"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+122"/>
<source>Unable to bind to %s on this computer. EverGreenCoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-97"/>
<source>Fee per KB to add to transactions you send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+55"/>
<source>Invalid amount for -mininput=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>Loading wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot initialize keypool</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Rescanning...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Done loading</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-167"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation type="unfinished"/>
</message>
</context>
</TS> | {
"content_hash": "b4b80d28f445582c84bdeeab52c6586e",
"timestamp": "",
"source": "github",
"line_count": 3285,
"max_line_length": 394,
"avg_line_length": 32.75159817351598,
"alnum_prop": 0.5835819646989934,
"repo_name": "EverGreenCoin/EverGreenCoin",
"id": "63d7580ce842e9f851724bee7e6695f32ddf5f04",
"size": "107625",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_sah.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "51565"
},
{
"name": "C",
"bytes": "3306958"
},
{
"name": "C++",
"bytes": "2827785"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "HTML",
"bytes": "50620"
},
{
"name": "Makefile",
"bytes": "12752"
},
{
"name": "NSIS",
"bytes": "5914"
},
{
"name": "Objective-C",
"bytes": "858"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "41595"
},
{
"name": "QMake",
"bytes": "17660"
},
{
"name": "Roff",
"bytes": "25840"
},
{
"name": "Shell",
"bytes": "8509"
}
],
"symlink_target": ""
} |
title: aoh50
type: products
image: /img/Screen Shot 2017-05-09 at 11.56.54 AM.png
heading: h50
description: lksadjf lkasdjf lksajdf lksdaj flksadj flksa fdj
main:
heading: Foo Bar BAz
description: |-
***This is i a thing***kjh hjk kj
# Blah Blah
## Blah
### Baah
image1:
alt: kkkk
---
| {
"content_hash": "fe16fc8170276e0d63f6354b59b07214",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.6656716417910448,
"repo_name": "pblack/kaldi-hugo-cms-template",
"id": "2e60a47af55769a0180718975a597457581fe358",
"size": "339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/content/pages2/aoh50.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "94394"
},
{
"name": "HTML",
"bytes": "18889"
},
{
"name": "JavaScript",
"bytes": "10014"
}
],
"symlink_target": ""
} |
FROM golang:1.18 AS build
COPY go.mod /app/go.mod
COPY go.sum /app/go.sum
WORKDIR /app
RUN go mod download
COPY . /app
RUN go build -o run-influx golang.org/x/build/influx
FROM marketplace.gcr.io/google/influxdb2:latest
COPY --from=build /app/run-influx /run-influx
ENTRYPOINT ["/bin/sh"]
CMD ["-c", "/run-influx -listen-http=:80"]
| {
"content_hash": "476d357edfc2eefd379a936a7f243760",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 52,
"avg_line_length": 17.894736842105264,
"alnum_prop": 0.7147058823529412,
"repo_name": "golang/build",
"id": "115e4231bb96d1416f74aa8ffd1d522234b4452a",
"size": "497",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "influx/Dockerfile",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "23073"
},
{
"name": "Dockerfile",
"bytes": "17643"
},
{
"name": "Go",
"bytes": "3250544"
},
{
"name": "HTML",
"bytes": "75462"
},
{
"name": "JavaScript",
"bytes": "3341"
},
{
"name": "Makefile",
"bytes": "22090"
},
{
"name": "PLpgSQL",
"bytes": "2677"
},
{
"name": "Shell",
"bytes": "656"
}
],
"symlink_target": ""
} |
#ifndef POSTPROCESSING_H
#define POSTPROCESSING_H
#include PROTEUS_LAPACK_H
/*!
\file postprocessing.h
\brief Python interface to velocity postprocessing library.
*/
/**
\defgroup postprocessing postprocessing
\brief Python interface to velocity postprocessing library.
@{
*/
/***********************************************************************
data structure for node star solves, same as ASM smoother basically
***********************************************************************/
typedef struct
{
int N;
int *subdomain_dim;
double **subdomain_L,
**subdomain_R,
**subdomain_U;
PROTEUS_LAPACK_INTEGER** subdomain_pivots;
PROTEUS_LAPACK_INTEGER** subdomain_column_pivots;
} NodeStarFactorStruct;
extern void invertLocal(
int nSpace,
double (*A)[3],
double (*AI)[3]
);
extern void updateSelectedExteriorElementBoundaryFlux(int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nDOF_test_element,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* skipflag_elementBoundaries,
double* flux,
double* w_dS,
double* residual);
extern void updateRT0velocityWithAveragedPotentialP1nc(int nElements_global,
int nQuadraturePoints_element,
int nSpace,
double * detJ,
double * quad_a,
double * phi,
double * gradphi,
double * a,
double * rt0vdofs);
extern void postProcessRT0velocityFromP1nc(
int nElements_global,
int nQuadraturePoints_element,
int nDOF_test_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int * nFreeDOF_element,
int * freeLocal_element,
double * detJ,
double * sqrt_det_g,
double * n,
double * elementBarycenters,
double * quad_a,
double * quad_f,
double * w_dV_r,
double * w_dV_m,
double * u,
double * gradu,
double * a,
double * f,
double * r,
double * mt,
double * rt0vdofs
);
extern void postProcessRT0velocityFromP1ncNoMass(
int nElements_global,
int nQuadraturePoints_element,
int nDOF_test_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int * nFreeDOF_element,
int * freeLocal_element,
double * detJ,
double * sqrt_det_g,
double * n,
double * elementBarycenters,
double * quad_a,
double * quad_f,
double * w_dV_r,
double * u,
double * gradu,
double * a,
double * f,
double * r,
double * rt0vdofs
);
extern void postProcessRT0velocityFromP1ncV2(
int nElements_global,
int nQuadraturePoints_element,
int nDOF_test_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int *nFreeDOF_element,
int *freeLocal_element,
double *detJ,
double *sqrt_det_g,
double *n,
double *elementBarycenters,
double *quad_a,
double *quad_f,
double *w_dV_r,
double *w_dV_m,
double *u,
double *gradu,
double *a,
double *f,
double *r,
double *mt,
double *rt0vdofs
);
extern void postProcessRT0velocityFromP1ncV2noMass(
int nElements_global,
int nQuadraturePoints_element,
int nDOF_test_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int *nFreeDOF_element,
int *freeLocal_element,
double *detJ,
double *sqrt_det_g,
double *n,
double *elementBarycenters,
double *quad_a,
double *quad_f,
double *w_dV_r,
double *u,
double *gradu,
double *a,
double *f,
double *r,
double *rt0vdofs
);
extern void getElementRT0velocityValues(
int nElements_global,
int nPoints_element,
int nSpace,
double *x_element,
double *rt0vdofs_element,
double *v_element
);
extern void getElementBoundaryRT0velocityValues(
int nElements_global,
int nElementBoundaries_element,
int nPoints_elementBoundary,
int nSpace,
double *x_elementBoundary,
double *rt0vdofs_element,
double *v_elementBoundary
);
extern void getGlobalElementBoundaryRT0velocityValues(
int nElementBoundaries_global,
int nPoints_elementBoundary,
int nSpace,
int *elementBoundaryElementsArray,
double *x_elementBoundary_global,
double *rt0vdofs_element,
double *v_elementBoundary_global
);
extern void postProcessRT0potentialFromP1nc(
int nElements_global,
int nQuadraturePoints_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
double *uQuadratureWeights_element,
double *elementBarycenters,
double *aElementQuadratureWeights,
double *detJ,
double *uQuadratureWeights_elementBoundary,
double *x,
double *u,
double *gradu,
double *x_elementBoundary,
double *u_elementBoundary,
double *n,
double *a,
double *f,
double *r,
double *rt0vdofs,
double *rt0potential
);
extern void projectElementBoundaryVelocityToRT0fluxRep(
int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
double *elementBoundaryQuadratureWeights,
double *n,
double *v_elementBoundary,
double *rt0vdofs_element
);
extern void projectElementBoundaryFluxToRT0fluxRep(
int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nDOF_RT0V_element,
int *elementBoundaryElementsArray,
int *elementBoundariesArray,
double *elementBoundaryQuadratureWeights,
double *flux_elementBoundary,
double *rt0vdofs_element
);
extern void getElementRT0velocityValuesFluxRep(
int nElements_global,
int nElementBoundaries_element,
int nPoints_element,
int nSpace,
int nDetVals_element,
double *nodeArray,
int *elementNodesArray,
double *abs_det_J,
double *x_element,
double *rt0vdofs_element,
double *v_element
);
extern void getElementBoundaryRT0velocityValuesFluxRep(
int nElements_global,
int nElementBoundaries_element,
int nPoints_elementBoundary,
int nSpace,
int nDetVals_element,
double *nodeArray,
int *elementNodesArray,
double *abs_det_J,
double *x_elementBoundary,
double *rt0vdofs_element,
double *v_elementBoundary
);
extern void getGlobalElementBoundaryRT0velocityValuesFluxRep(
int nElementBoundaries_global,
int nPoints_elementBoundary_global,
int nSpace,
int nDetVals_element,
double *nodeArray,
int *elementNodesArray,
int *elementBoundaryElementsArray,
double *abs_det_J,
double *x_elementBoundary_global,
double *rt0vdofs_element,
double *v_elementBoundary_global
);
extern void buildLocalBDM1projectionMatrices(
int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int nDOFs_test_element,
int nDOFs_trial_element,
int nVDOFs_element,
double *w_dS_f,
double *ebq_n,
double *ebq_v,
double *BDMprojectionMat_element
);
extern void factorLocalBDM1projectionMatrices(
int nElements_global,
int nVDOFs_element,
double *BDMprojectionMat_element,
int *BDMprojectionMatPivots_element
);
extern void solveLocalBDM1projection(
int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int nDOFs_test_element,
int nVDOFs_element,
double *BDMprojectionMatFact_element,
int *BDMprojectionMatPivots_element,
double *w_dS_f,
double *ebq_n,
double *ebq_velocity,
double *p1_velocity_dofs
);
extern void solveLocalBDM1projectionFromFlux(
int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nDOFs_test_element,
int nVDOFs_element,
double *BDMprojectionMatFact_element,
int *BDMprojectionMatPivots_element,
int *elementBoundaryElementsArray,
int *elementBoundariesArray,
double *w_dS_f,
double *ebq_global_flux,
double *p1_velocity_dofs
);
extern void getElementBDM1velocityValuesLagrangeRep(
int nElements_global,
int nQuadraturePoints_element,
int nSpace,
int nDOF_trial_element,
int nVDOF_element,
double *q_v,
double *p1_velocity_dofs,
double *q_velocity
);
extern void calculateConservationResidualGlobalBoundaries(
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int *interiorElementBoundaries,
int *exteriorElementBoundaries,
int *elementBoundaryElements,
int *elementBoundaryLocalElementBoundaries,
int *exteriorElementBoundariesToSkip,
double *dS,
double *normal,
double *elementResidual,
double *velocity,
double *conservationResidual
);
extern void sunWheelerGSsweep(
int nElements_global,
int nElementBoundaries_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int *interiorElementBoundaries,
int *exteriorElementBoundaries,
int *elementBoundaryElements,
int *elementBoundaryLocalElementBoundaries,
double *dS,
double *normal,
double *sqrt_det_g,
double *alpha,
double *fluxCorrection,
double *conservationResidual
);
extern void fluxCorrectionVelocityUpdate(
int nElements_global,
int nElementBoundaries_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int *interiorElementBoundaries,
int *exteriorElementBoundaries,
int *elementBoundaryElements,
int *elementBoundaryLocalElementBoundaries,
double *dS,
double *normal,
double *fluxCorrection,
double *vConservative,
double *vConservative_element
);
extern void computeFluxCorrectionPWC(
int nElementBoundaries_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int *interiorElementBoundaries,
int *exteriorElementBoundaries,
int *elementBoundaryElements,
double *pwcW,
double *pwcV,
double *fluxCorrection
);
extern int nodeStar_init(
int nElements_global,
int nNodes_element,
int nNodes_global,
int *nElements_node,
int *nodeStarElementsArray,
int *nodeStarElementNeighborsArray,
int *N_p,
int **subdomain_dim_p,
double ***subdomain_L_p,
double ***subdomain_R_p,
double ***subdomain_U_p,
PROTEUS_LAPACK_INTEGER *** subdomain_pivots_p,
PROTEUS_LAPACK_INTEGER *** subdomain_column_pivots_p
);
extern int nodeStar_free(
int N,
int *subdomain_dim,
double **subdomain_L,
double **subdomain_R,
double **subdomain_U,
PROTEUS_LAPACK_INTEGER ** subdomain_pivots,
PROTEUS_LAPACK_INTEGER ** subdomain_column_pivots_p
);
extern int nodeStar_setU(
NodeStarFactorStruct * nodeStarFactor,
double val
);
extern int nodeStar_copy(
int other_N,
int *other_subdomain_dim,
double **other_subdomain_L,
double **other_subdomain_R,
double **other_subdomain_U,
PROTEUS_LAPACK_INTEGER ** other_subdomain_pivots,
PROTEUS_LAPACK_INTEGER ** other_subdomain_column_pivots,
int *N_p,
int **subdomain_dim_p,
double ***subdomain_L_p,
double ***subdomain_R_p,
double ***subdomain_U_p,
PROTEUS_LAPACK_INTEGER *** subdomain_pivots_p,
PROTEUS_LAPACK_INTEGER *** subdomain_column_pivots_p
);
extern
void calculateConservationResidualPWL(int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nDOF_element,
int nNodes_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* elementNodes,
int* dofMapl2g,
int* nodeStarElements,
int* nodeStarElementNeighbors,
int* nElements_node,
int* fluxElementBoundaries,
double* elementResidual,
double* vAverage,
double* dX,
double* w,
double* normal,
NodeStarFactorStruct* nodeStarFactor,
double* conservationResidual,
double* vConservative,
double* vConservative_element);
extern
void calculateConservationJacobianPWL(int nNodes_global,
int nNodes_internal,
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nDOF_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* elementNodes,
int* dofMapl2g,
int* nodeStarElements,
int* nodeStarElementNeighbors,
int* nElements_node,
int* internalNodes,
int* fluxElementBoundaries,
int* fluxBoundaryNodes,
double* w,
double* normal,
NodeStarFactorStruct* nodeStarFactor);
extern
void calculateConservationFluxPWL(int nNodes_global,
int nNodes_internal,
int* nElements_node,
int* internalNodes,
int* fluxBoundaryNodes,
NodeStarFactorStruct* nodeStarFactor);
extern
void calculateConservationResidualPWL_opt(int nNodes_owned,
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* elementNodes,
int* nodeStarElements,
int* nodeStarElementNeighbors,
int* nElements_node,
int* fluxElementBoundaries,
double* elementResidual,
double* vAverage,
double* dX,
double* w,
double* normal,
NodeStarFactorStruct* nodeStarFactor,
double* conservationResidual,
double* vConservative,
double* vConservative_element);
extern
void calculateConservationJacobianPWL_opt(int nNodes_owned,
int nNodes_global,
int nNodes_internal,
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* elementNodes,
int* nodeStarElements,
int* nodeStarElementNeighbors,
int* nElements_node,
int* internalNodes,
int* fluxElementBoundaries,
int* fluxBoundaryNodes,
double* w,
double* normal,
NodeStarFactorStruct* nodeStarFactor);
extern
void calculateConservationFluxPWL_opt(int nNodes_owned,
int nNodes_global,
int nNodes_internal,
int* nElements_node,
int* internalNodes,
int* fluxBoundaryNodes,
NodeStarFactorStruct* nodeStarFactor);
extern void calculateConservationResidualPWLv3(
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int *interiorElementBoundaries,
int *exteriorElementBoundaries,
int *elementBoundaryElements,
int *elementBoundaryLocalElementBoundaries,
int *elementNodes,
int *nodeStarElements,
int *nodeStarElementNeighbors,
int *nElements_node,
int *fluxElementBoundaries,
double *elementResidual,
double *vAverage,
double *dX,
double *w,
double *normal,
NodeStarFactorStruct * nodeStarFactor,
double *conservationResidual,
double *vConservative,
double *vConservative_element
);
extern void calculateConservationJacobianPWLv3(
int nNodes_global,
int nNodes_internal,
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int *interiorElementBoundaries,
int *exteriorElementBoundaries,
int *elementBoundaryElements,
int *elementBoundaryLocalElementBoundaries,
int *elementNodes,
int *nodeStarElements,
int *nodeStarElementNeighbors,
int *nElements_node,
int *internalNodes,
int *fluxElementBoundaries,
int *fluxBoundaryNodes,
double *w,
double *normal,
NodeStarFactorStruct * nodeStarFactor
);
extern void calculateConservationFluxPWLv3(int nNodes_global,
int nNodes_internal,
int* nElements_node,
int* internalNodes,
int* fluxBoundaryNodes,
NodeStarFactorStruct* nodeStarFactor);
extern void postprocessAdvectiveVelocityPointEval(int nPoints,
int nSpace,
double updateCoef,
const double* f,
double * velocity);
extern void postprocessDiffusiveVelocityPointEval(int nPoints,
int nSpace,
double updateCoef,
const double* a,
const double* grad_phi,
double * velocity);
extern void calculateConservationResidualPWL_primative(int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* skipflag_elementBoundaries,
double* elementResidual,
double* dX,
double* normal,
double* conservationResidual,
double* vConservative);
extern void postProcessRT0velocityFromP1nc_sd(int nElements_global,
int nQuadraturePoints_element,
int nDOF_test_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int* rowptr,
int* colind,
int * nFreeDOF_element,
int * freeLocal_element,
double * detJ,
double * sqrt_det_g,
double * n,
double * elementBarycenters,
double * quad_a,
double * quad_f,
double * w_dV_r,
double * w_dV_m,
double * u,
double * gradu,
double * a,
double * f,
double * r,
double * mt,
double * rt0vdofs);
extern void postProcessRT0velocityFromP1ncNoMass_sd(int nElements_global,
int nQuadraturePoints_element,
int nDOF_test_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int* rowptr,
int* colind,
int * nFreeDOF_element,
int * freeLocal_element,
double * detJ,
double * sqrt_det_g,
double * n,
double * elementBarycenters,
double * quad_a,
double * quad_f,
double * w_dV_r,
double * u,
double * gradu,
double * a,
double * f,
double * r,
double * rt0vdofs);
extern void updateRT0velocityWithAveragedPotentialP1nc_sd(int nElements_global,
int nQuadraturePoints_element,
int nSpace,
int* rowptr,
int* colind,
double * detJ,
double * quad_a,
double * phi,
double * gradphi,
double * a,
double * rt0vdofs);
extern void postProcessRT0potentialFromP1nc_sd(int nElements_global,
int nQuadraturePoints_element,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int* rowptr,
int* colind,
double * uQuadratureWeights_element,
double * elementBarycenters,
double * aElementQuadratureWeights,
double * detJ,
double * uQuadratureWeights_elementBoundary,
double * x,
double * u,
double * gradu,
double * x_elementBoundary,
double * u_elementBoundary,
double * n,
double * a,
double * f,
double * r,
double * rt0vdofs,
double * rt0potential);
extern void postprocessDiffusiveVelocityPointEval_sd(int nPoints,
int nSpace,
double updateCoef,
int* rowptr,
int* colind,
const double* a,
const double* grad_phi,
double * velocity);
extern void getGlobalExteriorElementBoundaryRT0velocityValues(int nExteriorElementBoundaries_global,
int nPoints_elementBoundary,
int nSpace,
int * elementBoundaryElementsArray,
int * exteriorElementBoundariesArray,
double * x_elementBoundary_global,
double * rt0vdofs_element,
double * v_elementBoundary_global);
extern void buildLocalBDM2projectionMatrices(int degree,
int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nQuadraturePoints_elementInterior,
int nSpace,
int nDOFs_test_element,
int nDOFs_trial_boundary_element,
int nDOFs_trial_interior_element,
int nVDOFs_element,
int *edgeFlags,
double * w_dS_f,
double * ebq_n,
double * ebq_v,
double * BDMprojectionMat_element,
double * q_basis_vals,
double * w_int_test_grads,
double * w_int_div_free,
double * piola_trial_fun);
extern void factorLocalBDM2projectionMatrices(int nElements_global,
int nVDOFs_element,
double *BDMprojectionMat_element,
int *BDMprojectionMatPivots_element);
extern void solveLocalBDM2projection(int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int nDOFs_test_element,
int nVDOFs_element,
double * BDMprojectionMatFact_element,
int* BDMprojectionMatPivots_element,
double * w_dS_f,
double * ebq_n,
double * w_interior_gradients,
double * q_velocity,
double * ebq_velocity,
double * p1_velocity_dofs);
extern void buildBDM2rhs(int nElements_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nQuadraturePoints_elementInterior,
int nSpace,
int nDOFs_test_element,
int nVDOFs_element,
int nDOFs_trial_interior_element,
double * BDMprojectionMatFact_element,
int* BDMprojectionMatPivots_element,
int *edgeFlags,
double * w_dS_f,
double * ebq_n,
double * w_interior_grads,
double * w_interior_divfree,
double * ebq_velocity,
double * q_velocity,
double * p1_velocity_dofs);
extern void getElementBDM2velocityValuesLagrangeRep(int nElements_global,
int nQuadraturePoints_element,
int nSpace,
int nDOF_trial_element,
int nVDOF_element,
double * q_v, /*scalar P^1 shape fncts*/
double * p1_velocity_dofs,
double * q_velocity);
extern void getElementLDGvelocityValuesLagrangeRep(int nElements_global,
int nQuadraturePoints_element,
int nSpace,
int nDOF_trial_element,
int nVDOF_element,
double * q_v, /*scalar shape fncts*/
double * velocity_dofs,
double * q_velocity);
extern void getGlobalExteriorElementBoundaryBDM1velocityValuesLagrangeRep(int nExteriorElementBoundaries_global,
int nQuadraturePoints_elementBoundary,
int nSpace,
int nDOF_trial_element,
int nVDOF_element,
int *elementBoundaryElementsArray,
int *exteriorElementBoundariesArray,
double * ebqe_v, /*scalar P^1 shape fncts*/
double * p1_velocity_dofs,
double * ebqe_velocity);
extern void getElementBoundaryBDM1velocityValuesLagrangeRep(int nElements_global,
int nBoundaries_Element,
int nQuadraturePoints_elementBoundary,
int nSpace,
int nDOF_trial_element,
int nVDOF_element,
int *elementBoundaryElementsArray, /* not used */
int *exteriorElementBoundariesArray, /*not used */
double * ebq_v, /*scalar P^1 shape fncts*/
double * p1_velocity_dofs,
double * ebq_velocity);
extern void getGlobalExteriorElementBoundaryRT0velocityValuesFluxRep(int nExteriorElementBoundaries_global,
int nPoints_elementBoundary_global,
int nSpace,
int nDetVals_element,
double * nodeArray,
int *elementNodesArray,
int *elementBoundaryElementsArray,
int* exteriorElementBoundariesArray,
double * abs_det_J,
double * x_ebqe,
double * rt0vdofs_element,
double * v_ebqe);
extern void getRT0velocityValuesFluxRep_arbitraryElementMembership(int nElements_global,
int nElementBoundaries_element,
int nPoints,
int nSpace,
int nDetVals_element,
const double * nodeArray,
const int * elementNodesArray,
const double * abs_det_J,
const double * x,
const int * element_locations,
const double * rt0vdofs_element,
double * v_element);
extern void calculateConservationResidualPWL_interiorBoundaries(int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* elementNodes,
int* nodeStarElements,
int* nodeStarElementNeighbors,
int* nElements_node,
int* fluxElementBoundaries,
double* elementResidual,
double* vAverage,
double* dX,
double* w,
double* normal,
NodeStarFactorStruct* nodeStarFactor,
double* conservationResidual,
double* vConservative,
double* vConservative_element);
extern void calculateConservationJacobianPWL_interiorBoundaries(int nNodes_global,
int nElements_global,
int nInteriorElementBoundaries_global,
int nExteriorElementBoundaries_global,
int nElementBoundaries_element,
int nQuadraturePoints_elementBoundary,
int nNodes_element,
int nSpace,
int* interiorElementBoundaries,
int* exteriorElementBoundaries,
int* elementBoundaryElements,
int* elementBoundaryLocalElementBoundaries,
int* elementNodes,
int* nodeStarElements,
int* nodeStarElementNeighbors,
int* nElements_node,
int* fluxElementBoundaries,
double* w,
double* normal,
NodeStarFactorStruct* nodeStarFactor);
extern void subdomain_U_copy_global2local(int max_nN_owned,
int nElements_global,
int nNodes_element,
int* elementNodes,
int* nodeStarElements,
NodeStarFactorStruct* nodeStarFactor,
double* subdomain_U);
extern void subdomain_U_copy_local2global(int max_nN_owned,
int nElements_global,
int nNodes_element,
int* elementNodes,
int* nodeStarElements,
NodeStarFactorStruct* nodeStarFactor,
double* subdomain_U);
extern void calculateElementResidualPWL(int nElements,
int nDOF_element_res,
int nDOF_element_resPWL,
double* alpha,
double* elementResidual,
double* elementResidualPWL);
/** @}*/
#endif
| {
"content_hash": "5a7c638c47a3c428847f834ad9b4fe06",
"timestamp": "",
"source": "github",
"line_count": 927,
"max_line_length": 117,
"avg_line_length": 65.69255663430421,
"alnum_prop": 0.3195067080480155,
"repo_name": "erdc/proteus",
"id": "39ff535fdd9f70adb7714f143cbf17b8ef468e69",
"size": "60897",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "proteus/postprocessing.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "2790"
},
{
"name": "Asymptote",
"bytes": "1569"
},
{
"name": "C",
"bytes": "2827957"
},
{
"name": "C++",
"bytes": "7262408"
},
{
"name": "Cython",
"bytes": "154607"
},
{
"name": "Dockerfile",
"bytes": "2738"
},
{
"name": "Fortran",
"bytes": "51671"
},
{
"name": "Jupyter Notebook",
"bytes": "33357"
},
{
"name": "Makefile",
"bytes": "19043"
},
{
"name": "Python",
"bytes": "12534530"
},
{
"name": "Roff",
"bytes": "322"
},
{
"name": "Shell",
"bytes": "14084"
}
],
"symlink_target": ""
} |
'use strict';
const assert = require('assert');
const fse = require('fs-extra');
const { join } = require('path');
const { homedir } = require('os');
// required for unwrapping images
const imagefs = require('balena-image-fs');
const stream = require('stream');
const pipeline = require('bluebird').promisify(stream.pipeline);
// copied from the SV
// https://github.com/balena-os/balena-supervisor/blob/master/src/config/backends/config-txt.ts
// TODO: retrieve this from the SDK (requires v16.2.0) or future versions of device contracts
// https://www.balena.io/docs/reference/sdk/node-sdk/#balena.models.config.getConfigVarSchema
const supportsBootConfig = (deviceType) => {
return (
[
'fincm3',
'rt-rpi-300',
'243390-rpi3',
'nebra-hnt',
'revpi-connect',
'revpi-core-3',
].includes(deviceType) || deviceType.startsWith('raspberry')
);
};
const enableSerialConsole = async (imagePath) => {
const bootConfig = await imagefs.interact(imagePath, 1, async (_fs) => {
return require('bluebird')
.promisify(_fs.readFile)('/config.txt')
.catch((err) => {
return undefined;
});
});
if (bootConfig) {
await imagefs.interact(imagePath, 1, async (_fs) => {
const regex = /^enable_uart=.*$/m;
const value = 'enable_uart=1';
console.log(`Setting ${value} in config.txt...`);
// delete any existing instances before appending to the file
const newConfig = bootConfig.toString().replace(regex, '');
await require('bluebird').promisify(_fs.writeFile)(
'/config.txt',
newConfig.concat(`\n\n${value}\n\n`),
);
});
}
};
module.exports = {
title: 'Unmanaged BalenaOS release suite',
run: async function (test) {
// The worker class contains methods to interact with the DUT, such as flashing, or executing a command on the device
const Worker = this.require('common/worker');
// The balenaOS class contains information on the OS image to be flashed, and methods to configure it
const BalenaOS = this.require('components/os/balenaos');
const utils = this.require('common/utils');
const worker = new Worker(this.suite.deviceType.slug, this.getLogger());
await fse.ensureDir(this.suite.options.tmpdir);
let systemd = {
/**
* Wait for a service to be active/inactive
* @param {string} serviceName systemd service to query and wait for
* @param {string} state active|inactive
* @param {string} target the address of the device to query
*
* @category helper
*/
waitForServiceState: async function (serviceName, state, target) {
return utils.waitUntil(
async () => {
return worker
.executeCommandInHostOS(
`systemctl is-active ${serviceName} || true`,
target,
)
.then((serviceStatus) => {
return Promise.resolve(serviceStatus === state);
})
.catch((err) => {
Promise.reject(err);
});
},
120,
250,
);
},
};
// The suite contex is an object that is shared across all tests. Setting something into the context makes it accessible by every test
this.suite.context.set({
utils: utils,
systemd: systemd,
sshKeyPath: join(homedir(), 'id'),
link: `${this.suite.options.balenaOS.config.uuid.slice(0, 7)}.local`,
worker: worker,
});
// Network definitions - here we check what network configuration is selected for the DUT for the suite, and add the appropriate configuration options (e.g wifi credentials)
if (this.suite.options.balenaOS.network.wired === true) {
this.suite.options.balenaOS.network.wired = {
nat: true,
};
} else {
delete this.suite.options.balenaOS.network.wired;
}
if (this.suite.options.balenaOS.network.wireless === true) {
this.suite.options.balenaOS.network.wireless = {
ssid: this.suite.options.id,
psk: `${this.suite.options.id}_psk`,
nat: true,
};
} else {
delete this.suite.options.balenaOS.network.wireless;
}
// Create an instance of the balenOS object, containing information such as device type, and config.json options
this.suite.context.set({
os: new BalenaOS(
{
deviceType: this.suite.deviceType.slug,
network: this.suite.options.balenaOS.network,
configJson: {
uuid: this.suite.options.balenaOS.config.uuid,
os: {
sshKeys: [
await this.context
.get()
.utils.createSSHKey(this.context.get().sshKeyPath),
],
},
// Set an API endpoint for the HTTPS time sync service.
apiEndpoint: 'https://api.balena-cloud.com',
// persistentLogging is managed by the supervisor and only read at first boot
persistentLogging: true,
// Set local mode so we can perform local pushes of containers to the DUT
localMode: true,
developmentMode: true,
},
},
this.getLogger(),
),
});
// Register a teardown function execute at the end of the test, regardless of a pass or fail
this.suite.teardown.register(() => {
this.log('Worker teardown');
return this.context.get().worker.teardown();
});
this.log('Setting up worker');
// Create network AP on testbot
await this.context
.get()
.worker.network(this.suite.options.balenaOS.network);
// Unpack OS image .gz
await this.context.get().os.fetch();
// If this is a flasher image, and we are using qemu, unwrap
if (
this.suite.deviceType.data.storage.internal &&
process.env.WORKER_TYPE === `qemu`
) {
const RAW_IMAGE_PATH = `/opt/balena-image-${this.suite.deviceType.slug}.balenaos-img`;
const OUTPUT_IMG_PATH = '/data/downloads/unwrapped.img';
console.log(`Unwrapping file ${this.context.get().os.image.path}`);
console.log(`Looking for ${RAW_IMAGE_PATH}`);
try {
await imagefs.interact(
this.context.get().os.image.path,
2,
async (fsImg) => {
await pipeline(
fsImg.createReadStream(RAW_IMAGE_PATH),
fse.createWriteStream(OUTPUT_IMG_PATH),
);
},
);
this.context.get().os.image.path = OUTPUT_IMG_PATH;
console.log(`Unwrapped flasher image!`);
} catch (e) {
// If the outer image doesn't contain an image for installation, ignore the error
if (e.code === 'ENOENT') {
console.log('Not a flasher image, skipping unwrap');
} else {
throw e;
}
}
}
if (supportsBootConfig(this.suite.deviceType.slug)) {
await enableSerialConsole(this.context.get().os.image.path);
}
// Configure OS image
await this.context.get().os.configure();
// Flash the DUT
await this.context.get().worker.off(); // Ensure DUT is off before starting tests
await this.context.get().worker.flash(this.context.get().os.image.path);
await this.context.get().worker.on();
this.log('Waiting for device to be reachable');
assert.equal(
await this.context
.get()
.worker.executeCommandInHostOS(
'cat /etc/hostname',
this.context.get().link,
),
this.context.get().link.split('.')[0],
'Device should be reachable',
);
// Retrieving journalctl logs: register teardown after device is reachable
this.suite.teardown.register(async () => {
await this.context
.get()
.worker.archiveLogs(this.id, this.context.get().link);
});
},
tests: [
'./tests/device-specific-tests/beaglebone-black',
'./tests/fingerprint',
'./tests/fsck',
'./tests/os-release',
'./tests/issue',
'./tests/chrony',
'./tests/kernel-overlap',
'./tests/bluetooth',
'./tests/healthcheck',
'./tests/variables',
'./tests/led',
'./tests/config-json',
'./tests/boot-splash',
'./tests/connectivity',
'./tests/engine-socket',
'./tests/under-voltage',
'./tests/udev',
'./tests/device-tree',
'./tests/purge-data',
'./tests/device-specific-tests/revpi-core-3',
],
};
| {
"content_hash": "7cc21be27bd6b20574f5fa94969c47d0",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 175,
"avg_line_length": 30.1284046692607,
"alnum_prop": 0.6555598605191786,
"repo_name": "resin-os/meta-resin",
"id": "5ecfaa84aea730b6a63fc6a13e7d1e942f6b853f",
"size": "7800",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/suites/os/suite.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "1741"
},
{
"name": "BitBake",
"bytes": "129432"
},
{
"name": "C",
"bytes": "5573"
},
{
"name": "C++",
"bytes": "23840"
},
{
"name": "CMake",
"bytes": "880"
},
{
"name": "Dockerfile",
"bytes": "354"
},
{
"name": "PHP",
"bytes": "59845"
},
{
"name": "Pascal",
"bytes": "10723"
},
{
"name": "Shell",
"bytes": "96036"
},
{
"name": "SourcePawn",
"bytes": "7840"
}
],
"symlink_target": ""
} |
using System.Linq;
namespace SqlKata.Compilers
{
public class SqlServerCompiler : Compiler
{
public SqlServerCompiler()
{
OpeningIdentifier = "[";
ClosingIdentifier = "]";
LastId = "SELECT scope_identity() as Id";
}
public override string EngineCode { get; } = EngineCodes.SqlServer;
public bool UseLegacyPagination { get; set; } = false;
protected override SqlResult CompileSelectQuery(Query query)
{
if (!UseLegacyPagination || !query.HasOffset(EngineCode))
{
return base.CompileSelectQuery(query);
}
query = query.Clone();
var ctx = new SqlResult
{
Query = query,
};
var limit = query.GetLimit(EngineCode);
var offset = query.GetOffset(EngineCode);
if (!query.HasComponent("select"))
{
query.Select("*");
}
var order = CompileOrders(ctx) ?? "ORDER BY (SELECT 0)";
query.SelectRaw($"ROW_NUMBER() OVER ({order}) AS [row_num]", ctx.Bindings.ToArray());
query.ClearComponent("order");
var result = base.CompileSelectQuery(query);
if (limit == 0)
{
result.RawSql = $"SELECT * FROM ({result.RawSql}) AS [results_wrapper] WHERE [row_num] >= {parameterPlaceholder}";
result.Bindings.Add(offset + 1);
}
else
{
result.RawSql = $"SELECT * FROM ({result.RawSql}) AS [results_wrapper] WHERE [row_num] BETWEEN {parameterPlaceholder} AND {parameterPlaceholder}";
result.Bindings.Add(offset + 1);
result.Bindings.Add(limit + offset);
}
return result;
}
protected override string CompileColumns(SqlResult ctx)
{
var compiled = base.CompileColumns(ctx);
if (!UseLegacyPagination)
{
return compiled;
}
// If there is a limit on the query, but not an offset, we will add the top
// clause to the query, which serves as a "limit" type clause within the
// SQL Server system similar to the limit keywords available in MySQL.
var limit = ctx.Query.GetLimit(EngineCode);
var offset = ctx.Query.GetOffset(EngineCode);
if (limit > 0 && offset == 0)
{
// top bindings should be inserted first
ctx.Bindings.Insert(0, limit);
ctx.Query.ClearComponent("limit");
// handle distinct
if (compiled.IndexOf("SELECT DISTINCT") == 0)
{
return $"SELECT DISTINCT TOP ({parameterPlaceholder}){compiled.Substring(15)}";
}
return $"SELECT TOP ({parameterPlaceholder}){compiled.Substring(6)}";
}
return compiled;
}
public override string CompileLimit(SqlResult ctx)
{
if (UseLegacyPagination)
{
// in legacy versions of Sql Server, limit is handled by TOP
// and ROW_NUMBER techniques
return null;
}
var limit = ctx.Query.GetLimit(EngineCode);
var offset = ctx.Query.GetOffset(EngineCode);
if (limit == 0 && offset == 0)
{
return null;
}
var safeOrder = "";
if (!ctx.Query.HasComponent("order"))
{
safeOrder = "ORDER BY (SELECT 0) ";
}
if (limit == 0)
{
ctx.Bindings.Add(offset);
return $"{safeOrder}OFFSET {parameterPlaceholder} ROWS";
}
ctx.Bindings.Add(offset);
ctx.Bindings.Add(limit);
return $"{safeOrder}OFFSET {parameterPlaceholder} ROWS FETCH NEXT {parameterPlaceholder} ROWS ONLY";
}
public override string CompileRandom(string seed)
{
return "NEWID()";
}
public override string CompileTrue()
{
return "cast(1 as bit)";
}
public override string CompileFalse()
{
return "cast(0 as bit)";
}
protected override string CompileBasicDateCondition(SqlResult ctx, BasicDateCondition condition)
{
var column = Wrap(condition.Column);
var part = condition.Part.ToUpperInvariant();
string left;
if (part == "TIME" || part == "DATE")
{
left = $"CAST({column} AS {part.ToUpperInvariant()})";
}
else
{
left = $"DATEPART({part.ToUpperInvariant()}, {column})";
}
var sql = $"{left} {condition.Operator} {Parameter(ctx, condition.Value)}";
if (condition.IsNot)
{
return $"NOT ({sql})";
}
return sql;
}
protected override SqlResult CompileAdHocQuery(AdHocTableFromClause adHoc)
{
var ctx = new SqlResult();
var colNames = string.Join(", ", adHoc.Columns.Select(Wrap));
var valueRow = string.Join(", ", Enumerable.Repeat(parameterPlaceholder, adHoc.Columns.Count));
var valueRows = string.Join(", ", Enumerable.Repeat($"({valueRow})", adHoc.Values.Count / adHoc.Columns.Count));
var sql = $"SELECT {colNames} FROM (VALUES {valueRows}) AS tbl ({colNames})";
ctx.RawSql = sql;
ctx.Bindings = adHoc.Values;
return ctx;
}
}
}
| {
"content_hash": "ce0ff91dd3e2469be8c4d8e058f8069d",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 162,
"avg_line_length": 30.50526315789474,
"alnum_prop": 0.5119047619047619,
"repo_name": "sqlkata/querybuilder",
"id": "0202f0f1b09f27c9013c04ec3ed421eac819a2e9",
"size": "5796",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "QueryBuilder/Compilers/SqlServerCompiler.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "420613"
}
],
"symlink_target": ""
} |
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.hadithbd.banglahadith.ui.BaseActivity">
<item
android:id="@+id/action_search"
android:orderInCategory="100"
app:showAsAction="always"
android:title=""
android:icon="@drawable/ic_search" />
<item
android:id="@+id/action_latest_update"
android:title="@string/action_latest_update"
android:orderInCategory="101"
app:showAsAction="never" />
<item
android:id="@+id/action_favorite"
android:title="@string/action_favorite"
android:orderInCategory="102"
app:showAsAction="never" />
<item
android:id="@+id/action_data_sync"
android:title="@string/action_data_sync"
android:orderInCategory="103"
app:showAsAction="never" />
<item
android:id="@+id/action_donation"
android:title="@string/action_donation"
android:orderInCategory="104"
app:showAsAction="never" />
<item
android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="105"
app:showAsAction="never" />
<item
android:id="@+id/action_about_us"
android:title="@string/action_about_us"
android:orderInCategory="106"
app:showAsAction="never" />
</menu>
| {
"content_hash": "28a8150365a2dfad3203241d38e5fb66",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 64,
"avg_line_length": 33.24444444444445,
"alnum_prop": 0.6229946524064172,
"repo_name": "Apptitive/BanglaHadith",
"id": "c3c5575748abac152ffeab3f5d6fee95fedb16ac",
"size": "1496",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/menu/menu_main.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "145003"
}
],
"symlink_target": ""
} |
<?php
namespace cebe\markdown\tests;
use cebe\markdown\Parser;
/**
* Test case for the parser base class.
*
* @author Carsten Brandt <[email protected]>
* @group default
*/
class ParserTest extends \PHPUnit_Framework_TestCase
{
public function testMarkerOrder()
{
$parser = new TestParser();
$parser->markers = [
'[' => 'parseMarkerA',
'[[' => 'parseMarkerB',
];
$this->assertEquals("<p>Result is A</p>\n", $parser->parse('Result is [abc]'));
$this->assertEquals("<p>Result is B</p>\n", $parser->parse('Result is [[abc]]'));
$this->assertEquals('Result is A', $parser->parseParagraph('Result is [abc]'));
$this->assertEquals('Result is B', $parser->parseParagraph('Result is [[abc]]'));
$parser = new TestParser();
$parser->markers = [
'[[' => 'parseMarkerB',
'[' => 'parseMarkerA',
];
$this->assertEquals("<p>Result is A</p>\n", $parser->parse('Result is [abc]'));
$this->assertEquals("<p>Result is B</p>\n", $parser->parse('Result is [[abc]]'));
$this->assertEquals('Result is A', $parser->parseParagraph('Result is [abc]'));
$this->assertEquals('Result is B', $parser->parseParagraph('Result is [[abc]]'));
}
}
class TestParser extends Parser
{
public $markers = [];
protected function inlineMarkers()
{
return $this->markers;
}
protected function parseMarkerA($text)
{
return [['text', 'A'], strrpos($text, ']') + 1];
}
protected function parseMarkerB($text)
{
return [['text', 'B'], strrpos($text, ']') + 1];
}
}
| {
"content_hash": "0ce64afb2df5d27f838ae952241a1223",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 89,
"avg_line_length": 27.75,
"alnum_prop": 0.5591591591591591,
"repo_name": "fayvlad/learn_yii2",
"id": "e40f3e5764605b10a0a3748ef4ed8cef4e80eed5",
"size": "1834",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/cebe/markdown/tests/ParserTest.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "218"
},
{
"name": "CSS",
"bytes": "1364"
},
{
"name": "PHP",
"bytes": "47301"
},
{
"name": "Shell",
"bytes": "1030"
}
],
"symlink_target": ""
} |
/*
* Core Owl Carousel CSS File
* v1.24
*/
/* clearfix */
.owl-carousel .owl-wrapper:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
/* display none until init */
.owl-carousel{
display: none;
position: relative;
width: 100%;
-ms-touch-action: pan-y;
}
.owl-carousel .owl-wrapper{
display: none;
position: relative;
-webkit-transform: translate3d(0px, 0px, 0px);
}
.owl-carousel .owl-wrapper-outer{
overflow: hidden;
position: relative;
width: 100%;
}
.owl-carousel .owl-wrapper-outer.autoHeight{
-webkit-transition: height 500ms ease-in-out;
-moz-transition: height 500ms ease-in-out;
-ms-transition: height 500ms ease-in-out;
-o-transition: height 500ms ease-in-out;
transition: height 500ms ease-in-out;
}
.owl-carousel .owl-item{
float: left;
}
.owl-controls .owl-page,
.owl-controls .owl-buttons div{
cursor: pointer;
}
.owl-controls {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* mouse grab icon */
.grabbing {
cursor:url(./grabbing.png) 8 8, move;
}
/* fix */
.owl-carousel .owl-wrapper,
.owl-carousel .owl-item{
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
-ms-transform: translate3d(0,0,0);
}
/* CSS3 Transitions */
.owl-origin {
-webkit-perspective: 1200px;
-webkit-perspective-origin-x : 50%;
-webkit-perspective-origin-y : 50%;
-moz-perspective : 1200px;
-moz-perspective-origin-x : 50%;
-moz-perspective-origin-y : 50%;
perspective : 1200px;
}
/* fade */
.owl-fade-out {
z-index: 10;
-webkit-animation: fadeOut .7s both ease;
-moz-animation: fadeOut .7s both ease;
animation: fadeOut .7s both ease;
}
.owl-fade-in {
-webkit-animation: fadeIn .7s both ease;
-moz-animation: fadeIn .7s both ease;
animation: fadeIn .7s both ease;
}
/* backSlide */
.owl-backSlide-out {
-webkit-animation: backSlideOut 1s both ease;
-moz-animation: backSlideOut 1s both ease;
animation: backSlideOut 1s both ease;
}
.owl-backSlide-in {
-webkit-animation: backSlideIn 1s both ease;
-moz-animation: backSlideIn 1s both ease;
animation: backSlideIn 1s both ease;
}
/* goDown */
.owl-goDown-out {
-webkit-animation: scaleToFade .7s ease both;
-moz-animation: scaleToFade .7s ease both;
animation: scaleToFade .7s ease both;
}
.owl-goDown-in {
-webkit-animation: goDown .6s ease both;
-moz-animation: goDown .6s ease both;
animation: goDown .6s ease both;
}
/* scaleUp */
.owl-fadeUp-in {
-webkit-animation: scaleUpFrom .5s ease both;
-moz-animation: scaleUpFrom .5s ease both;
animation: scaleUpFrom .5s ease both;
}
.owl-fadeUp-out {
-webkit-animation: scaleUpTo .5s ease both;
-moz-animation: scaleUpTo .5s ease both;
animation: scaleUpTo .5s ease both;
}
/* Keyframes */
/*empty*/
@-webkit-keyframes empty {
0% {opacity: 1}
}
@-moz-keyframes empty {
0% {opacity: 1}
}
@keyframes empty {
0% {opacity: 1}
}
@-webkit-keyframes fadeIn {
0% { opacity:0; }
100% { opacity:1; }
}
@-moz-keyframes fadeIn {
0% { opacity:0; }
100% { opacity:1; }
}
@keyframes fadeIn {
0% { opacity:0; }
100% { opacity:1; }
}
@-webkit-keyframes fadeOut {
0% { opacity:1; }
100% { opacity:0; }
}
@-moz-keyframes fadeOut {
0% { opacity:1; }
100% { opacity:0; }
}
@keyframes fadeOut {
0% { opacity:1; }
100% { opacity:0; }
}
@-webkit-keyframes backSlideOut {
25% { opacity: .5; -webkit-transform: translateZ(-500px); }
75% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
}
@-moz-keyframes backSlideOut {
25% { opacity: .5; -moz-transform: translateZ(-500px); }
75% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
}
@keyframes backSlideOut {
25% { opacity: .5; transform: translateZ(-500px); }
75% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
}
@-webkit-keyframes backSlideIn {
0%, 25% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; -webkit-transform: translateZ(-500px); }
100% { opacity: 1; -webkit-transform: translateZ(0) translateX(0); }
}
@-moz-keyframes backSlideIn {
0%, 25% { opacity: .5; -moz-transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; -moz-transform: translateZ(-500px); }
100% { opacity: 1; -moz-transform: translateZ(0) translateX(0); }
}
@keyframes backSlideIn {
0%, 25% { opacity: .5; transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; transform: translateZ(-500px); }
100% { opacity: 1; transform: translateZ(0) translateX(0); }
}
@-webkit-keyframes scaleToFade {
to { opacity: 0; -webkit-transform: scale(.8); }
}
@-moz-keyframes scaleToFade {
to { opacity: 0; -moz-transform: scale(.8); }
}
@keyframes scaleToFade {
to { opacity: 0; transform: scale(.8); }
}
@-webkit-keyframes goDown {
from { -webkit-transform: translateY(-100%); }
}
@-moz-keyframes goDown {
from { -moz-transform: translateY(-100%); }
}
@keyframes goDown {
from { transform: translateY(-100%); }
}
@-webkit-keyframes scaleUpFrom {
from { opacity: 0; -webkit-transform: scale(1.5); }
}
@-moz-keyframes scaleUpFrom {
from { opacity: 0; -moz-transform: scale(1.5); }
}
@keyframes scaleUpFrom {
from { opacity: 0; transform: scale(1.5); }
}
@-webkit-keyframes scaleUpTo {
to { opacity: 0; -webkit-transform: scale(1.5); }
}
@-moz-keyframes scaleUpTo {
to { opacity: 0; -moz-transform: scale(1.5); }
}
@keyframes scaleUpTo {
to { opacity: 0; transform: scale(1.5); }
}
| {
"content_hash": "366c5f788d4e2e69bf1f4014af47276a",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 82,
"avg_line_length": 26.64069264069264,
"alnum_prop": 0.6421839454013649,
"repo_name": "mathee92/unirentalz",
"id": "2e356d187d85ea5b6c3dcf72f02ec9a42e158a48",
"size": "6154",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "sarkkara/assets/plugins/owl-carousel/owl.carousel.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "301153"
},
{
"name": "JavaScript",
"bytes": "332881"
},
{
"name": "Python",
"bytes": "338982"
}
],
"symlink_target": ""
} |
/**
* @file gis.h
* @brief WELL GIS storage
* @author Oleg Borschuk
* @version
* @date 2011-07-26
*/
#ifndef GIS_2XEDKE05
#define GIS_2XEDKE05
#include <string>
#include <sstream>
#include <vector>
#include <fstream>
#include "gis_iface.h"
#include "bs_serialize_decl.h"
namespace blue_sky
{
class BS_API_PLUGIN gis : public gis_iface
{
public:
typedef BS_SP (table_iface) sp_table_iface;
typedef BS_SP (prop_iface) sp_prop_iface;
// ------------------------------------
// METHODS
// ------------------------------------
public:
// destructor
virtual ~gis ()
{}
// ------------------------------------
// INTERFACE METHODS
// ------------------------------------
/**
* @brief return SP to the table
*/
virtual sp_table_iface get_table ()
{
return sp_table;
}
/**
* @brief return SP to the property
*/
virtual sp_prop_iface get_prop ()
{
return sp_prop;
}
/**
* @brief read data from LAS file
*
* @param fname -- <INPUT> path to the LAS file
*
* @return 0 if ok
*/
virtual int read_from_las_file (const std::string &fname);
virtual sp_gis_t check_serial () const;
public:
#ifdef BSPY_EXPORTING_PLUGIN
/**
* @brief pack(serialize) all information of class to text string
*
* @return string
*/
virtual std::string to_str () const;
/**
* @brief Reastore all class information from input text string
*
* @param s -- <INPUT> string
*/
virtual void from_str (const std::string &s);
/**
* @brief python print wrapper
*
* @return return table description
*/
virtual std::string py_str () const;
#endif //BSPY_EXPORTING_PLUGIN
protected:
int read_ver_info (sp_prop_iface prop, std::string &s);
int read_wel_info (sp_prop_iface prop, std::string &s, double ver);
int read_par_info (sp_prop_iface prop, std::string &s, double ver);
int read_cur_info (sp_prop_iface prop, std::string &s, int n);
int read_asc_info (std::vector<t_double> &v, std::string &s, int n, std::ifstream &file, const double);
int read_asc_info2 (std::vector<t_double> &v, std::string &s, int n, std::ifstream &file, const double);
//int read_ver_info (sp_prop_iface prop, const string &s);
//int read_ver_info (sp_prop_iface prop, const string &s);
//int read_ver_info (sp_prop_iface prop, const string &s);
//int read_ver_info (sp_prop_iface prop, const string &s);
//int read_ver_info (sp_prop_iface prop, const string &s);
// ------------------------------
// VARIABLES
// ------------------------------
protected:
sp_table_iface sp_table; //!< table pointer
sp_prop_iface sp_prop; //!< ptoperties pointer
BLUE_SKY_TYPE_DECL (gis);
friend class bs_serialize;
};
}; //end of blue_sky namespace
#endif /* end of include guard: GIS_2XEDKE05 */
| {
"content_hash": "874a86cc36feffd246368f20d6511b10",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 110,
"avg_line_length": 27.14406779661017,
"alnum_prop": 0.5173275054636278,
"repo_name": "bs-eagle/bs-eagle",
"id": "c807e824647b54e7cd5dd57ec5568f960b92120a",
"size": "3203",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common_types/src/gis.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "1703"
},
{
"name": "C",
"bytes": "5278838"
},
{
"name": "C++",
"bytes": "4111959"
},
{
"name": "Makefile",
"bytes": "349"
},
{
"name": "Objective-C",
"bytes": "46566"
},
{
"name": "Python",
"bytes": "32468"
}
],
"symlink_target": ""
} |
Books = new Mongo.Collection('books'); | {
"content_hash": "91580d99dd21d0c3523d2bef79fea9b7",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 38,
"avg_line_length": 38,
"alnum_prop": 0.7368421052631579,
"repo_name": "Lindennerd/collaborative-library",
"id": "c963c44b75d8f71b3b2e4347280060361959e92b",
"size": "38",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/lib/collections/collections.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "246"
},
{
"name": "HTML",
"bytes": "3465"
},
{
"name": "JavaScript",
"bytes": "1419"
}
],
"symlink_target": ""
} |
Ext.data.JsonP.Ext_dd_DropTarget({
"tagname": "class",
"name": "Ext.dd.DropTarget",
"doc": "<p>A simple class that provides the basic implementation needed to make any element a drop target that can have\ndraggable items dropped onto it. The drop has no effect until an implementation of notifyDrop is provided.</p>\n",
"extends": "Ext.dd.DDTarget",
"mixins": [
],
"alternateClassNames": [
],
"xtype": null,
"author": null,
"docauthor": null,
"singleton": false,
"private": false,
"cfg": [
{
"tagname": "cfg",
"name": "ddGroup",
"member": "Ext.dd.DropTarget",
"type": "String",
"doc": "<p>A named drag drop group to which this object belongs. If a group is specified, then this object will only\ninteract with other drag drop objects in the same group (defaults to undefined).</p>\n",
"private": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 27,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-cfg-ddGroup",
"shortDoc": "A named drag drop group to which this object belongs. If a group is specified, then this object will only\ninteract w..."
},
{
"tagname": "cfg",
"name": "dropAllowed",
"member": "Ext.dd.DropTarget",
"type": "String",
"doc": "<p>The CSS class returned to the drag source when drop is allowed (defaults to \"x-dd-drop-ok\").</p>\n",
"private": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 36,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-cfg-dropAllowed"
},
{
"tagname": "cfg",
"name": "dropNotAllowed",
"member": "Ext.dd.DropTarget",
"type": "String",
"doc": "<p>The CSS class returned to the drag source when drop is not allowed (defaults to \"x-dd-drop-nodrop\").</p>\n",
"private": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 41,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-cfg-dropNotAllowed"
},
{
"tagname": "cfg",
"name": "overClass",
"member": "Ext.dd.DropTarget",
"type": "String",
"doc": "<p>The CSS class applied to the drop target element while the drag source is over it (defaults to \"\").</p>\n",
"private": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 32,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-cfg-overClass"
}
],
"method": [
{
"tagname": "method",
"name": "DropTarget",
"member": "Ext.dd.DropTarget",
"doc": "\n",
"params": [
{
"type": "Mixed",
"name": "el",
"doc": "<p>The container element</p>\n",
"optional": false
},
{
"type": "Object",
"name": "config",
"doc": "\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 1,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-method-constructor",
"shortDoc": "\n"
},
{
"tagname": "method",
"name": "addInvalidHandleClass",
"member": "Ext.dd.DragDrop",
"doc": "<p>Lets you specify a css class of elements that will not initiate a drag</p>\n",
"params": [
{
"type": "string",
"name": "cssClass",
"doc": "<p>the class of the elements you wish to ignore</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 894,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-addInvalidHandleClass",
"shortDoc": "<p>Lets you specify a css class of elements that will not initiate a drag</p>\n"
},
{
"tagname": "method",
"name": "addInvalidHandleId",
"member": "Ext.dd.DragDrop",
"doc": "<p>Lets you to specify an element id for a child of a drag handle\nthat should not initiate a drag</p>\n",
"params": [
{
"type": "string",
"name": "id",
"doc": "<p>the element id of the element you wish to ignore</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 881,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-addInvalidHandleId",
"shortDoc": "<p>Lets you to specify an element id for a child of a drag handle\nthat should not initiate a drag</p>\n"
},
{
"tagname": "method",
"name": "addInvalidHandleType",
"member": "Ext.dd.DragDrop",
"doc": "<p>Allows you to specify a tag name that should not start a drag operation\nwhen clicked. This is designed to facilitate embedding links within a\ndrag handle that do something other than start the drag.</p>\n",
"params": [
{
"type": "string",
"name": "tagName",
"doc": "<p>the type of element to exclude</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 869,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-addInvalidHandleType",
"shortDoc": "Allows you to specify a tag name that should not start a drag operation\nwhen clicked. This is designed to facilitate..."
},
{
"tagname": "method",
"name": "addToGroup",
"member": "Ext.dd.DragDrop",
"doc": "<p>Add this instance to a group of related drag/drop objects. All\ninstances belong to at least one group, and can belong to as many\ngroups as needed.</p>\n",
"params": [
{
"type": "Object",
"name": "sGroup",
"doc": "<p>{string} the name of the group</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 730,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-addToGroup",
"shortDoc": "Add this instance to a group of related drag/drop objects. All\ninstances belong to at least one group, and can belon..."
},
{
"tagname": "method",
"name": "applyConfig",
"member": "Ext.dd.DragDrop",
"doc": "<p>Applies the configuration parameters that were passed into the constructor.\nThis is supposed to happen at each level through the inheritance chain. So\na DDProxy implentation will execute apply config on DDProxy, DD, and\nDragDrop in order to get all of the parameters that are available in\neach object.</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 635,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-applyConfig",
"shortDoc": "Applies the configuration parameters that were passed into the constructor.\nThis is supposed to happen at each level ..."
},
{
"tagname": "method",
"name": "clearConstraints",
"member": "Ext.dd.DragDrop",
"doc": "<p>Clears any constraints applied to this instance. Also clears ticks\nsince they can't exist independent of a constraint at this time.</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 1049,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-clearConstraints",
"shortDoc": "Clears any constraints applied to this instance. Also clears ticks\nsince they can't exist independent of a constrain..."
},
{
"tagname": "method",
"name": "clearTicks",
"member": "Ext.dd.DragDrop",
"doc": "<p>Clears any tick interval defined for this instance</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 1060,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-clearTicks",
"shortDoc": "<p>Clears any tick interval defined for this instance</p>\n"
},
{
"tagname": "method",
"name": "constrainTo",
"member": "Ext.dd.DragDrop",
"doc": "<p>Initializes the drag drop object's constraints to restrict movement to a certain element.</p>\n\n<p>Usage:</p>\n\n<pre><code> var dd = new Ext.dd.DDProxy(\"dragDiv1\", \"proxytest\",\n { dragElId: \"existingProxyDiv\" });\n dd.startDrag = function(){\n this.constrainTo(\"parent-id\");\n };\n </code></pre>\n\n\n<p>Or you can initalize it using the <a href=\"#/api/Ext.core.Element\" rel=\"Ext.core.Element\" class=\"docClass\">Ext.core.Element</a> object:</p>\n\n<pre><code> Ext.get(\"dragDiv1\").initDDProxy(\"proxytest\", {dragElId: \"existingProxyDiv\"}, {\n startDrag : function(){\n this.constrainTo(\"parent-id\");\n }\n });\n </code></pre>\n\n",
"params": [
{
"type": "Mixed",
"name": "constrainTo",
"doc": "<p>The element to constrain to.</p>\n",
"optional": false
},
{
"type": "Object/Number",
"name": "pad",
"doc": "<p>(optional) Pad provides a way to specify \"padding\" of the constraints,\nand can be either a number for symmetrical padding (4 would be equal to {left:4, right:4, top:4, bottom:4}) or\nan object containing the sides to pad. For example: {right:10, bottom:10}</p>\n",
"optional": true
},
{
"type": "Boolean",
"name": "inContent",
"doc": "<p>(optional) Constrain the draggable in the content box of the element (inside padding and borders)</p>\n",
"optional": true
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 493,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-constrainTo",
"shortDoc": "Initializes the drag drop object's constraints to restrict movement to a certain element.\n\nUsage:\n\n var dd = new Ext...."
},
{
"tagname": "method",
"name": "endDrag",
"member": "Ext.dd.DragDrop",
"doc": "<p>Fired when we are done dragging the object</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mouseup event</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 445,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-endDrag",
"shortDoc": "<p>Fired when we are done dragging the object</p>\n"
},
{
"tagname": "method",
"name": "getDragEl",
"member": "Ext.dd.DragDrop",
"doc": "<p>Returns a reference to the actual element to drag. By default this is\nthe same as the html element, but it can be assigned to another\nelement. An example of this can be found in Ext.dd.DDProxy</p>\n",
"params": [
],
"return": {
"type": "HTMLElement",
"doc": "<p>the html element</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 563,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-getDragEl",
"shortDoc": "Returns a reference to the actual element to drag. By default this is\nthe same as the html element, but it can be as..."
},
{
"tagname": "method",
"name": "getEl",
"member": "Ext.dd.DragDrop",
"doc": "<p>Returns a reference to the linked element</p>\n",
"params": [
],
"return": {
"type": "HTMLElement",
"doc": "<p>the html element</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 550,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-getEl",
"shortDoc": "<p>Returns a reference to the linked element</p>\n"
},
{
"tagname": "method",
"name": "init",
"member": "Ext.dd.DragDrop",
"doc": "<p>Sets up the DragDrop object. Must be called in the constructor of any\n<a href=\"#/api/Ext.dd.DragDrop\" rel=\"Ext.dd.DragDrop\" class=\"docClass\">Ext.dd.DragDrop</a> subclass</p>\n",
"params": [
{
"type": "Object",
"name": "id",
"doc": "<p>the id of the linked element</p>\n",
"optional": false
},
{
"type": "String",
"name": "sGroup",
"doc": "<p>the group of related items</p>\n",
"optional": false
},
{
"type": "object",
"name": "config",
"doc": "<p>configuration attributes</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 574,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-init",
"shortDoc": "<p>Sets up the DragDrop object. Must be called in the constructor of any\n<a href=\"#/api/Ext.dd.DragDrop\" rel=\"Ext.dd.DragDrop\" class=\"docClass\">Ext.dd.DragDrop</a> subclass</p>\n"
},
{
"tagname": "method",
"name": "initTarget",
"member": "Ext.dd.DragDrop",
"doc": "<p>Initializes Targeting functionality only... the object does not\nget a mousedown handler.</p>\n",
"params": [
{
"type": "Object",
"name": "id",
"doc": "<p>the id of the linked element</p>\n",
"optional": false
},
{
"type": "String",
"name": "sGroup",
"doc": "<p>the group of related items</p>\n",
"optional": false
},
{
"type": "object",
"name": "config",
"doc": "<p>configuration attributes</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 588,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-initTarget",
"shortDoc": "<p>Initializes Targeting functionality only... the object does not\nget a mousedown handler.</p>\n"
},
{
"tagname": "method",
"name": "isLocked",
"member": "Ext.dd.DragDrop",
"doc": "<p>Returns true if this instance is locked, or the drag drop mgr is locked\n(meaning that all drag/drop is disabled on the page.)</p>\n",
"params": [
],
"return": {
"type": "boolean",
"doc": "<p>true if this obj or all drag/drop is locked, else\nfalse</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 814,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-isLocked",
"shortDoc": "Returns true if this instance is locked, or the drag drop mgr is locked\n(meaning that all drag/drop is disabled on th..."
},
{
"tagname": "method",
"name": "isValidHandleChild",
"member": "Ext.dd.DragDrop",
"doc": "<p>Checks the tag exclusion list to see if this click should be ignored</p>\n",
"params": [
{
"type": "HTMLElement",
"name": "node",
"doc": "<p>the HTMLElement to evaluate</p>\n",
"optional": false
}
],
"return": {
"type": "boolean",
"doc": "<p>true if this is a valid tag type, false if not</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 940,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-isValidHandleChild",
"shortDoc": "<p>Checks the tag exclusion list to see if this click should be ignored</p>\n"
},
{
"tagname": "method",
"name": "lock",
"member": "Ext.dd.DragDrop",
"doc": "<p>Lock this instance</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 177,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-lock",
"shortDoc": "<p>Lock this instance</p>\n"
},
{
"tagname": "method",
"name": "notifyDrop",
"member": "Ext.dd.DropTarget",
"doc": "<p>The function a <a href=\"#/api/Ext.dd.DragSource\" rel=\"Ext.dd.DragSource\" class=\"docClass\">Ext.dd.DragSource</a> calls once to notify this drop target that the dragged item has\nbeen dropped on it. This method has no default implementation and returns false, so you must provide an\nimplementation that does something to process the drop event and returns true so that the drag source's\nrepair action does not run.</p>\n",
"params": [
{
"type": "Ext.dd.DragSource",
"name": "source",
"doc": "<p>The drag source that was dragged over this drop target</p>\n",
"optional": false
},
{
"type": "Event",
"name": "e",
"doc": "<p>The event</p>\n",
"optional": false
},
{
"type": "Object",
"name": "data",
"doc": "<p>An object containing arbitrary data supplied by the drag source</p>\n",
"optional": false
}
],
"return": {
"type": "Boolean",
"doc": "<p>False if the drop was invalid.</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 98,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-method-notifyDrop",
"shortDoc": "The function a Ext.dd.DragSource calls once to notify this drop target that the dragged item has\nbeen dropped on it. ..."
},
{
"tagname": "method",
"name": "notifyEnter",
"member": "Ext.dd.DropTarget",
"doc": "<p>The function a <a href=\"#/api/Ext.dd.DragSource\" rel=\"Ext.dd.DragSource\" class=\"docClass\">Ext.dd.DragSource</a> calls once to notify this drop target that the source is now over the\ntarget. This default implementation adds the CSS class specified by overClass (if any) to the drop element\nand returns the dropAllowed config value. This method should be overridden if drop validation is required.</p>\n",
"params": [
{
"type": "Ext.dd.DragSource",
"name": "source",
"doc": "<p>The drag source that was dragged over this drop target</p>\n",
"optional": false
},
{
"type": "Event",
"name": "e",
"doc": "<p>The event</p>\n",
"optional": false
},
{
"type": "Object",
"name": "data",
"doc": "<p>An object containing arbitrary data supplied by the drag source</p>\n",
"optional": false
}
],
"return": {
"type": "String",
"doc": "<p>status The CSS class that communicates the drop status back to the source so that the\nunderlying <a href=\"#/api/Ext.dd.StatusProxy\" rel=\"Ext.dd.StatusProxy\" class=\"docClass\">Ext.dd.StatusProxy</a> can be updated</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 53,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-method-notifyEnter",
"shortDoc": "The function a Ext.dd.DragSource calls once to notify this drop target that the source is now over the\ntarget. This ..."
},
{
"tagname": "method",
"name": "notifyOut",
"member": "Ext.dd.DropTarget",
"doc": "<p>The function a <a href=\"#/api/Ext.dd.DragSource\" rel=\"Ext.dd.DragSource\" class=\"docClass\">Ext.dd.DragSource</a> calls once to notify this drop target that the source has been dragged\nout of the target without dropping. This default implementation simply removes the CSS class specified by\noverClass (if any) from the drop element.</p>\n",
"params": [
{
"type": "Ext.dd.DragSource",
"name": "source",
"doc": "<p>The drag source that was dragged over this drop target</p>\n",
"optional": false
},
{
"type": "Event",
"name": "e",
"doc": "<p>The event</p>\n",
"optional": false
},
{
"type": "Object",
"name": "data",
"doc": "<p>An object containing arbitrary data supplied by the drag source</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 84,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-method-notifyOut",
"shortDoc": "The function a Ext.dd.DragSource calls once to notify this drop target that the source has been dragged\nout of the ta..."
},
{
"tagname": "method",
"name": "notifyOver",
"member": "Ext.dd.DropTarget",
"doc": "<p>The function a <a href=\"#/api/Ext.dd.DragSource\" rel=\"Ext.dd.DragSource\" class=\"docClass\">Ext.dd.DragSource</a> calls continuously while it is being dragged over the target.\nThis method will be called on every mouse movement while the drag source is over the drop target.\nThis default implementation simply returns the dropAllowed config value.</p>\n",
"params": [
{
"type": "Ext.dd.DragSource",
"name": "source",
"doc": "<p>The drag source that was dragged over this drop target</p>\n",
"optional": false
},
{
"type": "Event",
"name": "e",
"doc": "<p>The event</p>\n",
"optional": false
},
{
"type": "Object",
"name": "data",
"doc": "<p>An object containing arbitrary data supplied by the drag source</p>\n",
"optional": false
}
],
"return": {
"type": "String",
"doc": "<p>status The CSS class that communicates the drop status back to the source so that the\nunderlying <a href=\"#/api/Ext.dd.StatusProxy\" rel=\"Ext.dd.StatusProxy\" class=\"docClass\">Ext.dd.StatusProxy</a> can be updated</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 70,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget-method-notifyOver",
"shortDoc": "The function a Ext.dd.DragSource calls continuously while it is being dragged over the target.\nThis method will be ca..."
},
{
"tagname": "method",
"name": "onAvailable",
"member": "Ext.dd.DragDrop",
"doc": "<p>Override the onAvailable method to do what is needed after the initial\nposition was determined.</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 474,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onAvailable",
"shortDoc": "<p>Override the onAvailable method to do what is needed after the initial\nposition was determined.</p>\n"
},
{
"tagname": "method",
"name": "onDrag",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called during the onMouseMove event while dragging an\nobject.</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mousemove event</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 358,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onDrag",
"shortDoc": "<p>Abstract method called during the onMouseMove event while dragging an\nobject.</p>\n"
},
{
"tagname": "method",
"name": "onDragDrop",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called when this item is dropped on another DragDrop\nobj</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mouseup event</p>\n",
"optional": false
},
{
"type": "String|DragDrop[]",
"name": "id",
"doc": "<p>In POINT mode, the element\nid this was dropped on. In INTERSECT mode, an array of dd items this\nwas dropped on.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 419,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onDragDrop",
"shortDoc": "<p>Abstract method called when this item is dropped on another DragDrop\nobj</p>\n"
},
{
"tagname": "method",
"name": "onDragEnter",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called when this element fist begins hovering over\nanother DragDrop obj</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mousemove event</p>\n",
"optional": false
},
{
"type": "String|DragDrop[]",
"name": "id",
"doc": "<p>In POINT mode, the element\nid this is hovering over. In INTERSECT mode, an array of one or more\ndragdrop items being hovered over.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 366,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onDragEnter",
"shortDoc": "<p>Abstract method called when this element fist begins hovering over\nanother DragDrop obj</p>\n"
},
{
"tagname": "method",
"name": "onDragOut",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called when we are no longer hovering over an element</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mousemove event</p>\n",
"optional": false
},
{
"type": "String|DragDrop[]",
"name": "id",
"doc": "<p>In POINT mode, the element\nid this was hovering over. In INTERSECT mode, an array of dd items\nthat the mouse is no longer over.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 402,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onDragOut",
"shortDoc": "<p>Abstract method called when we are no longer hovering over an element</p>\n"
},
{
"tagname": "method",
"name": "onDragOver",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called when this element is hovering over another\nDragDrop obj</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mousemove event</p>\n",
"optional": false
},
{
"type": "String|DragDrop[]",
"name": "id",
"doc": "<p>In POINT mode, the element\nid this is hovering over. In INTERSECT mode, an array of dd items\nbeing hovered over.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 384,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onDragOver",
"shortDoc": "<p>Abstract method called when this element is hovering over another\nDragDrop obj</p>\n"
},
{
"tagname": "method",
"name": "onInvalidDrop",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called when this item is dropped on an area with no\ndrop target</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mouseup event</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 430,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onInvalidDrop",
"shortDoc": "<p>Abstract method called when this item is dropped on an area with no\ndrop target</p>\n"
},
{
"tagname": "method",
"name": "onMouseDown",
"member": "Ext.dd.DragDrop",
"doc": "<p>Event handler that fires when a drag/drop obj gets a mousedown</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mousedown event</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 460,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onMouseDown",
"shortDoc": "<p>Event handler that fires when a drag/drop obj gets a mousedown</p>\n"
},
{
"tagname": "method",
"name": "onMouseUp",
"member": "Ext.dd.DragDrop",
"doc": "<p>Event handler that fires when a drag/drop obj gets a mouseup</p>\n",
"params": [
{
"type": "Event",
"name": "e",
"doc": "<p>the mouseup event</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 467,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-onMouseUp",
"shortDoc": "<p>Event handler that fires when a drag/drop obj gets a mouseup</p>\n"
},
{
"tagname": "method",
"name": "removeFromGroup",
"member": "Ext.dd.DragDrop",
"doc": "<p>Remove's this instance from the supplied interaction group</p>\n",
"params": [
{
"type": "string",
"name": "sGroup",
"doc": "<p>The group to drop</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 742,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-removeFromGroup",
"shortDoc": "<p>Remove's this instance from the supplied interaction group</p>\n"
},
{
"tagname": "method",
"name": "removeInvalidHandleClass",
"member": "Ext.dd.DragDrop",
"doc": "<p>Unsets an invalid css class</p>\n",
"params": [
{
"type": "string",
"name": "cssClass",
"doc": "<p>the class of the element(s) you wish to\nre-enable</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 926,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-removeInvalidHandleClass",
"shortDoc": "<p>Unsets an invalid css class</p>\n"
},
{
"tagname": "method",
"name": "removeInvalidHandleId",
"member": "Ext.dd.DragDrop",
"doc": "<p>Unsets an invalid handle id</p>\n",
"params": [
{
"type": "string",
"name": "id",
"doc": "<p>the id of the element to re-enable</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 914,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-removeInvalidHandleId",
"shortDoc": "<p>Unsets an invalid handle id</p>\n"
},
{
"tagname": "method",
"name": "removeInvalidHandleType",
"member": "Ext.dd.DragDrop",
"doc": "<p>Unsets an excluded tag name set by addInvalidHandleType</p>\n",
"params": [
{
"type": "string",
"name": "tagName",
"doc": "<p>the type of element to unexclude</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 903,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-removeInvalidHandleType",
"shortDoc": "<p>Unsets an excluded tag name set by addInvalidHandleType</p>\n"
},
{
"tagname": "method",
"name": "resetConstraints",
"member": "Ext.dd.DragDrop",
"doc": "<p>resetConstraints must be called if you manually reposition a dd element.</p>\n",
"params": [
{
"type": "boolean",
"name": "maintainOffset",
"doc": "\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 1093,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-resetConstraints",
"shortDoc": "<p>resetConstraints must be called if you manually reposition a dd element.</p>\n"
},
{
"tagname": "method",
"name": "setDragElId",
"member": "Ext.dd.DragDrop",
"doc": "<p>Allows you to specify that an element other than the linked element\nwill be moved with the cursor during a drag</p>\n",
"params": [
{
"type": "Object",
"name": "id",
"doc": "<p>{string} the id of the element that will be used to initiate the drag</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 755,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setDragElId",
"shortDoc": "<p>Allows you to specify that an element other than the linked element\nwill be moved with the cursor during a drag</p>\n"
},
{
"tagname": "method",
"name": "setHandleElId",
"member": "Ext.dd.DragDrop",
"doc": "<p>Allows you to specify a child of the linked element that should be\nused to initiate the drag operation. An example of this would be if\nyou have a content div with text and links. Clicking anywhere in the\ncontent area would normally start the drag operation. Use this method\nto specify that an element inside of the content div is the element\nthat starts the drag operation.</p>\n",
"params": [
{
"type": "Object",
"name": "id",
"doc": "<p>{string} the id of the element that will be used to\ninitiate the drag.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 765,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setHandleElId",
"shortDoc": "Allows you to specify a child of the linked element that should be\nused to initiate the drag operation. An example o..."
},
{
"tagname": "method",
"name": "setInitPosition",
"member": "Ext.dd.DragDrop",
"doc": "<p>Stores the initial placement of the linked element.</p>\n",
"params": [
{
"type": "int",
"name": "diffX",
"doc": "<p>the X offset, default 0</p>\n",
"optional": false
},
{
"type": "int",
"name": "diffY",
"doc": "<p>the Y offset, default 0</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 688,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setInitPosition",
"shortDoc": "<p>Stores the initial placement of the linked element.</p>\n"
},
{
"tagname": "method",
"name": "setOuterHandleElId",
"member": "Ext.dd.DragDrop",
"doc": "<p>Allows you to set an element outside of the linked element as a drag\nhandle</p>\n",
"params": [
{
"type": "Object",
"name": "id",
"doc": "<p>the id of the element that will be used to initiate the drag</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 784,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setOuterHandleElId",
"shortDoc": "<p>Allows you to set an element outside of the linked element as a drag\nhandle</p>\n"
},
{
"tagname": "method",
"name": "setPadding",
"member": "Ext.dd.DragDrop",
"doc": "<p>Configures the padding for the target zone in px. Effectively expands\n(or reduces) the virtual object size for targeting calculations.\nSupports css-style shorthand; if only one parameter is passed, all sides\nwill have that padding, and if only two are passed, the top and bottom\nwill have the first param, the left and right the second.</p>\n",
"params": [
{
"type": "int",
"name": "iTop",
"doc": "<p>Top pad</p>\n",
"optional": false
},
{
"type": "int",
"name": "iRight",
"doc": "<p>Right pad</p>\n",
"optional": false
},
{
"type": "int",
"name": "iBot",
"doc": "<p>Bot pad</p>\n",
"optional": false
},
{
"type": "int",
"name": "iLeft",
"doc": "<p>Left pad</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 665,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setPadding",
"shortDoc": "Configures the padding for the target zone in px. Effectively expands\n(or reduces) the virtual object size for targe..."
},
{
"tagname": "method",
"name": "setXConstraint",
"member": "Ext.dd.DragDrop",
"doc": "<p>By default, the element can be dragged any place on the screen. Use\nthis method to limit the horizontal travel of the element. Pass in\n0,0 for the parameters if you want to lock the drag to the y axis.</p>\n",
"params": [
{
"type": "int",
"name": "iLeft",
"doc": "<p>the number of pixels the element can move to the left</p>\n",
"optional": false
},
{
"type": "int",
"name": "iRight",
"doc": "<p>the number of pixels the element can move to the\nright</p>\n",
"optional": false
},
{
"type": "int",
"name": "iTickSize",
"doc": "<p>optional parameter for specifying that the\nelement\nshould move iTickSize pixels at a time.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 1026,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setXConstraint",
"shortDoc": "By default, the element can be dragged any place on the screen. Use\nthis method to limit the horizontal travel of th..."
},
{
"tagname": "method",
"name": "setYConstraint",
"member": "Ext.dd.DragDrop",
"doc": "<p>By default, the element can be dragged any place on the screen. Set\nthis to limit the vertical travel of the element. Pass in 0,0 for the\nparameters if you want to lock the drag to the x axis.</p>\n",
"params": [
{
"type": "int",
"name": "iUp",
"doc": "<p>the number of pixels the element can move up</p>\n",
"optional": false
},
{
"type": "int",
"name": "iDown",
"doc": "<p>the number of pixels the element can move down</p>\n",
"optional": false
},
{
"type": "int",
"name": "iTickSize",
"doc": "<p>optional parameter for specifying that the\nelement should move iTickSize pixels at a time.</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 1071,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-setYConstraint",
"shortDoc": "By default, the element can be dragged any place on the screen. Set\nthis to limit the vertical travel of the element..."
},
{
"tagname": "method",
"name": "startDrag",
"member": "Ext.dd.DragDrop",
"doc": "<p>Abstract method called after a drag/drop object is clicked\nand the drag or mousedown time thresholds have beeen met.</p>\n",
"params": [
{
"type": "int",
"name": "X",
"doc": "<p>click location</p>\n",
"optional": false
},
{
"type": "int",
"name": "Y",
"doc": "<p>click location</p>\n",
"optional": false
}
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 342,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-startDrag",
"shortDoc": "<p>Abstract method called after a drag/drop object is clicked\nand the drag or mousedown time thresholds have beeen met.</p>\n"
},
{
"tagname": "method",
"name": "toString",
"member": "Ext.dd.DragDrop",
"doc": "<p>toString method</p>\n",
"params": [
],
"return": {
"type": "string",
"doc": "<p>string representation of the dd obj</p>\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 1160,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-toString",
"shortDoc": "<p>toString method</p>\n"
},
{
"tagname": "method",
"name": "unlock",
"member": "Ext.dd.DragDrop",
"doc": "<p>Unlock this instace</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 193,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-unlock",
"shortDoc": "<p>Unlock this instace</p>\n"
},
{
"tagname": "method",
"name": "unreg",
"member": "Ext.dd.DragDrop",
"doc": "<p>Remove all drag and drop hooks for this element</p>\n",
"params": [
],
"return": {
"type": "void",
"doc": "\n"
},
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 800,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-method-unreg",
"shortDoc": "<p>Remove all drag and drop hooks for this element</p>\n"
}
],
"property": [
{
"tagname": "property",
"name": "available",
"member": "Ext.dd.DragDrop",
"type": "boolean",
"doc": "<p>The available property is false until the linked dom element is accessible.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 315,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-available"
},
{
"tagname": "property",
"name": "config",
"member": "Ext.dd.DragDrop",
"type": "object",
"doc": "<p>Configuration attributes passed into the constructor</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 81,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-config"
},
{
"tagname": "property",
"name": "defaultPadding",
"member": "Ext.dd.DragDrop",
"type": "Object",
"doc": "<p>Provides default constraint padding to \"constrainTo\" elements (defaults to {left: 0, right:0, top:0, bottom:0}).</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 482,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-defaultPadding"
},
{
"tagname": "property",
"name": "groups",
"member": "Ext.dd.DragDrop",
"type": "object",
"doc": "<p>The group defines a logical collection of DragDrop objects that are\nrelated. Instances only get events when interacting with other\nDragDrop object in the same group. This lets us define multiple\ngroups using a single DragDrop subclass if we want. An object in the format {'group1':true, 'group2':true}</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 158,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-groups",
"shortDoc": "The group defines a logical collection of DragDrop objects that are\nrelated. Instances only get events when interact..."
},
{
"tagname": "property",
"name": "hasOuterHandles",
"member": "Ext.dd.DragDrop",
"type": "boolean",
"doc": "<p>By default, drags can only be initiated if the mousedown occurs in the\nregion the linked element is. This is done in part to work around a\nbug in some browsers that mis-report the mousedown if the previous\nmouseup happened outside of the window. This property is set to true\nif outer handles are defined. @default false</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 322,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-hasOuterHandles",
"shortDoc": "By default, drags can only be initiated if the mousedown occurs in the\nregion the linked element is. This is done in..."
},
{
"tagname": "property",
"name": "id",
"member": "Ext.dd.DragDrop",
"type": "String",
"doc": "<p>The id of the element associated with this object. This is what we\nrefer to as the \"linked element\" because the size and position of\nthis element is used to determine when the drag and drop objects have\ninteracted.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 71,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-id",
"shortDoc": "The id of the element associated with this object. This is what we\nrefer to as the \"linked element\" because the size..."
},
{
"tagname": "property",
"name": "ignoreSelf",
"member": "Ext.dd.DragDrop",
"type": "Boolean",
"doc": "<p>Set to false to enable a DragDrop object to fire drag events while dragging\nover its own Element. Defaults to true - DragDrop objects do not by default\nfire drag events to themselves.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 63,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-ignoreSelf",
"shortDoc": "Set to false to enable a DragDrop object to fire drag events while dragging\nover its own Element. Defaults to true - ..."
},
{
"tagname": "property",
"name": "invalidHandleClasses",
"member": "Ext.dd.DragDrop",
"type": "Array",
"doc": "<p>An Array of CSS class names for elements to be considered in valid as drag handles.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 133,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-invalidHandleClasses"
},
{
"tagname": "property",
"name": "invalidHandleIds",
"member": "Ext.dd.DragDrop",
"type": "Object",
"doc": "<p>An object who's property names identify the IDs of elements to be considered invalid as drag handles.\nA non-null property value identifies the ID as invalid. For example, to prevent\ndragging from being initiated on element ID \"foo\", use:</p>\n\n<pre><code>{\n foo: true\n}</code></pre>\n\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 121,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-invalidHandleIds",
"shortDoc": "An object who's property names identify the IDs of elements to be considered invalid as drag handles.\nA non-null prop..."
},
{
"tagname": "property",
"name": "invalidHandleTypes",
"member": "Ext.dd.DragDrop",
"type": "Object",
"doc": "<p>An object who's property names identify HTML tags to be considered invalid as drag handles.\nA non-null property value identifies the tag as invalid. Defaults to the\nfollowing value which prevents drag operations from being initiated by <a> elements:</p>\n\n<pre><code>{\n A: \"A\"\n}</code></pre>\n\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 109,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-invalidHandleTypes",
"shortDoc": "An object who's property names identify HTML tags to be considered invalid as drag handles.\nA non-null property value..."
},
{
"tagname": "property",
"name": "isTarget",
"member": "Ext.dd.DragDrop",
"type": "boolean",
"doc": "<p>By default, all instances can be a drop target. This can be disabled by\nsetting isTarget to false.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 201,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-isTarget"
},
{
"tagname": "property",
"name": "maintainOffset",
"member": "Ext.dd.DragDrop",
"type": "boolean",
"doc": "<p>Maintain offsets when we resetconstraints. Set to true when you want\nthe position of the element relative to its parent to stay the same\nwhen the page changes</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 279,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-maintainOffset",
"shortDoc": "Maintain offsets when we resetconstraints. Set to true when you want\nthe position of the element relative to its par..."
},
{
"tagname": "property",
"name": "moveOnly",
"member": "Ext.dd.DragDrop",
"type": "boolean",
"doc": "<p>When set to true, other DD objects in cooperating DDGroups do not receive\nnotification events when this DD object is dragged over them. Defaults to false.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 185,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-moveOnly",
"shortDoc": "When set to true, other DD objects in cooperating DDGroups do not receive\nnotification events when this DD object is ..."
},
{
"tagname": "property",
"name": "padding",
"member": "Ext.dd.DragDrop",
"type": "[int]",
"doc": "<p>The padding configured for this drag and drop object for calculating\nthe drop zone intersection with this object.\nAn array containing the 4 padding values: [top, right, bottom, left]</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 209,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-padding",
"shortDoc": "The padding configured for this drag and drop object for calculating\nthe drop zone intersection with this object.\nAn ..."
},
{
"tagname": "property",
"name": "primaryButtonOnly",
"member": "Ext.dd.DragDrop",
"type": "boolean",
"doc": "<p>By default the drag and drop instance will only respond to the primary\nbutton click (left button for a right-handed mouse). Set to true to\nallow drag and drop to start with any mouse click that is propogated\nby the browser</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 305,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-primaryButtonOnly",
"shortDoc": "By default the drag and drop instance will only respond to the primary\nbutton click (left button for a right-handed m..."
},
{
"tagname": "property",
"name": "xTicks",
"member": "Ext.dd.DragDrop",
"type": "[int]",
"doc": "<p>Array of pixel locations the element will snap to if we specified a\nhorizontal graduation/interval. This array is generated automatically\nwhen you define a tick interval.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 289,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-xTicks",
"shortDoc": "Array of pixel locations the element will snap to if we specified a\nhorizontal graduation/interval. This array is ge..."
},
{
"tagname": "property",
"name": "yTicks",
"member": "Ext.dd.DragDrop",
"type": "[int]",
"doc": "<p>Array of pixel locations the element will snap to if we specified a\nvertical graduation/interval. This array is generated automatically\nwhen you define a tick interval.</p>\n",
"private": false,
"static": false,
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DragDrop.js",
"linenr": 297,
"html_filename": "DragDrop.html",
"href": "DragDrop.html#Ext-dd-DragDrop-property-yTicks",
"shortDoc": "Array of pixel locations the element will snap to if we specified a\nvertical graduation/interval. This array is gene..."
}
],
"event": [
],
"filename": "/Users/nick/Projects/sencha/SDK/extjs/src/dd/DropTarget.js",
"linenr": 1,
"html_filename": "DropTarget.html",
"href": "DropTarget.html#Ext-dd-DropTarget",
"cssVar": [
],
"cssMixin": [
],
"component": false,
"superclasses": [
"Ext.dd.DragDrop",
"Ext.dd.DDTarget"
],
"subclasses": [
"Ext.dd.DropZone"
],
"mixedInto": [
],
"allMixins": [
]
}); | {
"content_hash": "efe38874cae3f2ffbefe7093d740d36c",
"timestamp": "",
"source": "github",
"line_count": 1595,
"max_line_length": 705,
"avg_line_length": 37.91034482758621,
"alnum_prop": 0.5626540096250847,
"repo_name": "flyboarder/AirOS_pre2.0",
"id": "d3e3c274da1fa2a33a7790899d881c6d33993230",
"size": "60467",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "web/extjs/4.0.1/docs/output/Ext.dd.DropTarget.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "25909154"
},
{
"name": "PHP",
"bytes": "98458"
},
{
"name": "Python",
"bytes": "1965"
},
{
"name": "Ruby",
"bytes": "7793"
},
{
"name": "Shell",
"bytes": "9078"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>quickchick: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.12.0 / quickchick - 1.0.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
quickchick
<small>
1.0.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-09-13 14:50:05 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-09-13 14:50:05 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.12.0 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.10.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.2 Official release 4.10.2
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
version: "1.0.0"
maintainer: "[email protected]"
homepage: "https://github.com/QuickChick/QuickChick"
dev-repo: "git+https://github.com/QuickChick/QuickChick.git"
bug-reports: "https://github.com/QuickChick/QuickChick/issues"
license: "MIT"
build: [ make "-j%{jobs}%" ]
install: [ make "install" ]
depends: [
"ocaml" {>= "4.04.0"}
"coq" {>= "8.7" < "8.8~"}
"coq-ext-lib"
"coq-mathcomp-ssreflect" {>= "1.6" & < "1.7~"}
]
authors: [
"Leonidas Lampropoulos <>"
"Zoe Paraskevopoulou <>"
"Maxime Denes <>"
"Catalin Hritcu <>"
"Benjamin Pierce <>"
"Arthur Azevedo de Amorim <>"
"Antal Spector-Zabusky <>"
"Li-Yao Xia <>"
"Yishuai Li <>"
]
synopsis: "QuickChick is a random property-based testing library for Coq"
tags: [
"keyword:extraction"
"category:Miscellaneous/Coq Extensions"
"logpath:QuickChick"
]
url {
src: "https://github.com/QuickChick/QuickChick/archive/v1.0.0.tar.gz"
checksum: "md5=f64997cb57e609cb0a9b0c4605891311"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-quickchick.1.0.0 coq.8.12.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.12.0).
The following dependencies couldn't be met:
- coq-quickchick -> coq < 8.8~ -> ocaml < 4.10
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-quickchick.1.0.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "837a988d8062a197a69cfc033da88caa",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 159,
"avg_line_length": 39.81609195402299,
"alnum_prop": 0.5379618937644342,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "6a29bac772c1e4e304cbc394f583971f458d5420",
"size": "6953",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.10.2-2.0.6/released/8.12.0/quickchick/1.0.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.ComponentModel;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Messaging.ServiceBus.Amqp;
using Azure.Messaging.ServiceBus.Authorization;
using Azure.Messaging.ServiceBus.Core;
namespace Azure.Messaging.ServiceBus
{
/// <summary>
/// A connection to the Azure Service Bus service, enabling client communications with a specific
/// Service Bus entity instance within an Service Bus namespace. A single connection may be
/// shared among multiple Service Bus entity senders and/or receivers, or may be used as a
/// dedicated connection for a single sender or receiver client.
/// </summary>
internal class ServiceBusConnection : IAsyncDisposable
{
/// <summary>
/// The fully qualified Service Bus namespace that the connection is associated with.
/// This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.
/// </summary>
public string FullyQualifiedNamespace { get; }
/// <summary>
/// Indicates whether or not this <see cref="ServiceBusConnection"/> has been closed.
/// </summary>
///
/// <value>
/// <c>true</c> if the connection is closed; otherwise, <c>false</c>.
/// </value>
public bool IsClosed => _innerClient.IsClosed;
/// <summary>
/// The entity path that the connection is bound to.
/// </summary>
public string EntityPath { get; }
/// <summary>
/// The endpoint for the Service Bus service to which the connection is associated.
/// This is essentially the <see cref="FullyQualifiedNamespace"/> but with
/// the scheme included.
/// </summary>
internal Uri ServiceEndpoint => _innerClient.ServiceEndpoint;
/// <summary>
/// The transport type used for this connection.
/// </summary>
public ServiceBusTransportType TransportType { get; }
/// <summary>
/// The retry options associated with this connection.
/// </summary>
public virtual ServiceBusRetryOptions RetryOptions { get; }
private readonly TransportClient _innerClient;
/// <summary>
/// The set of client options used for creation of client.
/// </summary>
///
internal ServiceBusClientOptions Options { get; set; }
/// <summary>
/// Parameterless constructor to allow mocking.
/// </summary>
internal ServiceBusConnection() { }
/// <summary>
/// Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
/// </summary>
///
/// <param name="connectionString">The connection string to use for connecting to the Service Bus namespace.</param>
/// <param name="options">A set of options to apply when configuring the connection.</param>
///
/// <remarks>
/// If the connection string is copied from the Service Bus entity itself, it will contain the name of the desired Service Bus entity,
/// and can be used directly without passing the name="entityName" />. The name of the Service Bus entity should be
/// passed only once, either as part of the connection string or separately.
/// </remarks>
///
internal ServiceBusConnection(
string connectionString,
ServiceBusClientOptions options)
{
Argument.AssertNotNullOrEmpty(connectionString, nameof(connectionString));
options = options?.Clone() ?? new ServiceBusClientOptions();
ValidateConnectionOptions(options);
ConnectionStringProperties connectionStringProperties = ConnectionStringParser.Parse(connectionString);
if (string.IsNullOrEmpty(connectionStringProperties.Endpoint?.Host)
|| string.IsNullOrEmpty(connectionStringProperties.SharedAccessKeyName)
|| string.IsNullOrEmpty(connectionStringProperties.SharedAccessKey))
{
throw new ArgumentException(Resources.MissingConnectionInformation, nameof(connectionString));
}
FullyQualifiedNamespace = connectionStringProperties.Endpoint.Host;
TransportType = options.TransportType;
EntityPath = connectionStringProperties.EntityPath;
Options = options;
RetryOptions = options.RetryOptions;
var sharedAccessSignature = new SharedAccessSignature
(
BuildAudienceResource(options.TransportType, FullyQualifiedNamespace, EntityPath),
connectionStringProperties.SharedAccessKeyName,
connectionStringProperties.SharedAccessKey
);
var sharedCredential = new SharedAccessSignatureCredential(sharedAccessSignature);
var tokenCredential = new ServiceBusTokenCredential(
sharedCredential,
BuildAudienceResource(TransportType, FullyQualifiedNamespace, EntityPath));
_innerClient = CreateTransportClient(tokenCredential, options);
}
/// <summary>
/// Initializes a new instance of the <see cref="ServiceBusConnection"/> class.
/// </summary>
///
/// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace to connect to. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
/// <param name="credential">The Azure managed identity credential to use for authorization. Access controls may be specified by the Service Bus namespace or the requested Service Bus entity, depending on Azure configuration.</param>
/// <param name="options">A set of options to apply when configuring the connection.</param>
internal ServiceBusConnection(
string fullyQualifiedNamespace,
TokenCredential credential,
ServiceBusClientOptions options)
{
Argument.AssertWellFormedServiceBusNamespace(fullyQualifiedNamespace, nameof(fullyQualifiedNamespace));
Argument.AssertNotNull(credential, nameof(credential));
options = options?.Clone() ?? new ServiceBusClientOptions();
ValidateConnectionOptions(options);
switch (credential)
{
case SharedAccessSignatureCredential _:
break;
case ServiceBusSharedKeyCredential sharedKeyCredential:
credential = sharedKeyCredential.AsSharedAccessSignatureCredential(BuildAudienceResource(options.TransportType, fullyQualifiedNamespace, EntityPath));
break;
}
var tokenCredential = new ServiceBusTokenCredential(credential, BuildAudienceResource(options.TransportType, fullyQualifiedNamespace, EntityPath));
FullyQualifiedNamespace = fullyQualifiedNamespace;
TransportType = options.TransportType;
Options = options;
RetryOptions = options.RetryOptions;
_innerClient = CreateTransportClient(tokenCredential, options);
}
/// <summary>
/// Closes the connection to the Service Bus namespace and associated Service Bus entity.
/// </summary>
///
/// <param name="cancellationToken">An optional <see cref="CancellationToken"/> instance to signal the request to cancel the operation.</param>
///
/// <returns>A task to be resolved on when the operation has completed.</returns>
///
public virtual async Task CloseAsync(CancellationToken cancellationToken = default) =>
await _innerClient.CloseAsync(cancellationToken).ConfigureAwait(false);
/// <summary>
/// Performs the task needed to clean up resources used by the <see cref="ServiceBusConnection" />,
/// including ensuring that the connection itself has been closed.
/// </summary>
///
/// <returns>A task to be resolved on when the operation has completed.</returns>
///
public virtual async ValueTask DisposeAsync() => await CloseAsync().ConfigureAwait(false);
/// <summary>
/// Determines whether the specified <see cref="System.Object" /> is equal to this instance.
/// </summary>
///
/// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
///
/// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
///
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj) => base.Equals(obj);
/// <summary>
/// Returns a hash code for this instance.
/// </summary>
///
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
///
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => base.GetHashCode();
/// <summary>
/// Converts the instance to string representation.
/// </summary>
///
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
///
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString() => base.ToString();
internal virtual TransportSender CreateTransportSender(
string entityPath,
string viaEntityPath,
ServiceBusRetryPolicy retryPolicy,
string identifier) =>
_innerClient.CreateSender(entityPath, viaEntityPath, retryPolicy, identifier);
internal virtual TransportReceiver CreateTransportReceiver(
string entityPath,
ServiceBusRetryPolicy retryPolicy,
ReceiveMode receiveMode,
uint prefetchCount,
string identifier,
string sessionId = default,
bool isSessionReceiver = default) =>
_innerClient.CreateReceiver(
entityPath,
retryPolicy,
receiveMode,
prefetchCount,
identifier,
sessionId,
isSessionReceiver);
internal virtual TransportRuleManager CreateTransportRuleManager(
string subscriptionPath,
ServiceBusRetryPolicy retryPolicy,
string identifier) =>
_innerClient.CreateRuleManager(subscriptionPath, retryPolicy, identifier);
/// <summary>
/// Builds a Service Bus client specific to the protocol and transport specified by the
/// requested connection type of the <see cref="ServiceBusClientOptions"/>.
/// </summary>
///
/// <param name="credential">The Azure managed identity credential to use for authorization.</param>
/// <param name="options"></param>
///
/// <returns>A client generalization specific to the specified protocol/transport to which operations may be delegated.</returns>
///
/// <remarks>
/// As an internal method, only basic sanity checks are performed against arguments. It is
/// assumed that callers are trusted and have performed deep validation.
///
/// Parameters passed are also assumed to be owned by thee transport client and safe to mutate or dispose;
/// creation of clones or otherwise protecting the parameters is assumed to be the purview of the caller.
/// </remarks>
///
internal virtual TransportClient CreateTransportClient(
ServiceBusTokenCredential credential,
ServiceBusClientOptions options)
{
switch (TransportType)
{
case ServiceBusTransportType.AmqpTcp:
case ServiceBusTransportType.AmqpWebSockets:
return new AmqpClient(FullyQualifiedNamespace, credential, options);
default:
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidTransportType, options.TransportType.ToString()), nameof(options.TransportType));
}
}
/// <summary>
/// Builds the audience for use in the signature.
/// </summary>
///
/// <param name="transportType">The type of protocol and transport that will be used for communicating with the Service Bus service.</param>
/// <param name="fullyQualifiedNamespace">The fully qualified Service Bus namespace. This is likely to be similar to <c>{yournamespace}.servicebus.windows.net</c>.</param>
/// <param name="entityName">The name of the specific entity to connect the client to.</param>
///
/// <returns>The value to use as the audience of the signature.</returns>
///
private static string BuildAudienceResource(
ServiceBusTransportType transportType,
string fullyQualifiedNamespace,
string entityName)
{
var builder = new UriBuilder(fullyQualifiedNamespace)
{
Scheme = transportType.GetUriScheme(),
Path = entityName,
Port = -1,
Fragment = string.Empty,
Password = string.Empty,
UserName = string.Empty,
};
if (builder.Path.EndsWith("/"))
{
builder.Path = builder.Path.TrimEnd('/');
}
return builder.Uri.AbsoluteUri.ToLowerInvariant();
}
/// <summary>
/// Performs the actions needed to validate the <see cref="ServiceBusClientOptions" /> associated
/// with this client.
/// </summary>
///
/// <param name="connectionOptions">The set of options to validate.</param>
///
/// <remarks>
/// In the case that the options violate an invariant or otherwise represent a combination that
/// is not permissible, an appropriate exception will be thrown.
/// </remarks>
///
private static void ValidateConnectionOptions(ServiceBusClientOptions connectionOptions)
{
// If there were no options passed, they cannot be in an invalid state.
if (connectionOptions == null)
{
return;
}
// A proxy is only valid when web sockets is used as the transport.
if ((!connectionOptions.TransportType.IsWebSocketTransport()) && (connectionOptions.Proxy != null))
{
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.ProxyMustUseWebSockets), nameof(connectionOptions));
}
}
/// <summary>
/// Throw an ObjectDisposedException if the object is Closing.
/// </summary>
internal virtual void ThrowIfClosed()
{
if (IsClosed)
{
throw new ObjectDisposedException($"{nameof(ServiceBusConnection)} has already been closed. Please create a new instance");
}
}
}
}
| {
"content_hash": "ca53b50c8c866b3ef989aa170ea8442c",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 242,
"avg_line_length": 44.84149855907781,
"alnum_prop": 0.6259640102827764,
"repo_name": "hyonholee/azure-sdk-for-net",
"id": "4213508f9eda262883394f00a47c5e178ceb4652",
"size": "15562",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sdk/servicebus/Azure.Messaging.ServiceBus/src/ServiceBusConnection.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "16774"
},
{
"name": "C#",
"bytes": "37415276"
},
{
"name": "HTML",
"bytes": "234899"
},
{
"name": "JavaScript",
"bytes": "7875"
},
{
"name": "PowerShell",
"bytes": "273940"
},
{
"name": "Shell",
"bytes": "13061"
},
{
"name": "Smarty",
"bytes": "11135"
},
{
"name": "TypeScript",
"bytes": "143209"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DSharpPlus.Entities;
using DSharpPlus.EventArgs;
using DSharpPlus.Lavalink.Entities;
using DSharpPlus.Lavalink.EventArgs;
using DSharpPlus.Net;
using DSharpPlus.Net.WebSocket;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace DSharpPlus.Lavalink
{
internal delegate void NodeDisconnectedEventHandler(LavalinkNodeConnection node);
/// <summary>
/// Represents a connection to a Lavalink node.
/// </summary>
public sealed class LavalinkNodeConnection
{
/// <summary>
/// Triggered whenever Lavalink WebSocket throws an exception.
/// </summary>
public event AsyncEventHandler<SocketErrorEventArgs> LavalinkSocketErrored
{
add { this._lavalinkSocketError.Register(value); }
remove { this._lavalinkSocketError.Unregister(value); }
}
private AsyncEvent<SocketErrorEventArgs> _lavalinkSocketError;
/// <summary>
/// Triggered when this node disconnects.
/// </summary>
public event AsyncEventHandler<NodeDisconnectedEventArgs> Disconnected
{
add { this._disconnected.Register(value); }
remove { this._disconnected.Unregister(value); }
}
private AsyncEvent<NodeDisconnectedEventArgs> _disconnected;
/// <summary>
/// Triggered when this node receives a statistics update.
/// </summary>
public event AsyncEventHandler<StatisticsReceivedEventArgs> StatisticsReceived
{
add { this._statsReceived.Register(value); }
remove { this._statsReceived.Unregister(value); }
}
private AsyncEvent<StatisticsReceivedEventArgs> _statsReceived;
/// <summary>
/// Triggered whenever any of the players on this node is updated.
/// </summary>
public event AsyncEventHandler<PlayerUpdateEventArgs> PlayerUpdated
{
add { this._playerUpdated.Register(value); }
remove { this._playerUpdated.Unregister(value); }
}
private AsyncEvent<PlayerUpdateEventArgs> _playerUpdated;
/// <summary>
/// Triggered whenever playback of a track starts.
/// <para>This is only available for version 3.3.1 and greater.</para>
/// </summary>
public event AsyncEventHandler<TrackStartEventArgs> PlaybackStarted
{
add { this._playbackStarted.Register(value); }
remove { this._playbackStarted.Unregister(value); }
}
private AsyncEvent<TrackStartEventArgs> _playbackStarted;
/// <summary>
/// Triggered whenever playback of a track finishes.
/// </summary>
public event AsyncEventHandler<TrackFinishEventArgs> PlaybackFinished
{
add { this._playbackFinished.Register(value); }
remove { this._playbackFinished.Unregister(value); }
}
private AsyncEvent<TrackFinishEventArgs> _playbackFinished;
/// <summary>
/// Triggered whenever playback of a track gets stuck.
/// </summary>
public event AsyncEventHandler<TrackStuckEventArgs> TrackStuck
{
add { this._trackStuck.Register(value); }
remove { this._trackStuck.Unregister(value); }
}
private AsyncEvent<TrackStuckEventArgs> _trackStuck;
/// <summary>
/// Triggered whenever playback of a track encounters an error.
/// </summary>
public event AsyncEventHandler<TrackExceptionEventArgs> TrackException
{
add { this._trackException.Register(value); }
remove { this._trackException.Unregister(value); }
}
private AsyncEvent<TrackExceptionEventArgs> _trackException;
/// <summary>
/// Gets the remote endpoint of this Lavalink node connection.
/// </summary>
public ConnectionEndpoint NodeEndpoint => this.Configuration.SocketEndpoint;
/// <summary>
/// Gets whether the client is connected to Lavalink.
/// </summary>
public bool IsConnected => !Volatile.Read(ref this._isDisposed);
private bool _isDisposed = false;
/// <summary>
/// Gets the current resource usage statistics.
/// </summary>
public LavalinkStatistics Statistics { get; }
/// <summary>
/// Gets a dictionary of Lavalink guild connections for this node.
/// </summary>
public IReadOnlyDictionary<ulong, LavalinkGuildConnection> ConnectedGuilds { get; }
internal ConcurrentDictionary<ulong, LavalinkGuildConnection> _connectedGuilds = new ConcurrentDictionary<ulong, LavalinkGuildConnection>();
/// <summary>
/// Gets the REST client for this Lavalink connection.
/// </summary>
public LavalinkRestClient Rest { get; }
internal DiscordClient Discord { get; }
internal LavalinkConfiguration Configuration { get; }
internal DiscordVoiceRegion Region { get; }
private IWebSocketClient WebSocket { get; set; }
private ConcurrentDictionary<ulong, TaskCompletionSource<VoiceStateUpdateEventArgs>> VoiceStateUpdates { get; }
private ConcurrentDictionary<ulong, TaskCompletionSource<VoiceServerUpdateEventArgs>> VoiceServerUpdates { get; }
internal LavalinkNodeConnection(DiscordClient client, LavalinkConfiguration config)
{
this.Discord = client;
this.Configuration = new LavalinkConfiguration(config);
if (config.Region != null && this.Discord.VoiceRegions.Values.Contains(config.Region))
this.Region = config.Region;
this.ConnectedGuilds = new ReadOnlyConcurrentDictionary<ulong, LavalinkGuildConnection>(this._connectedGuilds);
this.Statistics = new LavalinkStatistics();
this._lavalinkSocketError = new AsyncEvent<SocketErrorEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_SOCKET_ERROR");
this._disconnected = new AsyncEvent<NodeDisconnectedEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_NODE_DISCONNECTED");
this._statsReceived = new AsyncEvent<StatisticsReceivedEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_STATS_RECEIVED");
this._playerUpdated = new AsyncEvent<PlayerUpdateEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_PLAYER_UPDATED");
this._playbackStarted = new AsyncEvent<TrackStartEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_PLAYBACK_STARTED");
this._playbackFinished = new AsyncEvent<TrackFinishEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_PLAYBACK_FINISHED");
this._trackStuck = new AsyncEvent<TrackStuckEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_TRACK_STUCK");
this._trackException = new AsyncEvent<TrackExceptionEventArgs>(this.Discord.EventErrorHandler, "LAVALINK_TRACK_EXCEPTION");
this.VoiceServerUpdates = new ConcurrentDictionary<ulong, TaskCompletionSource<VoiceServerUpdateEventArgs>>();
this.VoiceStateUpdates = new ConcurrentDictionary<ulong, TaskCompletionSource<VoiceStateUpdateEventArgs>>();
this.Discord.VoiceStateUpdated += this.Discord_VoiceStateUpdated;
this.Discord.VoiceServerUpdated += this.Discord_VoiceServerUpdated;
this.Rest = new LavalinkRestClient(this.Configuration, this.Discord);
this.WebSocket = client.Configuration.WebSocketClientFactory(client.Configuration.Proxy);
this.WebSocket.Connected += this.WebSocket_OnConnect;
this.WebSocket.Disconnected += this.WebSocket_OnDisconnect;
this.WebSocket.ExceptionThrown += this.WebSocket_OnException;
this.WebSocket.MessageReceived += this.WebSocket_OnMessage;
Volatile.Write(ref this._isDisposed, false);
}
/// <summary>
/// Establishes a connection to the Lavalink node.
/// </summary>
/// <returns></returns>
internal Task StartAsync()
{
if (this.Discord?.CurrentUser?.Id == null || this.Discord?.ShardCount == null)
throw new InvalidOperationException("This operation requires the Discord client to be fully initialized.");
this.WebSocket.AddDefaultHeader("Authorization", this.Configuration.Password);
this.WebSocket.AddDefaultHeader("Num-Shards", this.Discord.ShardCount.ToString(CultureInfo.InvariantCulture));
this.WebSocket.AddDefaultHeader("User-Id", this.Discord.CurrentUser.Id.ToString(CultureInfo.InvariantCulture));
if (this.Configuration.ResumeKey != null)
this.WebSocket.AddDefaultHeader("Resume-Key", this.Configuration.ResumeKey);
return this.WebSocket.ConnectAsync(new Uri(this.Configuration.SocketEndpoint.ToWebSocketString()));
}
/// <summary>
/// Stops this Lavalink node connection and frees resources.
/// </summary>
/// <returns></returns>
public async Task StopAsync()
{
foreach (var kvp in this._connectedGuilds)
await kvp.Value.DisconnectAsync().ConfigureAwait(false);
this.NodeDisconnected?.Invoke(this);
Volatile.Write(ref this._isDisposed, true);
await this.WebSocket.DisconnectAsync().ConfigureAwait(false);
await this._disconnected.InvokeAsync(new NodeDisconnectedEventArgs(this)).ConfigureAwait(false);
}
/// <summary>
/// Connects this Lavalink node to specified Discord channel.
/// </summary>
/// <param name="channel">Voice channel to connect to.</param>
/// <returns>Channel connection, which allows for playback control.</returns>
public async Task<LavalinkGuildConnection> ConnectAsync(DiscordChannel channel)
{
if (this._connectedGuilds.ContainsKey(channel.Guild.Id))
return this._connectedGuilds[channel.Guild.Id];
if (channel.Guild == null || channel.Type != ChannelType.Voice)
throw new ArgumentException("Invalid channel specified.", nameof(channel));
var vstut = new TaskCompletionSource<VoiceStateUpdateEventArgs>();
var vsrut = new TaskCompletionSource<VoiceServerUpdateEventArgs>();
this.VoiceStateUpdates[channel.Guild.Id] = vstut;
this.VoiceServerUpdates[channel.Guild.Id] = vsrut;
var vsd = new VoiceDispatch
{
OpCode = 4,
Payload = new VoiceStateUpdatePayload
{
GuildId = channel.Guild.Id,
ChannelId = channel.Id,
Deafened = false,
Muted = false
}
};
var vsj = JsonConvert.SerializeObject(vsd, Formatting.None);
await (channel.Discord as DiscordClient).WsSendAsync(vsj).ConfigureAwait(false);
var vstu = await vstut.Task.ConfigureAwait(false);
var vsru = await vsrut.Task.ConfigureAwait(false);
await this.SendPayloadAsync(new LavalinkVoiceUpdate(vstu, vsru)).ConfigureAwait(false);
var con = new LavalinkGuildConnection(this, channel, vstu);
con.ChannelDisconnected += this.Con_ChannelDisconnected;
con.PlayerUpdated += e => this._playerUpdated.InvokeAsync(e);
con.PlaybackStarted += e => this._playbackStarted.InvokeAsync(e);
con.PlaybackFinished += e => this._playbackFinished.InvokeAsync(e);
con.TrackStuck += e => this._trackStuck.InvokeAsync(e);
con.TrackException += e => this._trackException.InvokeAsync(e);
this._connectedGuilds[channel.Guild.Id] = con;
return con;
}
/// <summary>
/// Gets a Lavalink connection to specified Discord channel.
/// </summary>
/// <param name="guild">Guild to get connection for.</param>
/// <returns>Channel connection, which allows for playback control.</returns>
public LavalinkGuildConnection GetGuildConnection(DiscordGuild guild)
=> this._connectedGuilds.TryGetValue(guild.Id, out LavalinkGuildConnection lgc) && lgc.IsConnected ? lgc : null;
internal async Task SendPayloadAsync(LavalinkPayload payload)
=> await this.WsSendAsync(JsonConvert.SerializeObject(payload, Formatting.None)).ConfigureAwait(false);
private async Task WebSocket_OnMessage(SocketMessageEventArgs e)
{
if (!(e is SocketTextMessageEventArgs et))
{
this.Discord.Logger.LogCritical(LavalinkEvents.LavalinkConnectionError, "Lavalink sent binary data - unable to process");
return;
}
this.Discord.Logger.LogTrace(LavalinkEvents.LavalinkWsRx, et.Message);
var json = et.Message;
var jsonData = JObject.Parse(json);
switch (jsonData["op"].ToString())
{
case "playerUpdate":
var gid = (ulong)jsonData["guildId"];
var state = jsonData["state"].ToObject<LavalinkState>();
if (this._connectedGuilds.TryGetValue(gid, out var lvl))
await lvl.InternalUpdatePlayerStateAsync(state).ConfigureAwait(false);
break;
case "stats":
var statsRaw = jsonData.ToObject<LavalinkStats>();
this.Statistics.Update(statsRaw);
await this._statsReceived.InvokeAsync(new StatisticsReceivedEventArgs(this.Statistics)).ConfigureAwait(false);
break;
case "event":
var evtype = jsonData["type"].ToObject<EventType>();
var guildId = (ulong)jsonData["guildId"];
switch (evtype)
{
case EventType.TrackStartEvent:
if (this._connectedGuilds.TryGetValue(guildId, out var lvl_evtst))
await lvl_evtst.InternalPlaybackStartedAsync(jsonData["track"].ToString()).ConfigureAwait(false);
break;
case EventType.TrackEndEvent:
TrackEndReason reason = TrackEndReason.Cleanup;
switch (jsonData["reason"].ToString())
{
case "FINISHED":
reason = TrackEndReason.Finished;
break;
case "LOAD_FAILED":
reason = TrackEndReason.LoadFailed;
break;
case "STOPPED":
reason = TrackEndReason.Stopped;
break;
case "REPLACED":
reason = TrackEndReason.Replaced;
break;
case "CLEANUP":
reason = TrackEndReason.Cleanup;
break;
}
if (this._connectedGuilds.TryGetValue(guildId, out var lvl_evtf))
await lvl_evtf.InternalPlaybackFinishedAsync(new TrackFinishData { Track = jsonData["track"].ToString(), Reason = reason }).ConfigureAwait(false);
break;
case EventType.TrackStuckEvent:
if (this._connectedGuilds.TryGetValue(guildId, out var lvl_evts))
await lvl_evts.InternalTrackStuckAsync(new TrackStuckData { Track = jsonData["track"].ToString(), Threshold = (long)jsonData["thresholdMs"] }).ConfigureAwait(false);
break;
case EventType.TrackExceptionEvent:
if (this._connectedGuilds.TryGetValue(guildId, out var lvl_evte))
await lvl_evte.InternalTrackExceptionAsync(new TrackExceptionData { Track = jsonData["track"].ToString(), Error = jsonData["error"].ToString() }).ConfigureAwait(false);
break;
case EventType.WebSocketClosedEvent:
if (this._connectedGuilds.TryGetValue(guildId, out var lvl_ewsce))
{
lvl_ewsce.VoiceWsDisconnectTcs.SetResult(true);
await lvl_ewsce.InternalWebSocketClosedAsync(new WebSocketCloseEventArgs(jsonData["code"].ToObject<int>(), jsonData["reason"].ToString(), jsonData["byRemote"].ToObject<bool>())).ConfigureAwait(false);
}
break;
}
break;
}
}
private Task WebSocket_OnException(SocketErrorEventArgs e)
=> this._lavalinkSocketError.InvokeAsync(new SocketErrorEventArgs(this.Discord) { Exception = e.Exception });
private async Task WebSocket_OnDisconnect(SocketCloseEventArgs e)
{
if (this.IsConnected && e.CloseCode != 1001 && e.CloseCode != -1)
{
this.Discord.Logger.LogWarning(LavalinkEvents.LavalinkConnectionClosed, "Connection broken ({0}, '{1}'), reconnecting", e.CloseCode, e.CloseMessage);
this.WebSocket = this.Discord.Configuration.WebSocketClientFactory(this.Discord.Configuration.Proxy);
this.WebSocket.Connected += this.WebSocket_OnConnect;
this.WebSocket.Disconnected += this.WebSocket_OnDisconnect;
this.WebSocket.ExceptionThrown += this.WebSocket_OnException;
this.WebSocket.MessageReceived += this.WebSocket_OnMessage;
this.WebSocket.AddDefaultHeader("Authorization", this.Configuration.Password);
this.WebSocket.AddDefaultHeader("Num-Shards", this.Discord.ShardCount.ToString(CultureInfo.InvariantCulture));
this.WebSocket.AddDefaultHeader("User-Id", this.Discord.CurrentUser.Id.ToString(CultureInfo.InvariantCulture));
if (this.Configuration.ResumeKey != null)
this.WebSocket.AddDefaultHeader("Resume-Key", this.Configuration.ResumeKey);
await this.WebSocket.ConnectAsync(new Uri(this.Configuration.SocketEndpoint.ToWebSocketString()));
}
else if (e.CloseCode != 1001 && e.CloseCode != -1)
{
this.Discord.Logger.LogInformation(LavalinkEvents.LavalinkConnectionClosed, "Connection closed ({0}, '{1}')", e.CloseCode, e.CloseMessage);
this.NodeDisconnected?.Invoke(this);
await this._disconnected.InvokeAsync(new NodeDisconnectedEventArgs(this)).ConfigureAwait(false);
}
else
{
Volatile.Write(ref this._isDisposed, true);
this.Discord.Logger.LogWarning(LavalinkEvents.LavalinkConnectionClosed, "Lavalink died");
foreach (var kvp in this._connectedGuilds)
{
await kvp.Value.SendVoiceUpdateAsync().ConfigureAwait(false);
_ = this._connectedGuilds.TryRemove(kvp.Key, out _);
}
this.NodeDisconnected?.Invoke(this);
await this._disconnected.InvokeAsync(new NodeDisconnectedEventArgs(this)).ConfigureAwait(false);
}
}
private async Task WebSocket_OnConnect()
{
this.Discord.Logger.LogDebug(LavalinkEvents.LavalinkConnected, "Connection to Lavalink node established");
if (this.Configuration.ResumeKey != null)
await this.SendPayloadAsync(new LavalinkConfigureResume(this.Configuration.ResumeKey, this.Configuration.ResumeTimeout)).ConfigureAwait(false);
}
private void Con_ChannelDisconnected(LavalinkGuildConnection con)
=> this._connectedGuilds.TryRemove(con.GuildId, out _);
private Task Discord_VoiceStateUpdated(VoiceStateUpdateEventArgs e)
{
var gld = e.Guild;
if (gld == null)
return Task.CompletedTask;
if (e.User == null)
return Task.CompletedTask;
if (e.User.Id == this.Discord.CurrentUser.Id)
{
if (this._connectedGuilds.TryGetValue(e.Guild.Id, out var lvlgc))
lvlgc.VoiceStateUpdate = e;
if (e.After.Channel == null && this.IsConnected && this._connectedGuilds.ContainsKey(gld.Id))
{
_ = Task.Run(async () =>
{
var delayTask = Task.Delay(this.Configuration.WebSocketCloseTimeout);
var tcs = lvlgc.VoiceWsDisconnectTcs.Task;
_ = await Task.WhenAny(delayTask, tcs).ConfigureAwait(false);
await lvlgc.DisconnectInternalAsync(false, true).ConfigureAwait(false);
_ = this._connectedGuilds.TryRemove(gld.Id, out _);
});
}
if (!string.IsNullOrWhiteSpace(e.SessionId) && e.Channel != null && this.VoiceStateUpdates.TryRemove(gld.Id, out var xe))
xe.SetResult(e);
}
return Task.CompletedTask;
}
private Task Discord_VoiceServerUpdated(VoiceServerUpdateEventArgs e)
{
var gld = e.Guild;
if (gld == null)
return Task.CompletedTask;
if (this._connectedGuilds.TryGetValue(e.Guild.Id, out var lvlgc))
{
var lvlp = new LavalinkVoiceUpdate(lvlgc.VoiceStateUpdate, e);
_ = Task.Run(() => this.WsSendAsync(JsonConvert.SerializeObject(lvlp)));
}
if (this.VoiceServerUpdates.TryRemove(gld.Id, out var xe))
xe.SetResult(e);
return Task.CompletedTask;
}
private async Task WsSendAsync(string payload)
{
this.Discord.Logger.LogTrace(LavalinkEvents.LavalinkWsTx, payload);
await this.WebSocket.SendMessageAsync(payload).ConfigureAwait(false);
}
internal event NodeDisconnectedEventHandler NodeDisconnected;
}
}
// Kinda think this deserves another pack of instant noodles :^) -Emzi
// No I did it before in sai- alright then.
| {
"content_hash": "81df252e308f9d382a8decb146890302",
"timestamp": "",
"source": "github",
"line_count": 471,
"max_line_length": 232,
"avg_line_length": 48.56687898089172,
"alnum_prop": 0.6107103825136612,
"repo_name": "Emzi0767/DSharpPlus",
"id": "4c28e4a1a06ac2d7eb30d3d6d0ccfbf8dac79e91",
"size": "22877",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DSharpPlus.Lavalink/LavalinkNodeConnection.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1940789"
},
{
"name": "PowerShell",
"bytes": "20914"
}
],
"symlink_target": ""
} |
{{ repo_name }} Documentation
=============================
Please put a description here, followed by sections for configuration, basic usage, and code documentation.
Installation
------------
To install the latest release, type::
pip install {{ pypi_name }}
To install the latest code directly from source, type::
pip install git+git://github.com/ambitioninc/{{ repo_name }}.git
| {
"content_hash": "f26c210c6773646fa255de504a94b62c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 107,
"avg_line_length": 28.142857142857142,
"alnum_prop": 0.6598984771573604,
"repo_name": "ambitioninc/ambition-python-template",
"id": "f8bbaef1d48abd6def4fb4e3c0870af0d9183d7a",
"size": "394",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/index.rst",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "8469"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.startapplabs.ion2FullApp.elite" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>กรีนวินเทจ</name>
<description>The Best Ionic 2 Starter app - ELITE version</description>
<author email="[email protected]" href="https://ionicthemes.com/">Ionic Themes</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="loadUrlTimeoutValue" value="700000" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="android-targetSdkVersion" value="25" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="TwitterConsumerKey" value="lxYOizP79U8rU9lVT0nLQax8h" />
<preference name="TwitterConsumerSecret" value="y4ngeuCuwjp5tIziYMdkyWCarz0lZ0HGoDpXuq8qVIYemzABdl" />
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/[email protected]" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/[email protected]" width="80" />
<icon height="120" src="resources/ios/icon/[email protected]" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/[email protected]" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/[email protected]" width="120" />
<icon height="180" src="resources/ios/icon/[email protected]" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/[email protected]" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/[email protected]" width="152" />
<icon height="167" src="resources/ios/icon/[email protected]" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/[email protected]" width="58" />
<icon height="87" src="resources/ios/icon/[email protected]" width="87" />
<splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
</platform>
<engine name="android" spec="^6.2.3" />
<engine name="ios" spec="^4.4.0" />
<plugin name="com.synconset.imagepicker" spec="https://github.com/ionicthemes/ImagePicker.git">
<variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value=" " />
</plugin>
<plugin name="cordova-plugin-admob-free" spec="^0.9.0" />
<plugin name="cordova-plugin-apprate" spec="^1.3.0" />
<plugin name="cordova-plugin-console" spec="^1.0.7" />
<plugin name="cordova-plugin-crop" spec="^0.3.1" />
<plugin name="cordova-plugin-device" spec="^1.1.6" />
<plugin name="cordova-plugin-email-composer" spec="^0.8.7" />
<plugin name="cordova-plugin-facebook4" spec="^1.9.1">
<variable name="APP_ID" value="826720427470540" />
<variable name="APP_NAME" value="Ion2FullApp" />
</plugin>
<plugin name="cordova-plugin-geolocation" spec="^2.4.3">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value=" " />
</plugin>
<plugin name="cordova-plugin-googleplus" spec="^5.1.1">
<variable name="REVERSED_CLIENT_ID" value="com.googleusercontent.apps.1092390853283-icg6lqtcg6k270de9c8tv3i7qehlqtor" />
</plugin>
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-nativestorage" spec="^2.2.2" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.1.8" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="twitter-connect-plugin" spec="^0.6.0">
<variable name="FABRIC_KEY" value="6da298eb1112d28ba03183d50236498db4b7380e" />
</plugin>
</widget>
| {
"content_hash": "c764a68666b7e7644f8d006f0a6b80c8",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 146,
"avg_line_length": 69.20175438596492,
"alnum_prop": 0.6658638610723793,
"repo_name": "nicknameismos/g-vintage",
"id": "38550b72adaedbb73db250c071b71462ce7a90e5",
"size": "7909",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "72401"
},
{
"name": "HTML",
"bytes": "75312"
},
{
"name": "JavaScript",
"bytes": "3421"
},
{
"name": "TypeScript",
"bytes": "70568"
}
],
"symlink_target": ""
} |
"""
@author: maryam
"""
import SIFpreprocessing_test
import SentenceExtraction_test
from itertools import izip
def main(lang, NER, TextTest, word2vec_Dictionary, loaded_model):
#### test
# lang = 'en'
# TextTest = '''105 words 4 July 2014 03:44 All Africa AFNWS English Mogadishu, Jul 04, 2014 (Tunis Afrique Presse/All Africa Global Media via COMTEX) -- A member of the Somali Federal Parliament has been shot dead by unknown gunmen on Thursday morning in Mogadishu, officials said. Ahmed Mohamud Hayd was killed in a drive-by shooting after he left his hotel in a heavily policed area, witnesses said. His bodyguard was also killed and a parliamentary secretary wounded in the shooting. Al-Shabab spokesman Abdulaziz Abu Musab said the group had carried out the "targeted assassination". At least five members of the Parliament have been shot since the beginning of the year. '''
# NER = 'Mitie' #Stanford or Mitie or other
SentenceListTest, LocTest = SentenceExtraction_test.main(TextTest, NER, lang)
embTest = SIFpreprocessing_test.main(0.01, lang, TextTest, word2vec_Dictionary)
predictedResult = loaded_model.predict(embTest)
locDic = dict()
resDic = dict()
for res, loc in izip(predictedResult, LocTest):
loc = loc.lower().strip()
if res==1:
if loc not in resDic:
resDic[loc] = 0
resDic[loc] +=1
if loc not in locDic:
locDic[loc] = 0
locDic[loc] +=1
if resDic:
sorted_loc = sorted(resDic, key=resDic.__getitem__, reverse=True)
else:
sorted_loc = sorted(locDic, key=locDic.__getitem__, reverse=True)
return sorted_loc[0]
| {
"content_hash": "8f30f34d585a69bbb66cbdc7a718f3b3",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 684,
"avg_line_length": 44,
"alnum_prop": 0.6789044289044289,
"repo_name": "openeventdata/Focus_Locality_Extraction",
"id": "79631506adccf47e6f36ae972c462af2ea2fa1d9",
"size": "1763",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Focus_Locality/Sentence_Embedding_Approach/Testing/Profile.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "64206"
},
{
"name": "C++",
"bytes": "66575"
},
{
"name": "HTML",
"bytes": "78969"
},
{
"name": "Makefile",
"bytes": "2004"
},
{
"name": "Matlab",
"bytes": "777"
},
{
"name": "Python",
"bytes": "139098"
}
],
"symlink_target": ""
} |
import { Mixin, computed } from '@ember/-internals/metal';
import type { RouteArgs } from '@ember/-internals/routing/lib/utils';
import { ActionHandler } from '@ember/-internals/runtime';
import { symbol } from '@ember/-internals/utils';
import type Route from '@ember/routing/route';
import type { Transition } from 'router_js';
export type ControllerQueryParamType = 'boolean' | 'number' | 'array' | 'string';
export type ControllerQueryParam = string | Record<string, { type: ControllerQueryParamType }>;
const MODEL = symbol('MODEL');
/**
@module ember
*/
/**
@class ControllerMixin
@namespace Ember
@uses Ember.ActionHandler
@private
*/
interface ControllerMixin<T> extends ActionHandler {
/** @internal */
_qpDelegate: unknown | null;
isController: true;
target: unknown | null;
model: T;
// From routing/lib/ext/controller
queryParams: Array<ControllerQueryParam>;
transitionToRoute(...args: RouteArgs<Route>): Transition;
replaceRoute(...args: RouteArgs<Route>): Transition;
}
const ControllerMixin = Mixin.create(ActionHandler, {
/* ducktype as a controller */
isController: true,
/**
The object to which actions from the view should be sent.
For example, when a Handlebars template uses the `{{action}}` helper,
it will attempt to send the action to the view's controller's `target`.
By default, the value of the target property is set to the router, and
is injected when a controller is instantiated. This injection is applied
as part of the application's initialization process. In most cases the
`target` property will automatically be set to the logical consumer of
actions for the controller.
@property target
@default null
@public
*/
target: null,
store: null,
/**
The controller's current model. When retrieving or modifying a controller's
model, this property should be used instead of the `content` property.
@property model
@public
*/
model: computed({
get() {
return this[MODEL];
},
set(_key, value) {
return (this[MODEL] = value);
},
}),
});
export default ControllerMixin;
| {
"content_hash": "7d8424acf0b02228fe9005f466440177",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 95,
"avg_line_length": 26.51851851851852,
"alnum_prop": 0.6973929236499069,
"repo_name": "tildeio/ember.js",
"id": "06d9d58ceda7d092d510e9949a792a0cafd03dd7",
"size": "2148",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/@ember/controller/lib/controller_mixin.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "7993"
},
{
"name": "Handlebars",
"bytes": "1297"
},
{
"name": "JavaScript",
"bytes": "3076552"
},
{
"name": "TypeScript",
"bytes": "1593024"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ImageMagick: MagickCore, C API for ImageMagick: Dealing with Image Colorspaces</title>
<meta http-equiv="content-language" content="en-US">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="reply-to" content="[email protected]">
<meta name="application-name" content="ImageMagick">
<meta name="description" content="ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.">
<meta name="application-url" content="http://www.imagemagick.org">
<meta name="generator" content="PHP">
<meta name="keywords" content="magickcore, c, api, for, imagemagick:, dealing, with, image, colorspaces, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert">
<meta name="rating" content="GENERAL">
<meta name="robots" content="INDEX, FOLLOW">
<meta name="generator" content="ImageMagick Studio LLC">
<meta name="author" content="ImageMagick Studio LLC">
<meta name="revisit-after" content="2 DAYS">
<meta name="resource-type" content="document">
<meta name="copyright" content="Copyright (c) 1999-2015 ImageMagick Studio LLC">
<meta name="distribution" content="Global">
<meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1">
<link rel="icon" href="../images/wand.png">
<link rel="shortcut icon" href="../images/wand.ico" type="images/x-icon">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<link rel="stylesheet" href="../css/magick.css">
</head>
<body>
<div class="main">
<div class="magick-masthead">
<div class="container">
<script type="text/javascript">
<!--
google_ad_client = "pub-3129977114552745";
google_ad_slot = "5439289906";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<center><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
<nav class="magick-nav">
<a class="magick-nav-item " href="../index.html">Home</a>
<a class="magick-nav-item " href="../binary-releases.html">Download</a>
<a class="magick-nav-item " href="../command-line-tools.html">Tools</a>
<a class="magick-nav-item " href="../command-line-options.html">Options</a>
<a class="magick-nav-item " href="../resources.html">Resources</a>
<a class="magick-nav-item " href="api.html">Develop</a>
<a class="magick-nav-item " href="http://www.imagemagick.org/script/search.php">Search</a>
<a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a>
</nav>
</div>
</div>
<div class="container">
<div class="magick-header">
<p class="text-center"><a href="colorspace.html#SetImageColorspace">SetImageColorspace</a> • <a href="colorspace.html#TransformImageColorspace">TransformImageColorspace</a></p>
<h2><a href="http://www.imagemagick.org/api/MagickCore/colorspace_8c.html" id="SetImageColorspace">SetImageColorspace</a></h2>
<p>SetImageColorspace() sets the colorspace member of the Image structure.</p>
<p>The format of the SetImageColorspace method is:</p>
<pre class="text">
MagickBooleanType SetImageColorspace(Image *image,
const ColorspaceType colorspace)
</pre>
<p>A description of each parameter follows:</p>
<dd>
</dd>
<dd> </dd>
<dl class="dl-horizontal">
<dt>image</dt>
<dd>the image. </dd>
<dd> </dd>
<dt>colorspace</dt>
<dd>the colorspace. </dd>
<dd> </dd>
</dl>
<h2><a href="http://www.imagemagick.org/api/MagickCore/colorspace_8c.html" id="TransformImageColorspace">TransformImageColorspace</a></h2>
<p>TransformImageColorspace() transforms an image colorspace.</p>
<p>The format of the TransformImageColorspace method is:</p>
<pre class="text">
MagickBooleanType TransformImageColorspace(Image *image,
const ColorspaceType colorspace)
</pre>
<p>A description of each parameter follows:</p>
<dd>
</dd>
<dd> </dd>
<dl class="dl-horizontal">
<dt>image</dt>
<dd>the image. </dd>
<dd> </dd>
<dt>colorspace</dt>
<dd>the colorspace. </dd>
<dd> </dd>
</dl>
</div>
<footer class="magick-footer">
<div class="magick-nav-item pull-left">
<a href="../support.html">Donate</a>
</div>
<p><a href="../sitemap.html">Sitemap</a> •
<a href="../links.html">Related</a> •
<a href="http://www.imagemagick.org/MagickStudio/scripts/MagickStudio.cgi">Image Studio</a> •
<a href="http://jqmagick.imagemagick.org/">JqMagick</a>
</p>
<p><a href="colorspace.html#">Back to top</a> •
<a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> •
<a href="http://www.imagemagick.org/script/contact.php">Contact Us</a></p>
<p><small>© 1999-2015 ImageMagick Studio LLC</small></p>
</footer>
</div><!-- /.container -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
(function() {
var s = document.createElement('offline-script'), t = document.getElementsByTagName('offline-script')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */
</script>
</div>
</body>
</html>
| {
"content_hash": "a4cd0cf911aaae1d41f8b86d981524cc",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 452,
"avg_line_length": 40.006802721088434,
"alnum_prop": 0.681346709743241,
"repo_name": "Fakvarl/ImagePocketNodeJs",
"id": "06012d533d842ec20bcfd51c4aab546f08dbf5e5",
"size": "5896",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "www/api/colorspace.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "15524"
},
{
"name": "CSS",
"bytes": "34066"
},
{
"name": "HTML",
"bytes": "4017821"
},
{
"name": "JavaScript",
"bytes": "43680"
},
{
"name": "Perl",
"bytes": "10719"
}
],
"symlink_target": ""
} |
#include "common/stats/allocator_impl.h"
#include <cstdint>
#include "envoy/stats/stats.h"
#include "envoy/stats/symbol_table.h"
#include "common/common/hash.h"
#include "common/common/lock_guard.h"
#include "common/common/logger.h"
#include "common/common/thread.h"
#include "common/common/thread_annotations.h"
#include "common/common/utility.h"
#include "common/stats/metric_impl.h"
#include "common/stats/stat_merger.h"
#include "common/stats/symbol_table_impl.h"
#include "absl/container/flat_hash_set.h"
namespace Envoy {
namespace Stats {
const char AllocatorImpl::DecrementToZeroSyncPoint[] = "decrement-zero";
AllocatorImpl::~AllocatorImpl() {
ASSERT(counters_.empty());
ASSERT(gauges_.empty());
}
#ifndef ENVOY_CONFIG_COVERAGE
void AllocatorImpl::debugPrint() {
Thread::LockGuard lock(mutex_);
for (Counter* counter : counters_) {
ENVOY_LOG_MISC(info, "counter: {}", symbolTable().toString(counter->statName()));
}
for (Gauge* gauge : gauges_) {
ENVOY_LOG_MISC(info, "gauge: {}", symbolTable().toString(gauge->statName()));
}
}
#endif
// Counter and Gauge both inherit from from RefcountInterface and
// Metric. MetricImpl takes care of most of the Metric API, but we need to cover
// symbolTable() here, which we don't store directly, but get it via the alloc,
// which we need in order to clean up the counter and gauge maps in that class
// when they are destroyed.
//
// We implement the RefcountInterface API, using 16 bits that would otherwise be
// wasted in the alignment padding next to flags_.
template <class BaseClass> class StatsSharedImpl : public MetricImpl<BaseClass> {
public:
StatsSharedImpl(StatName name, AllocatorImpl& alloc, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags)
: MetricImpl<BaseClass>(name, tag_extracted_name, stat_name_tags, alloc.symbolTable()),
alloc_(alloc) {}
~StatsSharedImpl() override {
// MetricImpl must be explicitly cleared() before destruction, otherwise it
// will not be able to access the SymbolTable& to free the symbols. An RAII
// alternative would be to store the SymbolTable reference in the
// MetricImpl, costing 8 bytes per stat.
this->clear(symbolTable());
}
// Metric
SymbolTable& symbolTable() override { return alloc_.symbolTable(); }
bool used() const override { return flags_ & Metric::Flags::Used; }
// RefcountInterface
void incRefCount() override { ++ref_count_; }
bool decRefCount() override {
// We must, unfortunately, hold the allocator's lock when decrementing the
// refcount. Otherwise another thread may simultaneously try to allocate the
// same name'd stat after we decrement it, and we'll wind up with a
// dtor/update race. To avoid this we must hold the lock until the stat is
// removed from the map.
//
// It might be worth thinking about a race-free way to decrement ref-counts
// without a lock, for the case where ref_count > 2, and we don't need to
// destruct anything. But it seems preferable at to be conservative here,
// as stats will only go out of scope when a scope is destructed (during
// xDS) or during admin stats operations.
Thread::LockGuard lock(alloc_.mutex_);
ASSERT(ref_count_ >= 1);
if (--ref_count_ == 0) {
alloc_.sync().syncPoint(AllocatorImpl::DecrementToZeroSyncPoint);
removeFromSetLockHeld();
return true;
}
return false;
}
uint32_t use_count() const override { return ref_count_; }
/**
* We must atomically remove the counter/gauges from the allocator's sets when
* our ref-count decrement hits zero. The counters and gauges are held in
* distinct sets so we virtualize this removal helper.
*/
virtual void removeFromSetLockHeld() EXCLUSIVE_LOCKS_REQUIRED(alloc_.mutex_) PURE;
protected:
AllocatorImpl& alloc_;
// Holds backing store shared by both CounterImpl and GaugeImpl. CounterImpl
// adds another field, pending_increment_, that is not used in Gauge.
std::atomic<uint64_t> value_{0};
// ref_count_ can be incremented as an atomic, without taking a new lock, as
// the critical 0->1 transition occurs in makeCounter and makeGauge, which
// already hold the lock. Increment also occurs when copying shared pointers,
// but these are always in transition to ref-count 2 or higher, and thus
// cannot race with a decrement to zero.
//
// However, we must hold alloc_.mutex_ when decrementing ref_count_ so that
// when it hits zero we can atomically remove it from alloc_.counters_ or
// alloc_.gauges_. We leave it atomic to avoid taking the lock on increment.
std::atomic<uint32_t> ref_count_{0};
std::atomic<uint16_t> flags_{0};
};
class CounterImpl : public StatsSharedImpl<Counter> {
public:
CounterImpl(StatName name, AllocatorImpl& alloc, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags)
: StatsSharedImpl(name, alloc, tag_extracted_name, stat_name_tags) {}
void removeFromSetLockHeld() EXCLUSIVE_LOCKS_REQUIRED(alloc_.mutex_) override {
const size_t count = alloc_.counters_.erase(statName());
ASSERT(count == 1);
}
// Stats::Counter
void add(uint64_t amount) override {
// Note that a reader may see a new value but an old pending_increment_ or
// used(). From a system perspective this should be eventually consistent.
value_ += amount;
pending_increment_ += amount;
flags_ |= Flags::Used;
}
void inc() override { add(1); }
uint64_t latch() override { return pending_increment_.exchange(0); }
void reset() override { value_ = 0; }
uint64_t value() const override { return value_; }
private:
std::atomic<uint64_t> pending_increment_{0};
};
class GaugeImpl : public StatsSharedImpl<Gauge> {
public:
GaugeImpl(StatName name, AllocatorImpl& alloc, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags, ImportMode import_mode)
: StatsSharedImpl(name, alloc, tag_extracted_name, stat_name_tags) {
switch (import_mode) {
case ImportMode::Accumulate:
flags_ |= Flags::LogicAccumulate;
break;
case ImportMode::NeverImport:
flags_ |= Flags::NeverImport;
break;
case ImportMode::Uninitialized:
// Note that we don't clear any flag bits for import_mode==Uninitialized,
// as we may have an established import_mode when this stat was created in
// an alternate scope. See
// https://github.com/envoyproxy/envoy/issues/7227.
break;
}
}
void removeFromSetLockHeld() override EXCLUSIVE_LOCKS_REQUIRED(alloc_.mutex_) {
const size_t count = alloc_.gauges_.erase(statName());
ASSERT(count == 1);
}
// Stats::Gauge
void add(uint64_t amount) override {
value_ += amount;
flags_ |= Flags::Used;
}
void dec() override { sub(1); }
void inc() override { add(1); }
void set(uint64_t value) override {
value_ = value;
flags_ |= Flags::Used;
}
void sub(uint64_t amount) override {
ASSERT(value_ >= amount);
ASSERT(used() || amount == 0);
value_ -= amount;
}
uint64_t value() const override { return value_; }
ImportMode importMode() const override {
if (flags_ & Flags::NeverImport) {
return ImportMode::NeverImport;
} else if (flags_ & Flags::LogicAccumulate) {
return ImportMode::Accumulate;
}
return ImportMode::Uninitialized;
}
void mergeImportMode(ImportMode import_mode) override {
ImportMode current = importMode();
if (current == import_mode) {
return;
}
switch (import_mode) {
case ImportMode::Uninitialized:
// mergeImportNode(ImportMode::Uninitialized) is called when merging an
// existing stat with importMode() == Accumulate or NeverImport.
break;
case ImportMode::Accumulate:
ASSERT(current == ImportMode::Uninitialized);
flags_ |= Flags::LogicAccumulate;
break;
case ImportMode::NeverImport:
ASSERT(current == ImportMode::Uninitialized);
// A previous revision of Envoy may have transferred a gauge that it
// thought was Accumulate. But the new version thinks it's NeverImport, so
// we clear the accumulated value.
value_ = 0;
flags_ &= ~Flags::Used;
flags_ |= Flags::NeverImport;
break;
}
}
};
CounterSharedPtr AllocatorImpl::makeCounter(StatName name, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags) {
Thread::LockGuard lock(mutex_);
ASSERT(gauges_.find(name) == gauges_.end());
auto iter = counters_.find(name);
if (iter != counters_.end()) {
return CounterSharedPtr(*iter);
}
auto counter = CounterSharedPtr(new CounterImpl(name, *this, tag_extracted_name, stat_name_tags));
counters_.insert(counter.get());
return counter;
}
GaugeSharedPtr AllocatorImpl::makeGauge(StatName name, StatName tag_extracted_name,
const StatNameTagVector& stat_name_tags,
Gauge::ImportMode import_mode) {
Thread::LockGuard lock(mutex_);
ASSERT(counters_.find(name) == counters_.end());
auto iter = gauges_.find(name);
if (iter != gauges_.end()) {
return GaugeSharedPtr(*iter);
}
auto gauge =
GaugeSharedPtr(new GaugeImpl(name, *this, tag_extracted_name, stat_name_tags, import_mode));
gauges_.insert(gauge.get());
return gauge;
}
bool AllocatorImpl::isMutexLockedForTest() {
bool locked = mutex_.tryLock();
if (locked) {
mutex_.unlock();
}
return !locked;
}
} // namespace Stats
} // namespace Envoy
| {
"content_hash": "8e0d4fe902326d6f9fbe175ecdd8d5bd",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 100,
"avg_line_length": 35.86194029850746,
"alnum_prop": 0.6824471959213402,
"repo_name": "istio/envoy",
"id": "3286aeb7834efe4b08ee05b42c66775948734188",
"size": "9611",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/common/stats/allocator_impl.cc",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "35685"
},
{
"name": "C++",
"bytes": "19486055"
},
{
"name": "Dockerfile",
"bytes": "245"
},
{
"name": "Emacs Lisp",
"bytes": "966"
},
{
"name": "Go",
"bytes": "695"
},
{
"name": "JavaScript",
"bytes": "1760"
},
{
"name": "Makefile",
"bytes": "1985"
},
{
"name": "PowerShell",
"bytes": "6173"
},
{
"name": "PureBasic",
"bytes": "472"
},
{
"name": "Python",
"bytes": "418501"
},
{
"name": "Rust",
"bytes": "3471"
},
{
"name": "Shell",
"bytes": "120251"
},
{
"name": "Starlark",
"bytes": "1184414"
},
{
"name": "Thrift",
"bytes": "748"
}
],
"symlink_target": ""
} |
"""Module that generates the lists.
"""
__authors__ = [
'"Lennard de Rijk" <[email protected]>',
]
import logging
from django.utils import simplejson
from soc.views.template import Template
URL_PATTERN = '<a href="%(url)s"%(target)s%(nofollow)s>%(name)s</a>'
def urlize(url, name=None, target="_blank", nofollow=True):
"""Make an url clickable.
Args:
url: the actual url, such as '/user/list'
name: the display name, such as 'List Users', defaults to url
target: the 'target' attribute of the <a> element
nofollow: whether to add the 'rel="nofollow"' attribute
"""
if not url:
return ''
from django.utils.safestring import mark_safe
from django.utils.html import escape
safe_url = escape(url)
safe_name = escape(name)
link = URL_PATTERN % {
'url': safe_url,
'name': safe_name if name else safe_url,
'target': ' target="%s"' % target if target else '',
'nofollow': ' rel="nofollow"' if nofollow else "",
}
return mark_safe(link)
def getListIndex(request):
"""Returns the index of the requested list.
"""
idx = request.GET.get('idx', '')
idx = int(idx) if idx.isdigit() else -1
return idx
class ListConfiguration(object):
"""Resembles the configuration of a list. This object is sent to the client
on page load.
See the wiki page on ListProtocols for more information
(http://code.google.com/p/soc/wiki/ListsProtocol).
Public fields are:
description: The description as shown to the end user.
row_num: The number of rows that should be shown on a page on default.
row_list: List of integers which is the allowed pagination size a user can
can choose from.
autowidth: Whether the width of the columns should be automatically set.
height: Whether the height of the list should be automatically set.
multiselect: If true then the list will have a column with checkboxes which
allows the user to select a number of rows.
toolbar: [boolean, string] showing if and where the toolbar with buttons
should be present.
"""
def __init__(self, add_key_column=True):
"""Initializes the configuration.
If add_key_column is set will add a 'key' column with the key id/name.
"""
self._col_names = []
self._col_model = []
self._col_functions = {}
self.row_num = 50
self.row_list = [5, 10, 20, 50, 100, 500, 1000]
self.autowidth = True
self._sortname = ''
self._sortorder = 'asc'
self.height = 'auto'
self.multiselect = False
self.toolbar = [True, 'top']
self._buttons = {}
self._button_functions = {}
self._row_operation = {}
self._row_operation_func = None
if add_key_column:
self._addKeyColumn()
def _addKeyColumn(self):
"""Adds a column for the key.
Args:
resizable: Whether the width of the column should be resizable by the
end user.
hidden: Whether the column should be displayed by default.
"""
func = lambda e, *args: e.key().id_or_name()
self.addColumn('key', 'Key', func, hidden=True)
def addColumn(self, id, name, func, resizable=True, hidden=False):
"""Adds a column to the end of the list.
Args:
id: A unique identifier of this column.
name: The header of the column that is shown to the user.
func: The function to be called when rendering this column for
a single entity. This function should take an entity as first
argument and args and kwargs if needed. The string rendering of
the return value will be sent to the end user.
resizable: Whether the width of the column should be resizable by the
end user.
hidden: Whether the column should be displayed by default.
"""
if self._col_functions.get(id):
logging.warning('Column with id %s is already defined' %id)
if not callable(func):
raise TypeError('Given function is not callable')
self._col_model.append({
'name': id,
'index': id,
'resizable': resizable,
'hidden': hidden,
})
self._col_names.append(name)
self._col_functions[id] = func
def addSimpleColumn(self, id, name, resizable=True, hidden=False):
"""Adds a column to the end of the list which uses the id of the column as
attribute name of the entity to get the data from.
This method is basically a shorthand for addColumn with the function as
lambda ent, *args: getattr(ent, id).
Args:
id: A unique identifier of this column and name of the field to get the
data from.
name: The header of the column that is shown to the user.
resizable: Whether the width of the column should be resizable by the
end user.
hidden: Whether the column should be displayed by default.
"""
func = lambda ent, *args: getattr(ent, id)
self.addColumn(id, name, func, resizable=resizable, hidden=hidden)
def __addButton(self, id, caption, bounds, type, parameters):
"""Internal method for adding buttons so that the uniqueness of the id can
be checked.
"""
if self._buttons.get(id):
logging.warning('Button with id %s is already defined' %id)
self._buttons[id] = {
'id': id,
'caption': caption,
'bounds': bounds,
'type': type,
'parameters': parameters
}
def addSimpleRedirectButton(self, id, caption, url, new_window=True):
"""Adds a button to the list that simply opens a URL.
Args:
id: The unique id the button.
caption: The display string shown to the end user.
url: The url to redirect the user to.
new_window: Boolean indicating whether the url should open in a new
window.
"""
parameters = {
'link': url,
'new_window': new_window
}
# add a simple redirect button that is always active.
self.__addButton(id, caption, [0, 'all'], 'redirect_simple', parameters)
def addCustomRedirectButton(self, id, caption, func, new_window=True):
"""Adds a button to the list that simply opens a URL.
Args:
id: The unique id of the button.
caption: The display string shown to the end user.
func: The function to generate a url to redirect the user to.
This function should take an entity as first argument and args and
kwargs if needed. The return value of this function should be a
dictionary with the value for 'link' set to the url to redirect the
user to. A value for the key 'caption' can also be returned to
dynamically change the caption off the button.
new_window: Boolean indicating whether the url should open in a new
window.
"""
if not callable(func):
raise TypeError('Given function is not callable')
parameters = {'new_window': new_window}
# add a custom redirect button that is active on a single row
self.__addButton(id, caption, [1, 1], 'redirect_custom', parameters)
self._button_functions[id] = func
def addPostButton(self, id, caption, url, bounds, keys, refresh='current',
redirect=False):
"""This button is used when there is something to send to the backend in a
POST request.
Args:
id: The unique id of the button.
caption: The display string shown to the end user.
url: The URL to make the POST request to.
bounds: An array of size two with integers or of an integer and the
keyword "all". This indicates how many rows need to be selected
for the button to be pressable.
keys: A list of column identifiers of which the content of the selected
rows will be send to the server when the button is pressed.
refresh: Indicates which list to refresh, is the current list by default.
The keyword 'all' can be used to refresh all lists on the page or
a integer index referring to the idx of the list to refresh can
be given.
redirect: Set to True to have the user be redirected to a URL returned by
the URL where the POST request hits.
"""
parameters = {
'url': url,
'keys': keys,
'refresh': refresh,
'redirect': redirect,
}
self.__addButton(id, caption, bounds, 'post', parameters)
def setRowAction(self, func, new_window=True):
"""The redirects the user to a URL when clicking on a row in the list.
This sets multiselect to False as indicated in the protocol spec.
Args:
func: The function that returns the url to redirect the user to.
This function should take an entity as first argument and args and
kwargs if needed.
new_window: Boolean indicating whether the url should open in a new
window.
"""
if not callable(func):
raise TypeError('Given function is not callable')
self.multiselect = False
parameters = {'new_window': new_window}
self._row_operation = {
'type': 'redirect_custom',
'parameters': parameters
}
self._row_operation_func = func
def setDefaultSort(self, id, order='asc'):
"""Sets the default sort order for the list.
Args:
id: The id of the column to sort on by default. If this evaluates to
False then the default sort order will be removed.
order: The order in which to sort, either 'asc' or 'desc'.
The default value is 'asc'.
"""
col_ids = [item.get('name') for item in self._col_model]
if id and not id in col_ids:
raise ValueError('Id %s is not a defined column (Known columns %s)'
%(id, col_ids))
if order not in ['asc', 'desc']:
raise ValueError('%s is not a valid order' %order)
self._sortname = id if id else ''
self._sortorder = order
class ListConfigurationResponse(Template):
"""Class that builds the template for configuring a list.
"""
def __init__(self, config, idx, description=''):
"""Initializes the configuration.
Args:
config: A ListConfiguration object.
idx: A number uniquely identifying this list. ValueError will be raised if
not an int.
description: The description of this list, as should be shown to the
user.
"""
self._config = config
self._idx = int(idx)
self._description = description
super(ListConfigurationResponse, self).__init__()
def context(self):
"""Returns the context for the current template.
"""
configuration = self._constructConfigDict()
context = {
'idx': self._idx,
'configuration': simplejson.dumps(configuration),
'description': self._description
}
return context
def _constructConfigDict(self):
"""Builds the core of the list configuration that is sent to the client.
Among other things this configuration defines the columns and buttons
present on the list.
"""
configuration = {
'autowidth': self._config.autowidth,
'colNames': self._config._col_names,
'colModel': self._config._col_model,
'height': self._config.height,
'rowList': self._config.row_list,
'rowNum': max(1, self._config.row_num),
'sortname': self._config._sortname,
'sortorder': self._config._sortorder,
'multiselect': False if self._config._row_operation else \
self._config.multiselect,
'toolbar': self._config.toolbar,
}
operations = {
'buttons': self._config._buttons,
'row': self._config._row_operation,
}
listConfiguration = {
'configuration': configuration,
'operations': operations,
}
return listConfiguration
def templatePath(self):
"""Returns the path to the template that should be used in render().
"""
return 'v2/soc/list/list.html'
class ListContentResponse(object):
"""Class that builds the response for a list content request.
"""
def __init__(self, request, config):
"""Initializes the list response.
The request given can define the start parameter in the GET request
otherwise an empty string will be used indicating a request for the first
batch.
Public fields:
start: The start argument as parsed from the request.
next: The value that should be used to query for the next set of
rows. In other words what start will be on the next roundtrip.
limit: The maximum number of rows to return as indicated by the request,
defaults to 50.
Args:
request: The HTTPRequest containing the request for data.
config: A ListConfiguration object
"""
self._request = request
self._config = config
self.__rows = []
get_args = request.GET
self.next = ''
self.start = get_args.get('start', '')
self.limit = int(get_args.get('limit', 50))
def addRow(self, entity, *args, **kwargs):
"""Renders a row for a single entity.
Args:
entity: The entity to render.
args: The args passed to the render functions defined in the config.
kwargs: The kwargs passed to the render functions defined in the config.
"""
columns = {}
for id, func in self._config._col_functions.iteritems():
columns[id] = func(entity, *args, **kwargs)
row = {}
buttons= {}
if self._config._row_operation_func:
# perform the row operation function to retrieve the link
row['link'] = self._config._row_operation_func(entity, *args, **kwargs)
for id, func in self._config._button_functions.iteritems():
# The function called here should return a dictionary with 'link' and
# an optional 'caption' as keys.
buttons[id] = func(entity, *args, **kwargs)
operations = {
'row': row,
'buttons': buttons,
}
data = {
'columns': columns,
'operations': operations,
}
self.__rows.append(data)
def content(self):
"""Returns the object that should be parsed to JSON.
"""
# The maximum number of rows to return is determined by the limit
data = {self.start: self.__rows[0:self.limit]}
return {'data': data,
'next': self.next}
def keyModelStarter(model):
"""Returns a starter for the specified key-based model.
"""
def starter(start, q):
if not start:
return True
start_entity = model.get_by_key_name(start)
if not start_entity:
return False
q.filter('__key__ >=', start_entity.key())
return True
return starter
class RawQueryContentResponseBuilder(object):
"""Builds a ListContentResponse for lists that are based on a single query.
"""
def __init__(self, request, config, query, starter,
ender=None, skipper=None, prefetch=None):
"""Initializes the fields needed to built a response.
Args:
request: The HTTPRequest containing the request for data.
config: The ListConfiguration object.
fields: The fields to query on.
query: The query object to use.
starter: The function used to retrieve the start entity.
ender: The function used to retrieve the value for the next start.
skipper: The function used to determine whether to skip a value.
prefetch: The fields that need to be prefetched for increased
performance.
"""
if not ender:
ender = lambda entity, is_last, start: (
"done" if is_last else entity.key().id_or_name())
if not skipper:
skipper = lambda entity, start: False
self._request = request
self._config = config
self._query = query
self._starter = starter
self._ender = ender
self._skipper = skipper
self._prefetch = prefetch
def build(self, *args, **kwargs):
"""Returns a ListContentResponse containing the data as indicated by the
query.
The start variable will be used as the starting key for our query, the data
returned does not contain the entity that is referred to by the start key.
The next variable will be defined as the key of the last entity returned,
empty if there are no entities to return.
Args and Kwargs passed into this method will be passed along to
ListContentResponse.addRow().
"""
content_response = ListContentResponse(self._request, self._config)
start = content_response.start
if start == 'done':
logging.warning('Received query with "done" start key')
# return empty response
return content_response
if not self._starter(start, self._query):
logging.warning('Received data query for non-existing start entity %s' % start)
# return empty response
return content_response
count = content_response.limit + 1
entities = self._query.fetch(count)
is_last = len(entities) != count
# TODO(SRabbelier): prefetch
for entity in entities:
if self._skipper(entity, start):
continue
content_response.addRow(entity, *args, **kwargs)
if entities:
content_response.next = self._ender(entities[-1], is_last, start)
else:
content_response.next = self._ender(None, True, start)
return content_response
class QueryContentResponseBuilder(RawQueryContentResponseBuilder):
"""Builds a ListContentResponse for lists that are based on a single query.
"""
def __init__(self, request, config, logic, fields, ancestors=None,
prefetch=None):
"""Initializes the fields needed to built a response.
Args:
request: The HTTPRequest containing the request for data.
config: The ListConfiguration object.
logic: The Logic instance used for querying.
fields: The fields to query on.
ancestors: List of ancestor entities to add to the query
prefetch: The fields that need to be prefetched for increased
performance.
"""
starter = keyModelStarter(logic.getModel())
query = logic.getQueryForFields(
filter=fields, ancestors=ancestors)
super(QueryContentResponseBuilder, self).__init__(
request, config, query, starter, prefetch=prefetch)
| {
"content_hash": "0577b70dc8fd64ac629725e5964dc173",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 85,
"avg_line_length": 33.04355716878403,
"alnum_prop": 0.6456857252705004,
"repo_name": "SRabbelier/Melange",
"id": "e9c25fbc679f282b43d2011d75e6fcebfeaba35b",
"size": "18817",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/soc/modules/gsoc/views/helper/lists.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "400472"
},
{
"name": "C++",
"bytes": "20"
},
{
"name": "Java",
"bytes": "1496"
},
{
"name": "JavaScript",
"bytes": "1623582"
},
{
"name": "PHP",
"bytes": "1032"
},
{
"name": "Perl",
"bytes": "177565"
},
{
"name": "Python",
"bytes": "15317793"
},
{
"name": "Ruby",
"bytes": "59"
},
{
"name": "Shell",
"bytes": "15303"
}
],
"symlink_target": ""
} |
'use strict';
//thanks to https://github.com/B-Stefan/node-jira-worklog-export
const _ = require('lodash');
const moment = require('moment');
const argvToRepDate = require('./lib/utils').argvToRepDate;
const adjustWorkingTime = require('./lib/utils').adjustWorkingTime;
const configUtils = require('./lib/config-utils');
const argv = require('optimist').argv;
const generateReport = require('./lib/generate-report');
const log4js = require('log4js');
const assert = require('assert');
log4js.configure('log4js_configuration.json');
var startDate, endDate;
function writeReport(input) {
generateReport(input.dates).then((result) => {
var options = Object.assign(input, { result });
const config = configUtils.loadConfig();
for (var writeReport of config.reporters.map((module) => require(module))) {
writeReport(options);
}
});
}
function reportForDay(startDate, stereotype) {
var endDate = startDate.clone();
endDate.add(1, 'd');
writeReport({
dates: {
startDate: adjustWorkingTime(startDate),
endDate: adjustWorkingTime(endDate)
},
stereotype
});
}
function reportForDuration(startDate, endDate, stereotype) {
var shftEndDate = endDate.clone();
shftEndDate.add(1, 'd');
writeReport({
dates: {
startDate: adjustWorkingTime(startDate),
endDate: adjustWorkingTime(shftEndDate)
},
stereotype
});
}
function reportToday() {
reportForDay(moment(), 'today');
}
function reportYesterday() {
var yesterday = moment().subtract(1, 'd');
reportForDay(yesterday, 'yesterday');
}
function reportWeek() {
reportForDuration(moment().startOf('isoWeek'), moment().endOf('isoWeek'), 'this week');
}
function reportPrevWeek() {
reportForDuration(
moment().startOf('isoWeek').subtract(1, 'w'),
moment().endOf('isoWeek').subtract(1, 'w'),
'prev. week'
);
}
function reportTwoWeeks() {
reportForDuration(
moment().startOf('isoWeek').subtract(2, 'w'),
moment().endOf('isoWeek').subtract(1, 'w'),
'two week ago'
);
}
function reportProgressByQuery(query) {
require('./lib/generate-progress-report')(query);
}
function generateLocalConfig() {
assert(argv.user, 'jira `user` should be defined');
assert(argv.password, 'jira `password` should be defined');
assert(argv.host, 'jira `host` should be defined in the format like - `domain.com`');
assert(argv.projectKeys, 'jira `projectKeys` should be defined in the format like - `AS,WPPAP`');
configUtils.makeDefaultConfig(argv);
}
switch (argv.cmd) {
case 'day':
console.log(`generate for day ${argv.day}`);
startDate = argvToRepDate(argv.day);
reportForDay(startDate);
break;
case 'period':
startDate = argvToRepDate(argv.startDate);
endDate = argvToRepDate(argv.endDate);
reportForDuration(startDate, endDate);
break;
case 'today':
reportToday();
break;
case 'yesterday':
reportYesterday();
break;
case 'prevWeek':
reportPrevWeek();
break;
case 'twoWeeks':
reportTwoWeeks();
break;
case 'week':
reportWeek();
break;
case 'query':
reportProgressByQuery(argv.query);
break;
case 'setup-local-config':
generateLocalConfig();
break;
case undefined:
console.error(`cmd argument must be specified`);
break;
default:
throw new Error(`Unknown action ${argv.cmd}`)
}
| {
"content_hash": "25a8b078d2138692c86a9ed700351053",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 101,
"avg_line_length": 27.876923076923077,
"alnum_prop": 0.6280353200883002,
"repo_name": "chaos-adept/big-bro",
"id": "de3a6eed8932c6cac168b74c656fec8c9eb87ba6",
"size": "3624",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "30006"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "//www.w3.org/TR/html4/strict.dtd">
<HTML style="overflow:auto;">
<HEAD>
<meta name="generator" content="JDiff v1.1.0">
<!-- Generated by the JDiff Javadoc doclet -->
<!-- (http://www.jdiff.org) -->
<meta name="description" content="JDiff is a Javadoc doclet which generates an HTML report of all the packages, classes, constructors, methods, and fields which have been removed, added or changed in any way, including their documentation, when two APIs are compared.">
<meta name="keywords" content="diff, jdiff, javadiff, java diff, java difference, API difference, difference between two APIs, API diff, Javadoc, doclet">
<TITLE>
android.text.style
</TITLE>
<link href="../../../../assets/android-developer-docs.css" rel="stylesheet" type="text/css" />
<link href="../stylesheet-jdiff.css" rel="stylesheet" type="text/css" />
<noscript>
<style type="text/css">
body{overflow:auto;}
#body-content{position:relative; top:0;}
#doc-content{overflow:visible;border-left:3px solid #666;}
#side-nav{padding:0;}
#side-nav .toggle-list ul {display:block;}
#resize-packages-nav{border-bottom:3px solid #666;}
</style>
</noscript>
<style type="text/css">
</style>
</HEAD>
<BODY>
<!-- Start of nav bar -->
<a name="top"></a>
<div id="header" style="margin-bottom:0;padding-bottom:0;">
<div id="headerLeft">
<a href="../../../../index.html" tabindex="-1" target="_top"><img src="../../../../assets/images/bg_logo.png" alt="Android Developers" /></a>
</div>
<div id="headerRight">
<div id="headerLinks">
<!-- <img src="/assets/images/icon_world.jpg" alt="" /> -->
<span class="text">
<!-- <a href="#">English</a> | -->
<nobr><a href="//developer.android.com" target="_top">Android Developers</a> | <a href="//www.android.com" target="_top">Android.com</a></nobr>
</span>
</div>
<div class="and-diff-id" style="margin-top:6px;margin-right:8px;">
<table class="diffspectable">
<tr>
<td colspan="2" class="diffspechead">API Diff Specification</td>
</tr>
<tr>
<td class="diffspec" style="padding-top:.25em">To Level:</td>
<td class="diffvaluenew" style="padding-top:.25em">21</td>
</tr>
<tr>
<td class="diffspec">From Level:</td>
<td class="diffvalueold">20</td>
</tr>
<tr>
<td class="diffspec">Generated</td>
<td class="diffvalue">2014.10.15 15:01</td>
</tr>
</table>
</div><!-- End and-diff-id -->
<div class="and-diff-id" style="margin-right:8px;">
<table class="diffspectable">
<tr>
<td class="diffspec" colspan="2"><a href="jdiff_statistics.html">Statistics</a>
</tr>
</table>
</div> <!-- End and-diff-id -->
</div> <!-- End headerRight -->
</div> <!-- End header -->
<div id="body-content" xstyle="padding:12px;padding-right:18px;">
<div id="doc-content" style="position:relative;">
<div id="mainBodyFluid">
<H2>
Package <A HREF="../../../../reference/android/text/style/package-summary.html" target="_top"><font size="+1"><code>android.text.style</code></font></A>
</H2>
<p>
<a NAME="Added"></a>
<TABLE summary="Added Classes" WIDTH="100%">
<TR>
<TH VALIGN="TOP" COLSPAN=2>Added Classes</FONT></TD>
</TH>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.html" target="_top"><code>TtsSpan</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.Builder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.Builder.html" target="_top"><code>TtsSpan.Builder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.CardinalBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.CardinalBuilder.html" target="_top"><code>TtsSpan.CardinalBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.DateBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.DateBuilder.html" target="_top"><code>TtsSpan.DateBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.DecimalBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.DecimalBuilder.html" target="_top"><code>TtsSpan.DecimalBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.DigitsBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.DigitsBuilder.html" target="_top"><code>TtsSpan.DigitsBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.ElectronicBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.ElectronicBuilder.html" target="_top"><code>TtsSpan.ElectronicBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.FractionBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.FractionBuilder.html" target="_top"><code>TtsSpan.FractionBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.MeasureBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.MeasureBuilder.html" target="_top"><code>TtsSpan.MeasureBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.MoneyBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.MoneyBuilder.html" target="_top"><code>TtsSpan.MoneyBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.OrdinalBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.OrdinalBuilder.html" target="_top"><code>TtsSpan.OrdinalBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.SemioticClassBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.SemioticClassBuilder.html" target="_top"><code>TtsSpan.SemioticClassBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.TelephoneBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.TelephoneBuilder.html" target="_top"><code>TtsSpan.TelephoneBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.TextBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.TextBuilder.html" target="_top"><code>TtsSpan.TextBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.TimeBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.TimeBuilder.html" target="_top"><code>TtsSpan.TimeBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
<TR BGCOLOR="#FFFFFF" CLASS="TableRowColor">
<TD VALIGN="TOP" WIDTH="25%">
<A NAME="TtsSpan.VerbatimBuilder"></A>
<nobr><A HREF="../../../../reference/android/text/style/TtsSpan.VerbatimBuilder.html" target="_top"><code>TtsSpan.VerbatimBuilder</code></A></nobr>
</TD>
<TD> </TD>
</TR>
</TABLE>
</div>
<div id="footer">
<div id="copyright">
Except as noted, this content is licensed under
<a href="//creativecommons.org/licenses/by/2.5/"> Creative Commons Attribution 2.5</a>.
For details and restrictions, see the <a href="/license.html">Content License</a>.
</div>
<div id="footerlinks">
<p>
<a href="//www.android.com/terms.html">Site Terms of Service</a> -
<a href="//www.android.com/privacy.html">Privacy Policy</a> -
<a href="//www.android.com/branding.html">Brand Guidelines</a>
</p>
</div>
</div> <!-- end footer -->
</div><!-- end doc-content -->
</div> <!-- end body-content -->
<script src="//www.google-analytics.com/ga.js" type="text/javascript">
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-5831155-1");
pageTracker._setAllowAnchor(true);
pageTracker._initData();
pageTracker._trackPageview();
} catch(e) {}
</script>
</BODY>
</HTML>
| {
"content_hash": "0cdf381067878bee4d8b43ecd5159bd4",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 269,
"avg_line_length": 39.94642857142857,
"alnum_prop": 0.6352257487706751,
"repo_name": "xorware/android_frameworks_base",
"id": "0e16b0a19eaeada55ccc162fa764cbf2ed408d2c",
"size": "8948",
"binary": false,
"copies": "4",
"ref": "refs/heads/n",
"path": "docs/html/sdk/api_diff/21/changes/pkg_android.text.style.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "167132"
},
{
"name": "C++",
"bytes": "7092455"
},
{
"name": "GLSL",
"bytes": "20654"
},
{
"name": "HTML",
"bytes": "224185"
},
{
"name": "Java",
"bytes": "78926513"
},
{
"name": "Makefile",
"bytes": "420231"
},
{
"name": "Python",
"bytes": "42309"
},
{
"name": "RenderScript",
"bytes": "153826"
},
{
"name": "Shell",
"bytes": "21079"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "08d798a525536e287e89c4e1f851110a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "e5c5e1306f1f6afd371af75eb1ebe9d11d06b889",
"size": "208",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Chlorophyta/Chlorophyceae/Chlorococcales/Gomontiaceae/Chlorojackia/Chlorojackia pachyclados/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE html>
<!-- Microdata markup added by Google Structured Data Markup Helper. -->
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta charset="utf-8" />
<title>MAQ Software | Data Management, Power BI, Artificial Intelligence</title>
<meta name="title" content="MAQ Software | Data Management, Power BI, Artificial Intelligence" />
<meta name="theme-color" content="#c00000">
<meta name="description" content=" MAQ Software delivers innovative software, data management, Power BI, Sharepoint, cloud, and artificial intelligence solutions for Fortune 500 companies."
/>
<meta name="keywords" content="maq software, innovative software, data management, Power BI, Sharepoint, cloud, artificial intelligence"
/>
<meta name="ROBOTS" content="FOLLOW,INDEX" />
<!-- Open Graph data -->
<meta name="og:title" property="og:title" content="MAQ Software | Data Management, Power BI, Artificial Intelligence"
/>
<meta name="og:description" property="og:description" content="MAQ Software delivers innovative software, data management, Power BI, Sharepoint, cloud, and artificial intelligence solutions for Fortune 500 companies."
/>
<meta property="og:image" name="og:image" content="../img/Banners/BI.jpg"
/>
<meta property="og:image:width" content="450"/>
<meta property="og:image:height" content="298"/>
<!-- End Open Graph data -->
<!-- Twitter Card data -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@maqsoftware" />
<meta name="twitter:title" content="MAQ Software | Data Management, Power BI, Artificial Intelligence"
/>
<meta name="twitter:description" content="MAQ Software delivers innovative software, data management, Power BI, Sharepoint, cloud, and artificial intelligence solutions for Fortune 500 companies."
/>
<meta name="twitter:image" content="../img/Banners/BI.jpg"
/>
<!-- End Twitter Card data -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta name="fragment" content="!">
<!--[if IE]><meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'><![endif]-->
<!-- Favicone Icon -->
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
<link rel="icon" type="image/png" href="/img/favicon.ico">
<link rel="apple-touch-icon" href="/img/favicon.ico">
<!-- CSS -->
<link href="/css/style.css?v=20210603" rel="stylesheet" type="text/css" />
<link href="/css/bootstrap.min.css?v=20170822" rel="stylesheet" type="text/css" />
<link href="/css/font-awesome.css?v=20170822" rel="stylesheet" type="text/css" />
<link href="/css/ionicons.css?v=20170822" rel="stylesheet" type="text/css" />
<link href="/css/plugin/sidebar-menu.css?v=20170822" rel="stylesheet" type="text/css" />
<link href="/css/plugin/animate.css?v=20170822" rel="stylesheet" type="text/css" />
<link href="/css/jquery-ui.css?v=20170822" rel="stylesheet" type="text/css" />
<link href="/css/plugin/owl.carousel.2.0.0-beta.3.min.css" rel="stylesheet" />
</head>
<body>
<!-- Preloader -->
<section id="preloader">
<div class="loader" id="loader">
<div class="loader-img"></div>
</div>
</section>
<!-- End Preloader -->
<!-- Site Wraper -->
<div class="wrapper">
<!-- Header -->
<header id="header" class="header">
</header>
<!-- End Header -->
<!-- CONTENT --------------------------------------------------------------------------------->
<section id="body" class="">
<!-- Intro Section -->
<section class="demo inner-intro dark-bg bg-image overlay-dark parallax parallax-background1" data-background-img="../../img/Banners/BI.jpg">
<div class="container text-center" style="padding-top:4vh; padding-bottom:4vh; width:85vw">
<iframe style="border:30px solid black; box-shadow: -2px -2px 2px grey,3px 3px 3px darkgrey;" width="100%" height="100%" src="https://app.powerbi.com/view?r=eyJrIjoiZmE2MjFjNjQtN2Y4My00Y2VjLTg1MDMtNWIxYjU0M2FhN2Y5IiwidCI6ImU0ZDk4ZGQyLTkxOTktNDJlNS1iYThiLWRhM2U3NjNlZGUyZSIsImMiOjZ9" frameborder="0" allowFullScreen="true"></iframe>
</div>
</section>
</section>
<!-- FOOTER -->
<footer class="footer pt-60" id="footer">
</footer>
<!-- END FOOTER -->
<!-- Scroll Top -->
<a class="scroll-top">
<i class="fa fa-angle-double-up"></i>
</a>
<!-- End Scroll Top -->
</div>
<!-- Site Wraper End -->
<!-- JS -->
<!-- Load app main script -->
<script src="/js/plugin/tether.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/jquery-1.11.2.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.easing.js?v=20170822" type="text/javascript"></script>
<script src="/js/jquery-ui.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/bootstrap.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.flexslider.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.fitvids.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.viewportchecker.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.stellar.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/wow.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.colorbox-min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/owl.carousel.2.0.0-beta.3.min.js"></script>
<script src="/js/plugin/isotope.pkgd.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/masonry.pkgd.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/imagesloaded.pkgd.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/jquery.fs.tipper.min.js?v=20170822" type="text/javascript"></script>
<script src="/js/plugin/mediaelement-and-player.min.js?v=20170822"></script>
<script src="/js/plugin/sidebar-menu.js?v=20170822" type="text/javascript"></script>
<script src="https://www.youtube.com/iframe_api"></script>
<script src="/js/theme.js?v=20170828.6" type="text/javascript"></script>
<script src="/js/navigation.js?v=20170822" type="text/javascript"></script>
<script src="/js/contact.js?v=20170828.2" type="text/javascript"></script>
<script src="/js/common.js?v=20170828.1" type="text/javascript"></script>
<script src="/js/home.js?v=20190717" type="text/javascript"></script>
<script src="/js/news.js?v=20190717" type="text/javascript"></script>
<script src="/js/careers.js?v=20190717"></script>
<script>
$("#header").load("/header");
$("#footer").load("/footer");
</script>
<script type="application/ld+json">
{ "@context" : "http://schema.org",
"@type" : "Organization",
"name" : "MAQ Software",
"image" : "https://maqsoftware.com/img/MAQSoftware.png",
"address" : {
"@type": "PostalAddress",
"addressLocality": "Redmond",
"addressRegion": "WA ",
"postalCode": "98052",
"streetAddress": "2027 152nd Avenue NE" },
"url" : "https://maqsoftware.com/",
"logo" : "https://maqsoftware.com/img/MAQSoftware.png",
"email":"[email protected]",
"telephone":"+1-425-526-5399",
"sameAs" : [
"https://www.linkedin.com/company/maq-software",
"https://twitter.com/MAQSoftware",
"https://youtube.com/maqsoftware",
"https://www.facebook.com/maqsoftware",
"https://www.instagram.com/maqsoftware",
"https://plus.google.com/104615735701576694043"]
}
</script>
<!-- Google Analytics -->
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-7928102-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
</body>
</html>
<script>
loadPlugins();
setTabNavLinkBehavior();
</script> | {
"content_hash": "53db9a3332097865bf0c85b9816aa58d",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 352,
"avg_line_length": 52.15337423312884,
"alnum_prop": 0.6398070815198212,
"repo_name": "maqsoftware/maqsoftware",
"id": "0cf8c414b1bca8e0cf8787e7a77c662d4cc304d3",
"size": "8503",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "expertise/reports/kpicolumn.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "332427"
},
{
"name": "HTML",
"bytes": "1277990"
},
{
"name": "JavaScript",
"bytes": "477205"
}
],
"symlink_target": ""
} |
describe('OneLib.DS.MinHeap ', function () {
beforeEach(function () {
//run before each test
});
afterEach(function () {
//run after each test
});
it('should can define a class', function () {
define('test1', ['OneLib.DS.MinHeap'], function (require, exports, module) {
var OOP = require('OneLib.OOP');
var Animal = OOP.defineClass({
constructor:function(){
var self = this;
self.isAnimal = true;
},
prototype:{
makeSound : function(){
return "i am animal";
},
die : function(){
return "i was dead";
}
}
});
var aAnimal = new Animal();
expect(aAnimal instanceof Animal).toBe(true);
expect(aAnimal.makeSound()).toEqual("i am animal");
expect(aAnimal.die()).toEqual("i was dead");
var Dog = OOP.defineClass({
constructor:function(){
var self = this;//save the this ref
self.isDog = true;
},
prototype:{
makeSound : function(){
return "woof!"
}
},
supper:Animal
})
var tom = new Dog();
expect(tom instanceof Dog).toBe(true);
expect(tom.isAnimal).toBe(true);
expect(tom.isDog).toBe(true);
expect(tom.makeSound).toBeDefined();
expect(tom.makeSound()).toBe("woof!");
expect(tom.die).toBeDefined();
expect(tom.die()).toBe("i was dead");
expect(OOP.getSupper(Dog)).toBe(Animal.prototype);
});
});
}); | {
"content_hash": "1929fe4864696aa6f18e621d5d4a0926",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 84,
"avg_line_length": 30.9672131147541,
"alnum_prop": 0.4351508734780307,
"repo_name": "wbpmrck/OneLib",
"id": "93182d729001e09df969f279249c0ddbf982e24e",
"size": "1889",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/OneLib.DS/jasmineCase/test_ds_minheap.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "25692"
},
{
"name": "HTML",
"bytes": "84089"
},
{
"name": "JavaScript",
"bytes": "947368"
}
],
"symlink_target": ""
} |
'use strict';
angular.module('core').service('ApiKeys', ['$http',
function ($http) {
// ApiKeys service logic
// ...
this.getApiKeys = function () {
return $http.get('/api/v1/keys');
};
this.getTractData = function () {
return $http.get('api/v1/tractData');
};
}
]);
| {
"content_hash": "caf34c0e883e19e5b0c9abdd39d20fa3",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 51,
"avg_line_length": 22,
"alnum_prop": 0.551948051948052,
"repo_name": "mapping-slc/mapping-slc",
"id": "2030e21c1cb20f8bfc2d1f71856f43d3fe0f482a",
"size": "308",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "modules/core/client/services/apiKeys.client.service.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "157602"
},
{
"name": "HTML",
"bytes": "362366"
},
{
"name": "JavaScript",
"bytes": "638772"
},
{
"name": "Shell",
"bytes": "685"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.