text
stringlengths 2
1.04M
| meta
dict |
---|---|
define([
'jquery',
'underscore',
'backbone',
'translate'
], function($, _, Backbone, _t) {
'use strict';
var BaseView = Backbone.View.extend({
isUIView: true,
eventPrefix: 'ui',
template: null,
idPrefix: 'base-',
appendInContainer: true,
initialize: function(options) {
this.options = options;
for (var key in this.options) {
this[key] = this.options[key];
}
this.options._t = _t;
},
render: function() {
this.applyTemplate();
this.trigger('render', this);
this.afterRender();
if (this.options.id) {
// apply id to element
this.$el.attr('id', this.idPrefix + this.options.id);
}
return this;
},
afterRender: function() {
},
serializedModel: function() {
return this.options;
},
applyTemplate: function() {
if (this.template !== null) {
var data = $.extend({_t: _t}, this.options, this.serializedModel());
var template = this.template;
if(typeof(template) === 'string'){
template = _.template(template);
}
this.$el.html(template(data));
}
},
propagateEvent: function(eventName) {
if (eventName.indexOf(':') > 0) {
var eventId = eventName.split(':')[0];
if (this.eventPrefix !== '') {
if (eventId === this.eventPrefix ||
eventId === this.eventPrefix + '.' + this.id) { return true; }
}
}
return false;
},
uiEventTrigger: function(name) {
var args = [].slice.call(arguments, 0);
if (this.eventPrefix !== '') {
args[0] = this.eventPrefix + ':' + name;
Backbone.View.prototype.trigger.apply(this, args);
if (this.id) {
args[0] = this.eventPrefix + '.' + this.id + ':' + name;
Backbone.View.prototype.trigger.apply(this, args);
}
}
}
});
return BaseView;
});
| {
"content_hash": "93a2256f510824d452af115cfbaca1e0",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 76,
"avg_line_length": 25.866666666666667,
"alnum_prop": 0.5329896907216495,
"repo_name": "domruf/mockup",
"id": "eeba14a0326b209f7e1dfec687665ee23179787f",
"size": "1940",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "mockup/js/ui/views/base.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "69417"
},
{
"name": "HTML",
"bytes": "2865"
},
{
"name": "JavaScript",
"bytes": "1806150"
},
{
"name": "Makefile",
"bytes": "4738"
},
{
"name": "Nix",
"bytes": "236693"
},
{
"name": "Python",
"bytes": "892"
},
{
"name": "Shell",
"bytes": "1030"
}
],
"symlink_target": ""
} |
package io.xpydev.paycoinj.net;
import io.xpydev.paycoinj.core.Utils;
import io.xpydev.paycoinj.utils.Threading;
import com.google.common.annotations.VisibleForTesting;
import com.google.protobuf.ByteString;
import com.google.protobuf.MessageLite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.concurrent.GuardedBy;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantLock;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
/**
* <p>A handler which is used in {@link NioServer} and {@link NioClient} to split up incoming data streams
* into protobufs and provide an interface for writing protobufs to the connections.</p>
*
* <p>Messages are encoded with a 4-byte signed integer (big endian) prefix to indicate their length followed by the
* serialized protobuf</p>
*/
public class ProtobufParser<MessageType extends MessageLite> extends AbstractTimeoutHandler implements StreamParser {
private static final Logger log = LoggerFactory.getLogger(ProtobufParser.class);
/**
* An interface which can be implemented to handle callbacks as new messages are generated and socket events occur.
* @param <MessageType> The protobuf type which is used on this socket.
* This <b>MUST</b> match the MessageType used in the parent {@link ProtobufParser}
*/
public interface Listener<MessageType extends MessageLite> {
/** Called when a new protobuf is received from the remote side. */
public void messageReceived(ProtobufParser<MessageType> handler, MessageType msg);
/** Called when the connection is opened and available for writing data to. */
public void connectionOpen(ProtobufParser<MessageType> handler);
/** Called when the connection is closed and no more data should be provided. */
public void connectionClosed(ProtobufParser<MessageType> handler);
}
// The callback listener
private final Listener<MessageType> handler;
// The prototype which is used to deserialize messages
private final MessageLite prototype;
// The maximum message size (NOT INCLUDING LENGTH PREFIX)
final int maxMessageSize;
// A temporary buffer used when the message size is larger than the buffer being used by the network code
// Because the networking code uses a constant size buffer and we want to allow for very large message sizes, we use
// a smaller network buffer per client and only allocate more memory when we need it to deserialize large messages.
// Though this is not in of itself a DoS protection, it allows for handling more legitimate clients per server and
// attacking clients can be made to timeout/get blocked if they are sending crap to fill buffers.
@GuardedBy("lock") private int messageBytesOffset = 0;
@GuardedBy("lock") private byte[] messageBytes;
private final ReentrantLock lock = Threading.lock("ProtobufParser");
@VisibleForTesting final AtomicReference<MessageWriteTarget> writeTarget = new AtomicReference<MessageWriteTarget>();
/**
* Creates a new protobuf handler.
*
* @param handler The callback listener
* @param prototype The default instance of the message type used in both directions of this channel.
* This should be the return value from {@link MessageType#getDefaultInstanceForType()}
* @param maxMessageSize The maximum message size (not including the 4-byte length prefix).
* Note that this has an upper bound of {@link Integer#MAX_VALUE} - 4
* @param timeoutMillis The timeout between messages before the connection is automatically closed. Only enabled
* after the connection is established.
*/
public ProtobufParser(Listener<MessageType> handler, MessageType prototype, int maxMessageSize, int timeoutMillis) {
this.handler = handler;
this.prototype = prototype;
this.maxMessageSize = Math.min(maxMessageSize, Integer.MAX_VALUE - 4);
setTimeoutEnabled(false);
setSocketTimeout(timeoutMillis);
}
@Override
public void setWriteTarget(MessageWriteTarget writeTarget) {
// Only allow it to be set once.
checkState(this.writeTarget.getAndSet(checkNotNull(writeTarget)) == null);
}
@Override
public int getMaxMessageSize() {
return maxMessageSize;
}
/**
* Closes this connection, eventually triggering a {@link ProtobufParser.Listener#connectionClosed()} event.
*/
public void closeConnection() {
this.writeTarget.get().closeConnection();
}
@Override
protected void timeoutOccurred() {
log.warn("Timeout occurred for " + handler);
closeConnection();
}
// Deserializes and provides a listener event (buff must not have the length prefix in it)
// Does set the buffers's position to its limit
@SuppressWarnings("unchecked")
// The warning 'unchecked cast' being suppressed here comes from the build() formally returning
// a MessageLite-derived class that cannot be statically guaranteed to be the MessageType.
private void deserializeMessage(ByteBuffer buff) throws Exception {
MessageType msg = (MessageType) prototype.newBuilderForType().mergeFrom(ByteString.copyFrom(buff)).build();
resetTimeout();
handler.messageReceived(this, msg);
}
@Override
public int receiveBytes(ByteBuffer buff) throws Exception {
lock.lock();
try {
if (messageBytes != null) {
// Just keep filling up the currently being worked on message
int bytesToGet = Math.min(messageBytes.length - messageBytesOffset, buff.remaining());
buff.get(messageBytes, messageBytesOffset, bytesToGet);
messageBytesOffset += bytesToGet;
if (messageBytesOffset == messageBytes.length) {
// Filled up our buffer, decode the message
deserializeMessage(ByteBuffer.wrap(messageBytes));
messageBytes = null;
if (buff.hasRemaining())
return bytesToGet + receiveBytes(buff);
}
return bytesToGet;
}
// If we cant read the length prefix yet, give up
if (buff.remaining() < 4)
return 0;
// Read one integer in big endian
buff.order(ByteOrder.BIG_ENDIAN);
final int len = buff.getInt();
// If length is larger than the maximum message size (or is negative/overflows) throw an exception and close the
// connection
if (len > maxMessageSize || len + 4 < 4)
throw new IllegalStateException("Message too large or length underflowed");
// If the buffer's capacity is less than the next messages length + 4 (length prefix), we must use messageBytes
// as a temporary buffer to store the message
if (buff.capacity() < len + 4) {
messageBytes = new byte[len];
// Now copy all remaining bytes into the new buffer, set messageBytesOffset and tell the caller how many
// bytes we consumed
int bytesToRead = buff.remaining();
buff.get(messageBytes, 0, bytesToRead);
messageBytesOffset = bytesToRead;
return bytesToRead + 4;
}
if (buff.remaining() < len) {
// Wait until the whole message is available in the buffer
buff.position(buff.position() - 4); // Make sure the buffer's position is right at the end
return 0;
}
// Temporarily limit the buffer to the size of the message so that the protobuf decode doesn't get messed up
int limit = buff.limit();
buff.limit(buff.position() + len);
deserializeMessage(buff);
checkState(buff.remaining() == 0);
buff.limit(limit); // Reset the limit in case we have to recurse
// If there are still bytes remaining, see if we can pull out another message since we won't get called again
if (buff.hasRemaining())
return len + 4 + receiveBytes(buff);
else
return len + 4;
} finally {
lock.unlock();
}
}
@Override
public void connectionClosed() {
handler.connectionClosed(this);
}
@Override
public void connectionOpened() {
setTimeoutEnabled(true);
handler.connectionOpen(this);
}
/**
* <p>Writes the given message to the other side of the connection, prefixing it with the proper 4-byte prefix.</p>
*
* <p>Provides a write-order guarantee.</p>
*
* @throws IllegalStateException If the encoded message is larger than the maximum message size.
*/
public void write(MessageType msg) throws IllegalStateException {
byte[] messageBytes = msg.toByteArray();
checkState(messageBytes.length <= maxMessageSize);
byte[] messageLength = new byte[4];
Utils.uint32ToByteArrayBE(messageBytes.length, messageLength, 0);
try {
MessageWriteTarget target = writeTarget.get();
target.writeBytes(messageLength);
target.writeBytes(messageBytes);
} catch (IOException e) {
closeConnection();
}
}
}
| {
"content_hash": "d17e2b5a4dac2fdc2dfc30a4778734be",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 124,
"avg_line_length": 44.55045871559633,
"alnum_prop": 0.6618616144975288,
"repo_name": "PaycoinFoundation/paycoinj",
"id": "3d4fabe3309c511f9e5ffa3a898a00cd05380085",
"size": "10305",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "core/src/main/java/io/xpydev/paycoinj/net/ProtobufParser.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "3591496"
},
{
"name": "Protocol Buffer",
"bytes": "37095"
}
],
"symlink_target": ""
} |
import {InspectTool, InspectToolView} from "./inspect_tool"
import {Tooltip, TooltipView} from "../../annotations/tooltip"
import {RendererView} from "../../renderers/renderer"
import {GlyphRenderer, GlyphRendererView} from "../../renderers/glyph_renderer"
import {GraphRendererView} from "../../renderers/graph_renderer"
import {compute_renderers, DataRenderer, RendererSpec} from "../util"
import * as hittest from "core/hittest"
import {MoveEvent} from "core/ui_events"
import {replace_placeholders, Vars} from "core/util/templating"
import {div, span} from "core/dom"
import * as p from "core/properties"
import {color2hex} from "core/util/color"
import {values, isEmpty} from "core/util/object"
import {isString, isFunction, isNumber} from "core/util/types"
import {build_views, remove_views} from "core/build_views"
import {Anchor, TooltipAttachment} from "core/enums"
import {Geometry, PointGeometry, SpanGeometry} from "core/geometry"
import {ColumnarDataSource} from "../../sources/columnar_data_source"
import {ImageIndex} from "../../glyphs/image"
export function _nearest_line_hit(i: number, geometry: Geometry,
sx: number, sy: number, dx: number[], dy: number[]): [[number, number], number] {
const d1 = {x: dx[i], y: dy[i]}
const d2 = {x: dx[i+1], y: dy[i+1]}
let dist1: number
let dist2: number
if (geometry.type == "span") {
if (geometry.direction == "h") {
dist1 = Math.abs(d1.x - sx)
dist2 = Math.abs(d2.x - sx)
} else {
dist1 = Math.abs(d1.y - sy)
dist2 = Math.abs(d2.y - sy)
}
} else {
const s = {x: sx, y: sy}
dist1 = hittest.dist_2_pts(d1, s)
dist2 = hittest.dist_2_pts(d2, s)
}
if (dist1 < dist2)
return [[d1.x, d1.y], i]
else
return [[d2.x, d2.y], i+1]
}
export function _line_hit(xs: number[], ys: number[], ind: number): [[number, number], number] {
return [[xs[ind], ys[ind]], ind]
}
export class HoverToolView extends InspectToolView {
model: HoverTool
protected ttviews: {[key: string]: TooltipView}
protected _ttmodels: {[key: string]: Tooltip} | null
protected _computed_renderers: DataRenderer[] | null
initialize(options: any): void {
super.initialize(options)
this.ttviews = {}
}
remove(): void {
remove_views(this.ttviews)
super.remove()
}
connect_signals(): void {
super.connect_signals()
for (const r of this.computed_renderers) {
if (r instanceof GlyphRenderer)
this.connect(r.data_source.inspect, this._update)
else {
this.connect(r.node_renderer.data_source.inspect, this._update)
this.connect(r.edge_renderer.data_source.inspect, this._update)
}
}
// TODO: this.connect(this.plot_model.plot.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null)
this.connect(this.model.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null)
this.connect(this.model.properties.names.change, () => this._computed_renderers = this._ttmodels = null)
this.connect(this.model.properties.tooltips.change, () => this._ttmodels = null)
}
protected _compute_ttmodels(): {[key: string]: Tooltip} {
const ttmodels: {[key: string]: Tooltip} = {}
const tooltips = this.model.tooltips
if (tooltips != null) {
for (const r of this.computed_renderers) {
if (r instanceof GlyphRenderer) {
const tooltip = new Tooltip({
custom: isString(tooltips) || isFunction(tooltips),
attachment: this.model.attachment,
show_arrow: this.model.show_arrow,
})
ttmodels[r.id] = tooltip
} else {
const tooltip = new Tooltip({
custom: isString(tooltips) || isFunction(tooltips),
attachment: this.model.attachment,
show_arrow: this.model.show_arrow,
})
ttmodels[r.node_renderer.id] = tooltip
ttmodels[r.edge_renderer.id] = tooltip
}
}
}
build_views(this.ttviews, values(ttmodels), {parent: this, plot_view: this.plot_view})
return ttmodels
}
get computed_renderers(): DataRenderer[] {
if (this._computed_renderers == null) {
const renderers = this.model.renderers
const all_renderers = this.plot_model.plot.renderers
const names = this.model.names
this._computed_renderers = compute_renderers(renderers, all_renderers, names)
}
return this._computed_renderers
}
get ttmodels(): {[key: string]: Tooltip} {
if (this._ttmodels == null)
this._ttmodels = this._compute_ttmodels()
return this._ttmodels
}
_clear(): void {
this._inspect(Infinity, Infinity)
for (const rid in this.ttmodels) {
const tt = this.ttmodels[rid]
tt.clear()
}
}
_move(ev: MoveEvent): void {
if (!this.model.active)
return
const {sx, sy} = ev
if (!this.plot_model.frame.bbox.contains(sx, sy))
this._clear()
else
this._inspect(sx, sy)
}
_move_exit(): void {
this._clear()
}
_inspect(sx: number, sy: number): void {
let geometry: PointGeometry | SpanGeometry
if (this.model.mode == 'mouse')
geometry = {type: 'point', sx, sy}
else {
const direction = this.model.mode == 'vline' ? 'h' : 'v'
geometry = {type: 'span', direction, sx, sy}
}
for (const r of this.computed_renderers) {
const sm = r.get_selection_manager()
sm.inspect(this.plot_view.renderer_views[r.id], geometry)
}
if (this.model.callback != null)
this._emit_callback(geometry)
}
_update([renderer_view, {geometry}]: [RendererView, {geometry: PointGeometry | SpanGeometry}]): void {
if (!this.model.active)
return
if (!(renderer_view instanceof GlyphRendererView || renderer_view instanceof GraphRendererView))
return
const {model: renderer} = renderer_view
const tooltip = this.ttmodels[renderer.id]
if (tooltip == null)
return
tooltip.clear()
const selection_manager = renderer.get_selection_manager()
let indices = selection_manager.inspectors[renderer.id]
if (renderer instanceof GlyphRenderer)
indices = renderer.view.convert_selection_to_subset(indices)
if (indices.is_empty())
return
const ds = selection_manager.source
const frame = this.plot_model.frame
const {sx, sy} = geometry
const xscale = frame.xscales[renderer.x_range_name]
const yscale = frame.yscales[renderer.y_range_name]
const x = xscale.invert(sx)
const y = yscale.invert(sy)
const glyph = (renderer_view as any).glyph // XXX
for (const i of indices.line_indices) {
let data_x = glyph._x[i+1]
let data_y = glyph._y[i+1]
let ii = i
let rx: number
let ry: number
switch (this.model.line_policy) {
case "interp": { // and renderer.get_interpolation_hit?
[data_x, data_y] = glyph.get_interpolation_hit(i, geometry)
rx = xscale.compute(data_x)
ry = yscale.compute(data_y)
break
}
case "prev": {
[[rx, ry], ii] = _line_hit(glyph.sx, glyph.sy, i)
break
}
case "next": {
[[rx, ry], ii] = _line_hit(glyph.sx, glyph.sy, i+1)
break
}
case "nearest": {
[[rx, ry], ii] = _nearest_line_hit(i, geometry, sx, sy, glyph.sx, glyph.sy)
data_x = glyph._x[ii]
data_y = glyph._y[ii]
break
}
default: {
[rx, ry] = [sx, sy]
}
}
const vars = {
index: ii,
x: x,
y: y,
sx: sx,
sy: sy,
data_x: data_x,
data_y: data_y,
rx: rx,
ry: ry,
indices: indices.line_indices,
name: renderer_view.model.name,
}
tooltip.add(rx, ry, this._render_tooltips(ds, ii, vars))
}
for (const struct of indices.image_indices) {
const vars = {index: struct['index'], x, y, sx, sy}
const rendered = this._render_tooltips(ds, struct, vars)
tooltip.add(sx, sy, rendered)
}
for (const i of indices.indices) {
// multiglyphs set additional indices, e.g. multiline_indices for different tooltips
if (!isEmpty(indices.multiline_indices)) {
for (const j of indices.multiline_indices[i.toString()]) {
let data_x = glyph._xs[i][j]
let data_y = glyph._ys[i][j]
let jj = j
let rx: number
let ry: number
switch (this.model.line_policy) {
case "interp": { // and renderer.get_interpolation_hit?
[data_x, data_y] = glyph.get_interpolation_hit(i, j, geometry)
rx = xscale.compute(data_x)
ry = yscale.compute(data_y)
break
}
case "prev": {
[[rx, ry], jj] = _line_hit(glyph.sxs[i], glyph.sys[i], j)
break
}
case "next": {
[[rx, ry], jj] = _line_hit(glyph.sxs[i], glyph.sys[i], j+1)
break
}
case "nearest": {
[[rx, ry], jj] = _nearest_line_hit(j, geometry, sx, sy, glyph.sxs[i], glyph.sys[i])
data_x = glyph._xs[i][jj]
data_y = glyph._ys[i][jj]
break
}
default:
throw new Error("should't have happened")
}
let index: number
if (renderer instanceof GlyphRenderer)
index = renderer.view.convert_indices_from_subset([i])[0]
else
index = i
const vars = {
index: index,
segment_index: jj,
x: x,
y: y,
sx: sx,
sy: sy,
data_x: data_x,
data_y: data_y,
indices: indices.multiline_indices,
name: renderer_view.model.name,
}
tooltip.add(rx, ry, this._render_tooltips(ds, index, vars))
}
} else {
// handle non-multiglyphs
const data_x = glyph._x != null ? glyph._x[i] : undefined
const data_y = glyph._y != null ? glyph._y[i] : undefined
let rx: number
let ry: number
if (this.model.point_policy == 'snap_to_data') { // and renderer.glyph.sx? and renderer.glyph.sy?
// Pass in our screen position so we can determine which patch we're
// over if there are discontinuous patches.
let pt = glyph.get_anchor_point(this.model.anchor, i, [sx, sy])
if (pt == null)
pt = glyph.get_anchor_point("center", i, [sx, sy])
rx = pt.x
ry = pt.y
} else
[rx, ry] = [sx, sy]
let index: number
if (renderer instanceof GlyphRenderer)
index = renderer.view.convert_indices_from_subset([i])[0]
else
index = i
const vars = {
index: index,
x: x,
y: y,
sx: sx,
sy: sy,
data_x: data_x,
data_y: data_y,
indices: indices.indices,
name: renderer_view.model.name,
}
tooltip.add(rx, ry, this._render_tooltips(ds, index, vars))
}
}
}
_emit_callback(geometry: PointGeometry | SpanGeometry): void {
for (const r of this.computed_renderers) {
const index = (r as any).data_source.inspected
const frame = this.plot_model.frame
const xscale = frame.xscales[r.x_range_name]
const yscale = frame.yscales[r.y_range_name]
const x = xscale.invert(geometry.sx)
const y = yscale.invert(geometry.sy)
const g = {x, y, ...geometry}
const callback = this.model.callback
const [obj, data] = [callback, {index: index, geometry: g, renderer: r}]
if (isFunction(callback))
callback(obj, data)
else
callback.execute(obj, data)
}
}
_render_tooltips(ds: ColumnarDataSource, i: number | ImageIndex, vars: Vars): HTMLElement {
const tooltips = this.model.tooltips
if (isString(tooltips)) {
const el = div()
el.innerHTML = replace_placeholders(tooltips, ds, i, this.model.formatters, vars)
return el
} else if (isFunction(tooltips)) {
return tooltips(ds, vars)
} else {
const rows = div({style: {display: "table", borderSpacing: "2px"}})
for (const [label, value] of tooltips) {
const row = div({style: {display: "table-row"}})
rows.appendChild(row)
let cell: HTMLElement
cell = div({style: {display: "table-cell"}, class: 'bk-tooltip-row-label'}, `${label}: `)
row.appendChild(cell)
cell = div({style: {display: "table-cell"}, class: 'bk-tooltip-row-value'})
row.appendChild(cell)
if (value.indexOf("$color") >= 0) {
const [, opts="", colname] = value.match(/\$color(\[.*\])?:(\w*)/)! // XXX!
const column = ds.get_column(colname) // XXX: change to columnar ds
if (column == null) {
const el = span({}, `${colname} unknown`)
cell.appendChild(el)
continue
}
const hex = opts.indexOf("hex") >= 0
const swatch = opts.indexOf("swatch") >= 0
let color = isNumber(i) ? column[i] : null
if (color == null) {
const el = span({}, "(null)")
cell.appendChild(el)
continue
}
if (hex)
color = color2hex(color)
let el = span({}, color)
cell.appendChild(el)
if (swatch) {
el = span({class: 'bk-tooltip-color-block', style: {backgroundColor: color}}, " ")
cell.appendChild(el)
}
} else {
const el = span()
el.innerHTML = replace_placeholders(value.replace("$~", "$data_"), ds, i, this.model.formatters, vars)
cell.appendChild(el)
}
}
return rows
}
}
}
export namespace HoverTool {
export interface Attrs extends InspectTool.Attrs {
tooltips: string | [string, string][] | ((source: ColumnarDataSource, vars: Vars) => HTMLElement)
formatters: any // XXX
renderers: RendererSpec
names: string[]
mode: "mouse" | "hline" | "vline"
point_policy: "snap_to_data" | "follow_mouse" | "none"
line_policy: "prev" | "next" | "nearest" | "interp" | "none"
show_arrow: boolean
anchor: Anchor
attachment: TooltipAttachment
callback: any // XXX
}
export interface Props extends InspectTool.Props {
tooltips: p.Property<string | [string, string][] | ((source: ColumnarDataSource, vars: Vars) => HTMLElement)>
renderers: p.Property<RendererSpec>
names: p.Property<string[]>
}
}
export interface HoverTool extends HoverTool.Attrs {}
export class HoverTool extends InspectTool {
properties: HoverTool.Props
constructor(attrs?: Partial<HoverTool.Attrs>) {
super(attrs)
}
static initClass(): void {
this.prototype.type = "HoverTool"
this.prototype.default_view = HoverToolView
this.define({
tooltips: [ p.Any, [
["index", "$index" ],
["data (x, y)", "($x, $y)" ],
["screen (x, y)", "($sx, $sy)"],
]],
formatters: [ p.Any, {} ],
renderers: [ p.Any, 'auto' ],
names: [ p.Array, [] ],
mode: [ p.String, 'mouse' ], // TODO (bev)
point_policy: [ p.String, 'snap_to_data' ], // TODO (bev) "follow_mouse", "none"
line_policy: [ p.String, 'nearest' ], // TODO (bev) "next", "nearest", "interp", "none"
show_arrow: [ p.Boolean, true ],
anchor: [ p.String, 'center' ], // TODO: enum
attachment: [ p.String, 'horizontal' ], // TODO: enum
callback: [ p.Any ], // TODO: p.Either(p.Instance(Callback), p.Function) ]
})
}
tool_name = "Hover"
icon = "bk-tool-icon-hover"
}
HoverTool.initClass()
| {
"content_hash": "4c3c65ef3c8af55452a46f30503ae94e",
"timestamp": "",
"source": "github",
"line_count": 501,
"max_line_length": 131,
"avg_line_length": 32.18363273453094,
"alnum_prop": 0.565058298189035,
"repo_name": "jakirkham/bokeh",
"id": "9e8c866a0c18a24472c681ee68d56d85f1ce55d2",
"size": "16124",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "bokehjs/src/lib/models/tools/inspectors/hover_tool.ts",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1442"
},
{
"name": "CSS",
"bytes": "102287"
},
{
"name": "CoffeeScript",
"bytes": "413132"
},
{
"name": "Dockerfile",
"bytes": "4099"
},
{
"name": "HTML",
"bytes": "47532"
},
{
"name": "JavaScript",
"bytes": "25172"
},
{
"name": "Makefile",
"bytes": "1150"
},
{
"name": "PowerShell",
"bytes": "691"
},
{
"name": "Python",
"bytes": "3332368"
},
{
"name": "Shell",
"bytes": "9209"
},
{
"name": "TypeScript",
"bytes": "1634848"
}
],
"symlink_target": ""
} |
module Azure::GraphRbac::V1_6
#
# The Graph RBAC Management Client
#
class Groups
include MsRestAzure
#
# Creates and initializes a new instance of the Groups class.
# @param client service class for accessing basic functionality.
#
def initialize(client)
@client = client
end
# @return [GraphRbacClient] reference to the GraphRbacClient
attr_reader :client
#
# Checks whether the specified user, group, contact, or service principal is a
# direct or transitive member of the specified group.
#
# @param parameters [CheckGroupMembershipParameters] The check group membership
# parameters.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [CheckGroupMembershipResult] operation results.
#
def is_member_of(parameters, custom_headers:nil)
response = is_member_of_async(parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Checks whether the specified user, group, contact, or service principal is a
# direct or transitive member of the specified group.
#
# @param parameters [CheckGroupMembershipParameters] The check group membership
# parameters.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def is_member_of_with_http_info(parameters, custom_headers:nil)
is_member_of_async(parameters, custom_headers:custom_headers).value!
end
#
# Checks whether the specified user, group, contact, or service principal is a
# direct or transitive member of the specified group.
#
# @param parameters [CheckGroupMembershipParameters] The check group membership
# parameters.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def is_member_of_async(parameters, custom_headers:nil)
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::GraphRbac::V1_6::Models::CheckGroupMembershipParameters.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = '{tenantID}/isMemberOf'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:post, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::CheckGroupMembershipResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Remove a member from a group.
#
# @param group_object_id [String] The object ID of the group from which to
# remove the member.
# @param member_object_id [String] Member object id
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def remove_member(group_object_id, member_object_id, custom_headers:nil)
response = remove_member_async(group_object_id, member_object_id, custom_headers:custom_headers).value!
nil
end
#
# Remove a member from a group.
#
# @param group_object_id [String] The object ID of the group from which to
# remove the member.
# @param member_object_id [String] Member object id
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def remove_member_with_http_info(group_object_id, member_object_id, custom_headers:nil)
remove_member_async(group_object_id, member_object_id, custom_headers:custom_headers).value!
end
#
# Remove a member from a group.
#
# @param group_object_id [String] The object ID of the group from which to
# remove the member.
# @param member_object_id [String] Member object id
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def remove_member_async(group_object_id, member_object_id, custom_headers:nil)
fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
fail ArgumentError, 'member_object_id is nil' if member_object_id.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/groups/{groupObjectId}/$links/members/{memberObjectId}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'groupObjectId' => group_object_id,'memberObjectId' => member_object_id,'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:delete, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end
#
# Add a member to a group.
#
# @param group_object_id [String] The object ID of the group to which to add
# the member.
# @param parameters [GroupAddMemberParameters] The URL of the member object,
# such as
# https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def add_member(group_object_id, parameters, custom_headers:nil)
response = add_member_async(group_object_id, parameters, custom_headers:custom_headers).value!
nil
end
#
# Add a member to a group.
#
# @param group_object_id [String] The object ID of the group to which to add
# the member.
# @param parameters [GroupAddMemberParameters] The URL of the member object,
# such as
# https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def add_member_with_http_info(group_object_id, parameters, custom_headers:nil)
add_member_async(group_object_id, parameters, custom_headers:custom_headers).value!
end
#
# Add a member to a group.
#
# @param group_object_id [String] The object ID of the group to which to add
# the member.
# @param parameters [GroupAddMemberParameters] The URL of the member object,
# such as
# https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def add_member_async(group_object_id, parameters, custom_headers:nil)
fail ArgumentError, 'group_object_id is nil' if group_object_id.nil?
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::GraphRbac::V1_6::Models::GroupAddMemberParameters.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = '{tenantID}/groups/{groupObjectId}/$links/members'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'groupObjectId' => group_object_id,'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:post, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end
#
# Create a group in the directory.
#
# @param parameters [GroupCreateParameters] The parameters for the group to
# create.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [ADGroup] operation results.
#
def create(parameters, custom_headers:nil)
response = create_async(parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Create a group in the directory.
#
# @param parameters [GroupCreateParameters] The parameters for the group to
# create.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def create_with_http_info(parameters, custom_headers:nil)
create_async(parameters, custom_headers:custom_headers).value!
end
#
# Create a group in the directory.
#
# @param parameters [GroupCreateParameters] The parameters for the group to
# create.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def create_async(parameters, custom_headers:nil)
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::GraphRbac::V1_6::Models::GroupCreateParameters.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = '{tenantID}/groups'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:post, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 201
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 201
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::ADGroup.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets list of groups for the current tenant.
#
# @param filter [String] The filter to apply to the operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<ADGroup>] operation results.
#
def list(filter:nil, custom_headers:nil)
first_page = list_as_lazy(filter:filter, custom_headers:custom_headers)
first_page.get_all_items
end
#
# Gets list of groups for the current tenant.
#
# @param filter [String] The filter to apply to the operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_with_http_info(filter:nil, custom_headers:nil)
list_async(filter:filter, custom_headers:custom_headers).value!
end
#
# Gets list of groups for the current tenant.
#
# @param filter [String] The filter to apply to the operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_async(filter:nil, custom_headers:nil)
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/groups'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'tenantID' => @client.tenant_id},
query_params: {'$filter' => filter,'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::GroupListResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets the members of a group.
#
# @param object_id [String] The object ID of the group whose members should be
# retrieved.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<AADObject>] operation results.
#
def get_group_members(object_id, custom_headers:nil)
first_page = get_group_members_as_lazy(object_id, custom_headers:custom_headers)
first_page.get_all_items
end
#
# Gets the members of a group.
#
# @param object_id [String] The object ID of the group whose members should be
# retrieved.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_group_members_with_http_info(object_id, custom_headers:nil)
get_group_members_async(object_id, custom_headers:custom_headers).value!
end
#
# Gets the members of a group.
#
# @param object_id [String] The object ID of the group whose members should be
# retrieved.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_group_members_async(object_id, custom_headers:nil)
fail ArgumentError, 'object_id is nil' if object_id.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/groups/{objectId}/members'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::GetObjectsResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets group information from the directory.
#
# @param object_id [String] The object ID of the user for which to get group
# information.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [ADGroup] operation results.
#
def get(object_id, custom_headers:nil)
response = get_async(object_id, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets group information from the directory.
#
# @param object_id [String] The object ID of the user for which to get group
# information.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_with_http_info(object_id, custom_headers:nil)
get_async(object_id, custom_headers:custom_headers).value!
end
#
# Gets group information from the directory.
#
# @param object_id [String] The object ID of the user for which to get group
# information.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_async(object_id, custom_headers:nil)
fail ArgumentError, 'object_id is nil' if object_id.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/groups/{objectId}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::ADGroup.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Delete a group from the directory.
#
# @param object_id [String] The object ID of the group to delete.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
#
def delete(object_id, custom_headers:nil)
response = delete_async(object_id, custom_headers:custom_headers).value!
nil
end
#
# Delete a group from the directory.
#
# @param object_id [String] The object ID of the group to delete.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def delete_with_http_info(object_id, custom_headers:nil)
delete_async(object_id, custom_headers:custom_headers).value!
end
#
# Delete a group from the directory.
#
# @param object_id [String] The object ID of the group to delete.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def delete_async(object_id, custom_headers:nil)
fail ArgumentError, 'object_id is nil' if object_id.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/groups/{objectId}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:delete, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 204
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
result
end
promise.execute
end
#
# Gets a collection of object IDs of groups of which the specified group is a
# member.
#
# @param object_id [String] The object ID of the group for which to get group
# membership.
# @param parameters [GroupGetMemberGroupsParameters] Group filtering
# parameters.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [GroupGetMemberGroupsResult] operation results.
#
def get_member_groups(object_id, parameters, custom_headers:nil)
response = get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets a collection of object IDs of groups of which the specified group is a
# member.
#
# @param object_id [String] The object ID of the group for which to get group
# membership.
# @param parameters [GroupGetMemberGroupsParameters] Group filtering
# parameters.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_member_groups_with_http_info(object_id, parameters, custom_headers:nil)
get_member_groups_async(object_id, parameters, custom_headers:custom_headers).value!
end
#
# Gets a collection of object IDs of groups of which the specified group is a
# member.
#
# @param object_id [String] The object ID of the group for which to get group
# membership.
# @param parameters [GroupGetMemberGroupsParameters] Group filtering
# parameters.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_member_groups_async(object_id, parameters, custom_headers:nil)
fail ArgumentError, 'object_id is nil' if object_id.nil?
fail ArgumentError, 'parameters is nil' if parameters.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
# Serialize Request
request_mapper = Azure::GraphRbac::V1_6::Models::GroupGetMemberGroupsParameters.mapper()
request_content = @client.serialize(request_mapper, parameters)
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
path_template = '{tenantID}/groups/{objectId}/getMemberGroups'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'objectId' => object_id,'tenantID' => @client.tenant_id},
query_params: {'api-version' => @client.api_version},
body: request_content,
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:post, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::GroupGetMemberGroupsResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets a list of groups for the current tenant.
#
# @param next_link [String] Next link for the list operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<ADGroup>] operation results.
#
def list_next(next_link, custom_headers:nil)
response = list_next_async(next_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets a list of groups for the current tenant.
#
# @param next_link [String] Next link for the list operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def list_next_with_http_info(next_link, custom_headers:nil)
list_next_async(next_link, custom_headers:custom_headers).value!
end
#
# Gets a list of groups for the current tenant.
#
# @param next_link [String] Next link for the list operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def list_next_async(next_link, custom_headers:nil)
fail ArgumentError, 'next_link is nil' if next_link.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/{nextLink}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'tenantID' => @client.tenant_id},
skip_encoding_path_params: {'nextLink' => next_link},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::GroupListResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets the members of a group.
#
# @param next_link [String] Next link for the list operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [Array<AADObject>] operation results.
#
def get_group_members_next(next_link, custom_headers:nil)
response = get_group_members_next_async(next_link, custom_headers:custom_headers).value!
response.body unless response.nil?
end
#
# Gets the members of a group.
#
# @param next_link [String] Next link for the list operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
#
def get_group_members_next_with_http_info(next_link, custom_headers:nil)
get_group_members_next_async(next_link, custom_headers:custom_headers).value!
end
#
# Gets the members of a group.
#
# @param next_link [String] Next link for the list operation.
# @param [Hash{String => String}] A hash of custom headers that will be added
# to the HTTP request.
#
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
#
def get_group_members_next_async(next_link, custom_headers:nil)
fail ArgumentError, 'next_link is nil' if next_link.nil?
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
fail ArgumentError, '@client.tenant_id is nil' if @client.tenant_id.nil?
request_headers = {}
request_headers['Content-Type'] = 'application/json; charset=utf-8'
# Set Headers
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
path_template = '{tenantID}/{nextLink}'
request_url = @base_url || @client.base_url
options = {
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
path_params: {'tenantID' => @client.tenant_id},
skip_encoding_path_params: {'nextLink' => next_link},
query_params: {'api-version' => @client.api_version},
headers: request_headers.merge(custom_headers || {}),
base_url: request_url
}
promise = @client.make_request_async(:get, path_template, options)
promise = promise.then do |result|
http_response = result.response
status_code = http_response.status
response_content = http_response.body
unless status_code == 200
error_model = JSON.load(response_content)
fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
end
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
# Deserialize Response
if status_code == 200
begin
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
result_mapper = Azure::GraphRbac::V1_6::Models::GetObjectsResult.mapper()
result.body = @client.deserialize(result_mapper, parsed_response)
rescue Exception => e
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
end
end
result
end
promise.execute
end
#
# Gets list of groups for the current tenant.
#
# @param filter [String] The filter to apply to the operation.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [GroupListResult] which provide lazy access to pages of the response.
#
def list_as_lazy(filter:nil, custom_headers:nil)
response = list_async(filter:filter, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_link|
list_next_async(next_link, custom_headers:custom_headers)
end
page
end
end
#
# Gets the members of a group.
#
# @param object_id [String] The object ID of the group whose members should be
# retrieved.
# @param custom_headers [Hash{String => String}] A hash of custom headers that
# will be added to the HTTP request.
#
# @return [GetObjectsResult] which provide lazy access to pages of the
# response.
#
def get_group_members_as_lazy(object_id, custom_headers:nil)
response = get_group_members_async(object_id, custom_headers:custom_headers).value!
unless response.nil?
page = response.body
page.next_method = Proc.new do |next_link|
get_group_members_next_async(next_link, custom_headers:custom_headers)
end
page
end
end
end
end
| {
"content_hash": "2a50b96d8d328ad8eb280e12f2536c2b",
"timestamp": "",
"source": "github",
"line_count": 1074,
"max_line_length": 129,
"avg_line_length": 39.399441340782126,
"alnum_prop": 0.6560557721848045,
"repo_name": "Azure/azure-sdk-for-ruby",
"id": "f3b888bd35446ba1941584a8e01c15b41846dec4",
"size": "42479",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "data/azure_graph_rbac/lib/1.6/generated/azure_graph_rbac/groups.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "345216400"
},
{
"name": "Shell",
"bytes": "305"
}
],
"symlink_target": ""
} |
module Member::Addon
module GithubOAuth
extend SS::Addon
extend ActiveSupport::Concern
include Member::Addon::BaseOAuth
included do
define_oauth_fields(:github)
end
end
end
| {
"content_hash": "4f5e0f6c408c0f5fb89e12752f1028ef",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 36,
"avg_line_length": 18.545454545454547,
"alnum_prop": 0.696078431372549,
"repo_name": "sunny4381/shirasagi",
"id": "a16b5ed2ab06f304985ab18d0595563d522179be",
"size": "204",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "app/models/concerns/member/addon/github_oauth.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "82226"
},
{
"name": "HTML",
"bytes": "3233606"
},
{
"name": "JavaScript",
"bytes": "11964854"
},
{
"name": "Ruby",
"bytes": "12347543"
},
{
"name": "SCSS",
"bytes": "525875"
},
{
"name": "Shell",
"bytes": "20130"
}
],
"symlink_target": ""
} |
package org.locationtech.geomesa.geojson
import java.io.Closeable
import com.github.benmanes.caffeine.cache.Caffeine
import com.typesafe.scalalogging.LazyLogging
import com.vividsolutions.jts.geom.{Geometry, Point}
import org.geotools.data.{DataStore, FeatureWriter, Query, Transaction}
import org.geotools.factory.Hints
import org.geotools.geojson.geom.GeometryJSON
import org.json4s.native.JsonMethods._
import org.json4s.{JObject, _}
import org.locationtech.geomesa.features.kryo.json.JsonPathParser
import org.locationtech.geomesa.features.kryo.json.JsonPathParser.PathElement
import org.locationtech.geomesa.geojson.query.GeoJsonQuery
import org.locationtech.geomesa.utils.cache.CacheKeyGenerator
import org.locationtech.geomesa.utils.collection.{CloseableIterator, SelfClosingIterator}
import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes
import org.locationtech.geomesa.utils.io.CloseWithLogging
import org.opengis.feature.simple.{SimpleFeature, SimpleFeatureType}
import org.parboiled.errors.ParsingException
import scala.collection.mutable.ArrayBuffer
import scala.util.Try
import scala.util.control.NonFatal
/**
* GeoJSON index backed by a GeoMesa data store.
*
* Note: data store must be disposed of separately
*
* @param ds GeoMesa data store
*/
class GeoJsonGtIndex(ds: DataStore) extends GeoJsonIndex with LazyLogging {
// TODO GEOMESA-1450 support json-schema validation
// TODO GEOMESA-1451 optimize serialization for json-schema
override def createIndex(name: String, id: Option[String], dtg: Option[String], points: Boolean): Unit = {
try {
// validate json-paths
id.foreach(JsonPathParser.parse(_, report = true))
dtg.foreach(JsonPathParser.parse(_, report = true))
} catch {
case NonFatal(e) => throw new IllegalArgumentException("Error parsing paths", e)
}
ds.createSchema(SimpleFeatureTypes.createType(name, GeoJsonGtIndex.spec(id, dtg, points)))
}
override def deleteIndex(name: String): Unit = ds.removeSchema(name)
override def add(name: String, json: String): Seq[String] = {
import org.json4s.native.JsonMethods._
val schema = ds.getSchema(name)
if (schema == null) {
throw new IllegalArgumentException(s"Index $name does not exist - please call 'createIndex'")
}
val features = try { GeoJsonGtIndex.parseFeatures(json) } catch {
case e: IllegalArgumentException => throw e
case NonFatal(e) => throw new IllegalArgumentException(s"Invalid geojson:\n$json", e)
}
val ids = ArrayBuffer.empty[String]
val (getGeom, getId, getDtg) = GeoJsonGtIndex.jsonExtractors(schema)
val writer = ds.getFeatureWriterAppend(name, Transaction.AUTO_COMMIT)
features.foreach { feature =>
try {
val sf = writer.next()
sf.setAttribute(0, compact(render(feature)))
sf.setAttribute(1, getGeom(feature))
getDtg(feature).foreach(sf.setAttribute(2, _))
getId(feature).foreach(sf.getUserData.put(Hints.PROVIDED_FID, _))
writer.write()
ids.append(sf.getID)
} catch {
case NonFatal(e) =>
logger.error(s"Error writing json:\n${Try(compact(render(feature))).getOrElse(feature)}", e)
}
}
writer.close()
ids
}
override def update(name: String, json: String): Unit = {
val schema = ds.getSchema(name)
if (schema == null) {
throw new IllegalArgumentException(s"Index $name does not exist - please call 'createIndex'")
} else if (!schema.getUserData.containsKey(GeoJsonGtIndex.IdPathKey)) {
throw new IllegalArgumentException(s"ID path was not specified - please use `update(String, Seq[String], String)`")
}
val features = try { GeoJsonGtIndex.parseFeatures(json) } catch {
case e: IllegalArgumentException => throw e
case NonFatal(e) => throw new IllegalArgumentException(s"Invalid geojson:\n$json", e)
}
val (_, getId, _) = GeoJsonGtIndex.jsonExtractors(schema)
update(schema, features.flatMap(feature => getId(feature).map(_ -> feature)).toMap)
}
override def update(name: String, ids: Seq[String], json: String): Unit = {
val schema = ds.getSchema(name)
if (schema == null) {
throw new IllegalArgumentException(s"Index $name does not exist - please call 'createIndex'")
}
val features = try { GeoJsonGtIndex.parseFeatures(json) } catch {
case e: IllegalArgumentException => throw e
case NonFatal(e) => throw new IllegalArgumentException(s"Invalid geojson:\n$json", e)
}
if (ids.length != features.length) {
throw new IllegalArgumentException(s"ID mismatch - ids: ${ids.length}, features: ${features.length}")
}
update(schema, ids.zip(features).toMap)
}
private def update(schema: SimpleFeatureType, features: Map[String, JObject]): Unit = {
import org.locationtech.geomesa.filter.ff
val (getGeom, _, getDtg) = GeoJsonGtIndex.jsonExtractors(schema)
val filter = ff.id(features.keys.map(ff.featureId).toSeq: _*)
var writer: FeatureWriter[SimpleFeatureType, SimpleFeature] = null
try {
writer = ds.getFeatureWriter(schema.getTypeName, filter, Transaction.AUTO_COMMIT)
while (writer.hasNext) {
val sf = writer.next()
features.get(sf.getID).foreach { feature =>
sf.setAttribute(0, compact(render(feature)))
sf.setAttribute(1, getGeom(feature))
getDtg(feature).foreach(sf.setAttribute(2, _))
writer.write()
}
}
} finally {
CloseWithLogging(writer)
}
}
override def delete(name: String, ids: Iterable[String]): Unit = {
import org.locationtech.geomesa.filter.ff
var writer: FeatureWriter[SimpleFeatureType, SimpleFeature] = null
try {
writer = ds.getFeatureWriter(name, ff.id(ids.map(ff.featureId).toSeq: _*), Transaction.AUTO_COMMIT)
while (writer.hasNext) {
writer.next()
writer.remove()
}
} finally {
CloseWithLogging(writer)
}
}
override def get(name: String, ids: Iterable[String], transform: Map[String, String]): Iterator[String] with Closeable = {
import org.locationtech.geomesa.filter.ff
val schema = ds.getSchema(name)
if (schema == null) {
throw new IllegalArgumentException(s"Index $name does not exist - please call 'createIndex'")
}
val paths = try { transform.mapValues(JsonPathParser.parse(_)) } catch {
case e: ParsingException => throw new IllegalArgumentException("Invalid attribute json-paths", e)
}
val filter = ff.id(ids.map(ff.featureId).toSeq: _*)
val features = SelfClosingIterator(ds.getFeatureReader(new Query(name, filter), Transaction.AUTO_COMMIT))
val results = features.map(_.getAttribute(0).asInstanceOf[String])
jsonTransform(results, paths)
}
override def query(name: String, query: String, transform: Map[String, String]): Iterator[String] with Closeable = {
val schema = ds.getSchema(name)
if (schema == null) {
throw new IllegalArgumentException(s"Index $name does not exist - please call 'createIndex'")
}
val idPath = GeoJsonGtIndex.getIdPath(schema)
val dtgPath = GeoJsonGtIndex.getDtgPath(schema)
val filter = try { GeoJsonQuery(query).toFilter(idPath, dtgPath) } catch {
case NonFatal(e) => throw new IllegalArgumentException("Invalid query syntax", e)
}
val paths = try { transform.mapValues(JsonPathParser.parse(_)) } catch {
case e: ParsingException => throw new IllegalArgumentException("Invalid attribute json-paths", e)
}
val features = SelfClosingIterator(ds.getFeatureReader(new Query(name, filter), Transaction.AUTO_COMMIT))
val results = features.map(_.getAttribute(0).asInstanceOf[String])
jsonTransform(results, paths)
}
private def jsonTransform(features: CloseableIterator[String],
transform: Map[String, Seq[PathElement]]): Iterator[String] with Closeable = {
if (transform.isEmpty) { features } else {
// recursively construct a json object
def toObj(path: Seq[String], value: JValue): JValue = {
if (path.isEmpty) { value } else {
JObject((path.head, toObj(path.tail, value)))
}
}
val splitPaths = transform.map { case (k, p) => (k.split('.'), p) }
features.map { j =>
val obj = parse(j).asInstanceOf[JObject]
val elems = splitPaths.flatMap { case (key, path) =>
GeoJsonGtIndex.evaluatePath(obj, path).map { jvalue => JObject((key.head, toObj(key.tail, jvalue))) }
}
// merge each transform result together into one object
compact(render(elems.reduceLeftOption(_ merge _).getOrElse(JObject())))
}
}
}
}
object GeoJsonGtIndex {
val IdPathKey = s"${SimpleFeatureTypes.InternalConfigs.GEOMESA_PREFIX}json.id"
val DtgPathKey = s"${SimpleFeatureTypes.InternalConfigs.GEOMESA_PREFIX}json.dtg"
private type ExtractGeometry = (JObject) => Geometry
private type ExtractId = (JObject) => Option[String]
private type ExtractDate = (JObject) => Option[AnyRef]
private type JsonExtractors = (ExtractGeometry, ExtractId, ExtractDate)
private val jsonGeometry = new GeometryJSON()
private val extractorCache = Caffeine.newBuilder().build[String, JsonExtractors]()
/**
* Gets a simple feature type spec. NOTE: the following attribute indices are assumed:
* 0: json
* 1: geometry
* 2: date (if defined)
*
* @param idPath json-path to select a feature ID from an input geojson feature
* @param dtgPath json-path to select a date from an input geojson feature
* dates must be convertable to java.lang.Date by geotools Converters
* @param points store points (or centroids) of input geojson, or store complex geometries with extents
* @return simple feature type spec
*/
private def spec(idPath: Option[String], dtgPath: Option[String], points: Boolean): String = {
val geomType = if (points) { "Point" } else { "Geometry" }
val spec = new StringBuilder(s"json:String:json=true,*geom:$geomType:srid=4326")
if (dtgPath.isDefined) {
spec.append(",dtg:Date")
}
val mixedGeoms = if (points) { Seq.empty } else { Seq(s"${SimpleFeatureTypes.Configs.MIXED_GEOMETRIES}='true'") }
val id = idPath.map(p => s"$IdPathKey='$p'")
val dtg = dtgPath.map(p => s"$DtgPathKey='$p'")
val userData = (mixedGeoms ++ id ++ dtg).mkString(";", ",", "")
spec.append(userData)
spec.toString
}
/**
* Creates functions for extracting data from parsed geojson features
*
* @param schema simple feature type
* @return (method to get geometry, method to get feature ID, method to get date)
*/
private def jsonExtractors(schema: SimpleFeatureType): JsonExtractors = {
def load(): JsonExtractors = {
import org.locationtech.geomesa.utils.geotools.RichSimpleFeatureType.RichSimpleFeatureType
val getGeom: (JObject) => Geometry =
if (schema.isPoints) {
(feature) => getGeometry(feature) match {
case p: Point => p
case g: Geometry => g.getCentroid
case null => null
}
} else {
getGeometry
}
val getId: (JObject) => Option[String] = getIdPath(schema) match {
case None => (_) => None
case Some(path) => (feature) => evaluatePathValue(feature, path).map(_.toString)
}
val getDtg: (JObject) => Option[AnyRef] = getDtgPath(schema) match {
case None => (_) => None
case Some(path) => (feature) => evaluatePathValue(feature, path)
}
(getGeom, getId, getDtg)
}
val loader = new java.util.function.Function[String, JsonExtractors] {
override def apply(ignored: String): JsonExtractors = load()
}
extractorCache.get(CacheKeyGenerator.cacheKey(schema), loader)
}
private def getIdPath(schema: SimpleFeatureType): Option[Seq[PathElement]] =
Option(schema.getUserData.get(IdPathKey).asInstanceOf[String]).map(JsonPathParser.parse(_))
private def getDtgPath(schema: SimpleFeatureType): Option[Seq[PathElement]] =
Option(schema.getUserData.get(DtgPathKey).asInstanceOf[String]).map(JsonPathParser.parse(_))
/**
* Parses a geojson string and returns the feature objects. Will accept either
* a single feature or a feature collection.
*
* @param json geojson string to parse
* @return parsed feature objects
*/
private def parseFeatures(json: String): Seq[JObject] = {
import org.json4s._
import org.json4s.native.JsonMethods._
val parsed = parse(json) match {
case j: JObject => j
case _ => throw new IllegalArgumentException("Invalid input - expected JSON object")
}
getByKey(parsed, "type").map(_.values) match {
case Some("Feature") => Seq(parsed)
case Some("FeatureCollection") =>
val features = getByKey(parsed, "features")
features.collect { case j: JArray => j.arr.asInstanceOf[List[JObject]] }.getOrElse(List.empty)
case t =>
throw new IllegalArgumentException(s"Invalid input type '${t.orNull}' - expected [Feature, FeatureCollection]")
}
}
/**
* Gets the geometry from a geojson feature object
*
* @param feature geojson feature object
* @return geometry, if present
*/
private def getGeometry(feature: JObject): Geometry =
getByKey(feature, "geometry").map(g => jsonGeometry.read(compact(render(g)))).orNull
/**
* Gets a value from a json object by it's key
*
* @param o json object
* @param key key to lookup
* @return value if present
*/
private def getByKey(o: JObject, key: String): Option[JValue] = {
import org.locationtech.geomesa.utils.conversions.ScalaImplicits.RichIterator
o.obj.toIterator.collect { case (k, v) if k == key => v }.headOption
}
/**
* Evaluate a json path against a json object
*
* @param json parsed json object
* @param path sequence of parsed json path elements
* @return matched value, if any
*/
private def evaluatePathValue(json: JObject, path: Seq[PathElement]): Option[AnyRef] = {
def renderValue(jval: JValue): AnyRef = jval match {
case j: JObject => compact(render(j))
case j: JArray => j.arr.map(renderValue)
case j: JValue => j.values.asInstanceOf[AnyRef]
}
evaluatePath(json, path).map(renderValue)
}
/**
* Evaluate a json path against a json object
*
* @param json parsed json object
* @param path sequence of parsed json path elements
* @return matched element, if any
*/
private def evaluatePath(json: JObject, path: Seq[PathElement]): Option[JValue] = {
import org.locationtech.geomesa.features.kryo.json.JsonPathParser._
var selected: Seq[JValue] = Seq(json)
path.foreach {
case PathAttribute(name) =>
selected = selected.flatMap {
case j: JObject => j.obj.collect { case (n, v) if n == name => v }
case _ => Seq.empty
}
case PathIndex(index: Int) =>
selected = selected.flatMap {
case j: JArray if j.arr.length > index => Seq(j.arr(index))
case _ => Seq.empty
}
case PathIndices(indices: Seq[Int]) =>
selected = selected.flatMap {
case j: JArray => indices.flatMap(i => if (j.arr.length > i) Option(j.arr(i)) else None)
case _ => Seq.empty
}
case PathAttributeWildCard =>
selected = selected.flatMap {
case j: JArray => j.arr
case _ => Seq.empty
}
case PathIndexWildCard =>
selected = selected.flatMap {
case j: JObject => j.obj.map(_._2)
case _ => Seq.empty
}
case PathFunction(function) => throw new NotImplementedError("Path functions not implemented")
case PathDeepScan => throw new NotImplementedError("Deep scan not implemented")
}
selected.headOption
}
}
| {
"content_hash": "d0f6cefa34007e0af3e5a8700838d28d",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 124,
"avg_line_length": 37.14418604651163,
"alnum_prop": 0.6705484598046582,
"repo_name": "nagavallia/geomesa",
"id": "f59ec7de6f75d57dfd43cf9a9acf2aa994c1b0cb",
"size": "16431",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "geomesa-geojson/geomesa-geojson-api/src/main/scala/org/locationtech/geomesa/geojson/GeoJsonGtIndex.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "106628"
},
{
"name": "JavaScript",
"bytes": "140"
},
{
"name": "Python",
"bytes": "6257"
},
{
"name": "R",
"bytes": "2716"
},
{
"name": "Scala",
"bytes": "5188006"
},
{
"name": "Scheme",
"bytes": "1516"
},
{
"name": "Shell",
"bytes": "107751"
}
],
"symlink_target": ""
} |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="es_CL" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About SPEC</source>
<translation>Sobre SPEC</translation>
</message>
<message>
<location line="+39"/>
<source><b>SPEC</b> version</source>
<translation><b>SPEC</b> - versión </translation>
</message>
<message>
<location line="+57"/>
<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>
Este es un software experimental.
Distribuido bajo la licencia MIT/X11, vea el archivo adjunto
COPYING o http://www.opensource.org/licenses/mit-license.php.
Este producto incluye software desarrollado por OpenSSL Project para su uso en
el OpenSSL Toolkit (http://www.openssl.org/), software criptográfico escrito por
Eric Young ([email protected]) y UPnP software escrito por Thomas Bernard.</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The SPEC developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Guia de direcciones</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Haz doble clic para editar una dirección o etiqueta</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Crea una nueva dirección</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Copia la dirección seleccionada al portapapeles</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Nueva dirección</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your SPEC 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>Estas son tus direcciones SPEC para recibir pagos. Puedes utilizar una diferente por cada persona emisora para saber quien te está pagando.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Copia dirección</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Mostrar Código &QR </translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a SPEC address</source>
<translation>Firmar un mensaje para provar que usted es dueño de esta dirección</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Firmar Mensaje</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Exportar los datos de la pestaña actual a un archivo</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified SPEC 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>&Borrar</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your SPEC addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Copia &etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Editar</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Exporta datos de la guia de direcciones</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Archivos separados por coma (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Exportar errores</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>No se pudo escribir al archivo %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Etiqueta</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Dirección</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(sin etiqueta)</translation>
</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>Introduce contraseña actual </translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Nueva contraseña</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Repite nueva contraseña:</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase 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>Introduce la nueva contraseña para la billetera.<br/>Por favor utiliza un contraseña <b>de 10 o mas caracteres aleatorios</b>, u <b>ocho o mas palabras</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Codificar billetera</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Esta operación necesita la contraseña para desbloquear la billetera.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Desbloquea billetera</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Esta operación necesita la contraseña para decodificar la billetara.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Decodificar cartera</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Cambia contraseña</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Introduce la contraseña anterior y la nueva de cartera</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Confirma la codificación de cartera</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR SPECS</b>!</source>
<translation>Atención: ¡Si codificas tu billetera y pierdes la contraseña perderás <b>TODOS TUS SPECS</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>¿Seguro que quieres seguir codificando la billetera?</translation>
</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="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Precaucion: Mayúsculas Activadas</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Billetera codificada</translation>
</message>
<message>
<location line="-56"/>
<source>SPEC will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your specs from being stolen by malware infecting your computer.</source>
<translation>SPEC se cerrará para finalizar el proceso de encriptación. Recuerde que encriptar su billetera no protegera completatamente sus specs de ser robados por malware que infecte su computador</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Falló la codificación de la billetera</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>La codificación de la billetera falló debido a un error interno. Tu billetera no ha sido codificada.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Las contraseñas no coinciden.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Ha fallado el desbloqueo de la billetera</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>La contraseña introducida para decodificar la billetera es incorrecta.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Ha fallado la decodificación de la billetera</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>La contraseña de billetera ha sido cambiada con éxito.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>Firmar &Mensaje...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Sincronizando con la red...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Vista general</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Muestra una vista general de la billetera</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Transacciónes</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Explora el historial de transacciónes</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Edita la lista de direcciones y etiquetas almacenadas</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Muestra la lista de direcciónes utilizadas para recibir pagos</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>&Salir</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Salir del programa</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about SPEC</source>
<translation>Muestra información acerca de SPEC</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Acerca de</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Mostrar Información sobre QT</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Opciones</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Codificar la billetera...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Respaldar billetera...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Cambiar la contraseña...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-347"/>
<source>Send coins to a SPEC address</source>
<translation>Enviar monedas a una dirección spec</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for SPEC</source>
<translation>Modifica las opciones de configuración de spec</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Respaldar billetera en otra ubicación</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Cambiar la contraseña utilizada para la codificación de la billetera</translation>
</message>
<message>
<location line="+6"/>
<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="-4"/>
<source>&Verify message...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>SPEC</source>
<translation>SPEC</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Cartera</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>&About SPEC</source>
<translation>&Sobre SPEC</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Mostrar/Ocultar</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your SPEC addresses to prove you own them</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified SPEC addresses</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Archivo</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Configuración</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Ayuda</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Barra de pestañas</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[red-de-pruebas]</translation>
</message>
<message>
<location line="+47"/>
<source>SPEC client</source>
<translation>Cliente SPEC</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to SPEC network</source>
<translation><numerusform>%n conexión activa hacia la red SPEC</numerusform><numerusform>%n conexiones activas hacia la red SPEC</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+70"/>
<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="-140"/>
<source>Up to date</source>
<translation>Actualizado</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Recuperando...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Transacción enviada</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Transacción entrante</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Fecha: %1
Cantidad: %2
Tipo: %3
Dirección: %4</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid SPEC address or malformed URI parameters.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>La billetera esta <b>codificada</b> y actualmente <b>desbloqueda</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>La billetera esta <b>codificada</b> y actualmente <b>bloqueda</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. SPEC can no longer continue safely and will quit.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Editar dirección</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Etiqueta</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>La etiqueta asociada con esta entrada de la libreta de direcciones</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Dirección</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>La dirección asociada con esta entrada en la libreta de direcciones. Solo puede ser modificada para direcciónes de envío.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Nueva dirección para recibir</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Nueva dirección para enviar</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Editar dirección de recepción</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Editar dirección de envio</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>La dirección introducida "%1" ya esta guardada en la libreta de direcciones.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid SPEC address.</source>
<translation>La dirección introducida "%1" no es una dirección SPEC valida.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>No se pudo desbloquear la billetera.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>La generación de nueva clave falló.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>SPEC-Qt</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versión</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Uso:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>UI opciones</translation>
</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>Arranca minimizado
</translation>
</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>Opciones</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Principal</translation>
</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.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Comisión de &transacciónes</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start SPEC after logging in to the system.</source>
<translation>Inicia SPEC automáticamente despues de encender el computador</translation>
</message>
<message>
<location line="+3"/>
<source>&Start SPEC on system login</source>
<translation>&Inicia SPEC al iniciar el sistema</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>Automatically open the SPEC client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Abre automáticamente el puerto del cliente SPEC en el router. Esto funciona solo cuando tu router es compatible con UPnP y está habilitado.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Direcciona el puerto usando &UPnP</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the SPEC network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Conecta a la red SPEC a través de un proxy SOCKS (ej. cuando te conectas por la red Tor)</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Conecta a traves de un proxy SOCKS:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>&IP Proxy:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Dirección IP del servidor proxy (ej. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Puerto:</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Puerto del servidor proxy (ej. 9050)</translation>
</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>Muestra solo un ícono en la bandeja después de minimizar la ventana</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Minimiza a la bandeja en vez de la barra de tareas</translation>
</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>Minimiza la ventana en lugar de salir del programa cuando la ventana se cierra. Cuando esta opción esta activa el programa solo se puede cerrar seleccionando Salir desde el menu.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>M&inimiza a la bandeja al cerrar</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Mostrado</translation>
</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 SPEC.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>&Unidad en la que mostrar cantitades:</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Elige la subdivisión por defecto para mostrar cantidaded en la interfaz cuando se envien monedas</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show SPEC addresses in the transaction list or not.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Muestra direcciones en el listado de transaccioines</translation>
</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="+53"/>
<source>default</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Atención</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting SPEC.</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>Formulario</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the SPEC network after a connection is established, but this process has not completed yet.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>No confirmados:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Cartera</translation>
</message>
<message>
<location line="+107"/>
<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="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Transacciones recientes</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Tu saldo actual</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Total de transacciones que no han sido confirmadas aun, y que no cuentan para el saldo actual.</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start spec: click-to-pay handler</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>Solicitar Pago</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Cantidad:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Etiqueta</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Mensaje:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Guardar Como...</translation>
</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>Imágenes PNG (*.png)</translation>
</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="+339"/>
<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 SPEC-Qt help message to get a list with possible SPEC 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>SPEC - Debug window</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+25"/>
<source>SPEC 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 SPEC 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="-30"/>
<source>Welcome to the SPEC 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="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Enviar monedas</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Enviar a múltiples destinatarios</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>&Agrega destinatario</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Remover todos los campos de la transacción</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>&Borra todos</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Balance:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123.456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Confirma el envio</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Envía</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> to %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Confirmar el envio de monedas</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Estas seguro que quieres enviar %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation>y</translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>La dirección de destinatarion no es valida, comprueba otra vez.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>La cantidad por pagar tiene que ser mayor 0.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>La cantidad sobrepasa tu saldo.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>El total sobrepasa tu saldo cuando se incluyen %1 como tasa de envio.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Tienes una dirección duplicada, solo puedes enviar a direcciónes individuales de una sola vez.</translation>
</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>Error: La transacción fue rechazada. Esto puede haber ocurrido si alguna de las monedas ya estaba gastada o si ha usado una copia de wallet.dat y las monedas se gastaron en la copia pero no se han marcado como gastadas aqui.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Envio</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>Cantidad:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>&Pagar a:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Introduce una etiqueta a esta dirección para añadirla a tu guia</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Etiqueta:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Elije dirección de la guia</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Pega dirección desde portapapeles</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Elimina destinatario</translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a SPEC address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Introduce una dirección SPEC (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</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"/>
<source>&Sign Message</source>
<translation>&Firmar Mensaje</translation>
</message>
<message>
<location line="+6"/>
<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. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Introduce una dirección SPEC (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Elije dirección de la guia</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Pega dirección desde portapapeles</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Escriba el mensaje que desea firmar</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<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 SPEC address</source>
<translation>Firmar un mensjage para probar que usted es dueño de esta dirección</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>&Borra todos</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<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. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Introduce una dirección SPEC (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified SPEC address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation type="unfinished"/>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a SPEC address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Introduce una dirección SPEC (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Click en "Firmar Mensage" para conseguir firma</translation>
</message>
<message>
<location line="+3"/>
<source>Enter SPEC 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>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The SPEC developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[red-de-pruebas]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Abierto hasta %1</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/fuera de linea</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/no confirmado</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 confirmaciónes</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Estado</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Fecha</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generado</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>De</translation>
</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>etiqueta</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Credito</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>no aceptada</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debito</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Comisión transacción</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Cantidad total</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Mensaje</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Comentario</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>ID de Transacción</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 44 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>Las monedas generadas deben esperar 44 bloques antes de ser gastadas. Cuando has generado este bloque se emitió a la red para ser agregado en la cadena de bloques. Si falla al incluirse en la cadena, cambiará a "no aceptado" y las monedas no se podrán gastar. Esto puede ocurrir ocasionalmente si otro nodo genera un bloque casi al mismo tiempo que el tuyo.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Transacción</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Cantidad</translation>
</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="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, no ha sido emitido satisfactoriamente todavía</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>desconocido</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Detalles de transacción</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Esta ventana muestra información detallada sobre la transacción</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Fecha</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Dirección</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Cantidad</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Abierto hasta %1</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Fuera de linea (%1 confirmaciónes)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>No confirmado (%1 de %2 confirmaciónes)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Confirmado (%1 confirmaciones)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Este bloque no ha sido recibido por otros nodos y probablemente no sea aceptado !</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generado pero no acceptado</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Recibido con</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Recibido de</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Enviado a</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Pagar a usted mismo</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Minado</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(n/a)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Estado de transacción. Pasa el raton sobre este campo para ver el numero de confirmaciónes.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Fecha y hora cuando se recibió la transaccion</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Tipo de transacción.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Dirección de destino para la transacción</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Cantidad restada o añadida al balance</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Todo</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Hoy</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Esta semana</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Esta mes</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Mes pasado</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Este año</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Rango...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Recibido con</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Enviado a</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>A ti mismo</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Minado</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Otra</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Introduce una dirección o etiqueta para buscar</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Cantidad minima</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Copia dirección</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Copia etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Copiar Cantidad</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Edita etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Exportar datos de transacción</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Archivos separados por coma (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Confirmado</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Fecha</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Tipo</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Etiqueta</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Dirección</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Cantidad</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Error exportando</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>No se pudo escribir en el archivo %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Rango:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>para</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Enviar monedas</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Exportar los datos de la pestaña actual a un archivo</translation>
</message>
<message>
<location line="+193"/>
<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>
<location line="+4"/>
<source>Backup Successful</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>SPEC version</source>
<translation>Versión SPEC</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Uso:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or specd</source>
<translation>Envia comando a spec lanzado con -server u specd
</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Muestra comandos
</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Recibir ayuda para un comando
</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Opciones:
</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: spec.conf)</source>
<translation>Especifica archivo de configuración (predeterminado: spec.conf)
</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: specd.pid)</source>
<translation>Especifica archivo pid (predeterminado: spec.pid)
</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Especifica directorio para los datos
</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 4319 or testnet: 14319)</source>
<translation>Escuchar por conecciones en <puerto> (Por defecto: 4319 o red de prueba: 14319)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Mantener al menos <n> conecciones por cliente (por defecto: 125) </translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Umbral de desconección de clientes con mal comportamiento (por defecto: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 4320 or testnet: 14320)</source>
<translation>Escucha conexiones JSON-RPC en el puerto <port> (predeterminado: 4320 or testnet: 14320)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Aceptar comandos consola y JSON-RPC
</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Correr como demonio y acepta comandos
</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Usa la red de pruebas
</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=specrpc
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 "SPEC Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<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="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. SPEC is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<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="+4"/>
<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="+3"/>
<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>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Precaución: -paytxfee es muy alta. Esta es la comisión que pagarás si envias una transacción.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong SPEC will not work properly.</source>
<translation>Precaución: Por favor revise que la fecha y hora de tu ordenador son correctas. Si tu reloj está mal configurado SPEC no funcionará correctamente.</translation>
</message>
<message>
<location line="+3"/>
<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="+3"/>
<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="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Conecta solo al nodo especificado
</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Dirección -tor invalida: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<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="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Adjuntar informacion extra de depuracion. Implies all other -debug* options</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Anteponer salida de depuracion con marca de tiempo</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the SPEC Wiki for SSL setup instructions)</source>
<translation>Opciones SSL: (ver la SPEC Wiki para instrucciones de configuración SSL)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Enviar informacion de seguimiento a la consola en vez del archivo debug.log</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Enviar informacion de seguimiento al depurador</translation>
</message>
<message>
<location line="+5"/>
<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="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Especifica tiempo de espera para conexion en milisegundos (predeterminado: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Intenta usar UPnP para mapear el puerto de escucha (default: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Intenta usar UPnP para mapear el puerto de escucha (default: 1 when listening)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Usuario para las conexiones JSON-RPC
</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Contraseña para las conexiones JSON-RPC
</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Permite conexiones JSON-RPC desde la dirección IP especificada
</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Envia comando al nodo situado en <ip> (predeterminado: 127.0.0.1)
</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Actualizar billetera al formato actual</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Ajusta el numero de claves en reserva <n> (predeterminado: 100)
</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Rescanea la cadena de bloques para transacciones perdidas de la cartera
</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Usa OpenSSL (https) para las conexiones JSON-RPC
</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Certificado del servidor (Predeterminado: server.cert)
</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Clave privada del servidor (Predeterminado: server.pem)
</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Cifrados aceptados (Predeterminado: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)
</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Este mensaje de ayuda
</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>No es posible escuchar en el %s en este ordenador (bind returned error %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Conecta mediante proxy socks</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Permite búsqueda DNS para addnode y connect
</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Cargando direcciónes...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Error cargando wallet.dat: Billetera corrupta</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of SPEC</source>
<translation>Error cargando wallet.dat: Billetera necesita una vercion reciente de SPEC</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart SPEC to complete</source>
<translation>La billetera necesita ser reescrita: reinicie SPEC para completar</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Error cargando wallet.dat</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Dirección -proxy invalida: '%s'</translation>
</message>
<message>
<location line="+56"/>
<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="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>Cantidad inválida para -paytxfee=<amount>: '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Cantidad inválida</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Fondos insuficientes</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Cargando el index de bloques...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Agrega un nodo para conectarse and attempt to keep the connection open</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. SPEC is probably already running.</source>
<translation>No es posible escuchar en el %s en este ordenador. Probablemente SPEC ya se está ejecutando.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Comisión por kB para adicionarla a las transacciones enviadas</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Cargando cartera...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Rescaneando...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Carga completa</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location line="-31"/>
<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": "eb6f3953b2cfe91fa4e8978c587c74ed",
"timestamp": "",
"source": "github",
"line_count": 2952,
"max_line_length": 402,
"avg_line_length": 36.078252032520325,
"alnum_prop": 0.6114381754504568,
"repo_name": "noise23/spec-wallet",
"id": "0da40c5aa30ddad461c6d8605bed72c18f532c38",
"size": "106659",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/qt/locale/bitcoin_es_CL.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "32790"
},
{
"name": "C++",
"bytes": "2605069"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "Groff",
"bytes": "18284"
},
{
"name": "HTML",
"bytes": "50615"
},
{
"name": "Makefile",
"bytes": "13356"
},
{
"name": "NSIS",
"bytes": "5840"
},
{
"name": "Objective-C",
"bytes": "1052"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "69694"
},
{
"name": "QMake",
"bytes": "14698"
},
{
"name": "Shell",
"bytes": "15607"
}
],
"symlink_target": ""
} |
<a href='http://github.com/angular/angular.js/edit/master/docs/content/tutorial/step_00.ngdoc' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit"> </i>Improve this doc</a>
<ul doc-tutorial-nav="0"></ul>
<p>You are now ready to build the AngularJS phonecat app. In this step, you will become familiar
with the most important source code files, learn how to start the development servers bundled with
angular-seed, and run the application in the browser.</p>
<p>In <code>angular-phonecat</code> directory, run this command:</p>
<pre><code>git checkout -f step-0</code></pre>
<p>This resets your workspace to step 0 of the tutorial app.</p>
<p>You must repeat this for every future step in the tutorial and change the number to the number of
the step you are on. This will cause any changes you made within your working directory to be lost.</p>
<p>If you haven't already done so you need to install the dependencies by running:</p>
<pre><code>npm install</code></pre>
<p>To see the app running in a browser, open a <em>separate</em> terminal/command line tab or window, then
run <code>npm start</code> to start the web server. Now, open a browser window for the app and navigate to
<a href="http://localhost:8000/app/index.html" target="_blank"><code>http://localhost:8000/app/index.html</code></a></p>
<p>You can now see the page in your browser. It's not very exciting, but that's OK.</p>
<p>The HTML page that displays "Nothing here yet!" was constructed with the HTML code shown below.
The code contains some key Angular elements that we will need as we progress.</p>
<p><strong><code>app/index.html</code>:</strong></p>
<pre><code class="lang-html"><!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>My HTML File</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css">
<link rel="stylesheet" href="css/app.css">
<script src="bower_components/angular/angular.js"></script>
</head>
<body>
<p>Nothing here {{'yet' + '!'}}</p>
</body>
</html></code></pre>
<h2 id="what-is-the-code-doing-">What is the code doing?</h2>
<ul>
<li><p><code>ng-app</code> directive:</p>
<pre><code> <html ng-app></code></pre>
<p>The <code>ng-app</code> attribute represents an Angular directive named <code>ngApp</code> (Angular uses
<code>name-with-dashes</code> for its custom attributes and <code>camelCase</code> for the corresponding directives
which implement them).
This directive is used to flag the html element that Angular should consider to be the root element
of our application.
This gives application developers the freedom to tell Angular if the entire html page or only a
portion of it should be treated as the Angular application.</p>
</li>
<li><p>AngularJS script tag:</p>
<pre><code> <script src="bower_components/angular/angular.js"></code></pre>
<p>This code downloads the <code>angular.js</code> script and registers a callback that will be executed by the
browser when the containing HTML page is fully downloaded. When the callback is executed, Angular
looks for the <a href="api/ng/directive/ngApp">ngApp</a> directive. If
Angular finds the directive, it will bootstrap the application with the root of the application DOM
being the element on which the <code>ngApp</code> directive was defined.</p>
</li>
<li><p>Double-curly binding with an expression:</p>
<pre><code> Nothing here {{'yet' + '!'}}</code></pre>
<p>This line demonstrates the core feature of Angular's templating capabilities – a binding, denoted
by double-curlies <code>{{ }}</code> as well as a simple expression <code>'yet' + '!'</code> used in this binding.</p>
<p>The binding tells Angular that it should evaluate an expression and insert the result into the
DOM in place of the binding. Rather than a one-time insert, as we'll see in the next steps, a
binding will result in efficient continuous updates whenever the result of the expression
evaluation changes.</p>
<p><a href="guide/expression">Angular expression</a> is a JavaScript-like code snippet that is
evaluated by Angular in the context of the current model scope, rather than within the scope of
the global context (<code>window</code>).</p>
<p>As expected, once this template is processed by Angular, the html page contains the text:
"Nothing here yet!".</p>
</li>
</ul>
<h2 id="bootstrapping-angularjs-apps">Bootstrapping AngularJS apps</h2>
<p>Bootstrapping AngularJS apps automatically using the <code>ngApp</code> directive is very easy and suitable
for most cases. In advanced cases, such as when using script loaders, you can use
<a href="guide/bootstrap">imperative / manual way</a> to bootstrap the app.</p>
<p>There are 3 important things that happen during the app bootstrap:</p>
<ol>
<li><p>The <a href="api/auto/service/$injector">injector</a> that will be used for dependency injection is created.</p>
</li>
<li><p>The injector will then create the <a href="api/ng/service/$rootScope">root scope</a> that will
become the context for the model of our application.</p>
</li>
<li><p>Angular will then "compile" the DOM starting at the <code>ngApp</code> root element, processing any
directives and bindings found along the way.</p>
</li>
</ol>
<p>Once an application is bootstrapped, it will then wait for incoming browser events (such as mouse
click, key press or incoming HTTP response) that might change the model. Once such an event occurs,
Angular detects if it caused any model changes and if changes are found, Angular will reflect them
in the view by updating all of the affected bindings.</p>
<p>The structure of our application is currently very simple. The template contains just one directive
and one static binding, and our model is empty. That will soon change!</p>
<p><img class="diagram" src="img/tutorial/tutorial_00.png"></p>
<h2 id="what-are-all-these-files-in-my-working-directory-">What are all these files in my working directory?</h2>
<p>Most of the files in your working directory come from the <a href="https://github.com/angular/angular-seed">angular-seed project</a> which
is typically used to bootstrap new Angular projects. The seed project is pre-configured to install
the angular framework (via <code>bower</code> into the <code>app/bower_components/</code> folder) and tools for developing
a typical web app (via <code>npm</code>).</p>
<p>For the purposes of this tutorial, we modified the angular-seed with the following changes:</p>
<ul>
<li>Removed the example app</li>
<li>Added phone images to <code>app/img/phones/</code></li>
<li>Added phone data files (JSON) to <code>app/phones/</code></li>
<li>Added a dependency on <a href="http://getbootstrap.com">Bootstrap</a> in the <code>bower.json</code> file.</li>
</ul>
<h1 id="experiments">Experiments</h1>
<ul>
<li><p>Try adding a new expression to the <code>index.html</code> that will do some math:</p>
<pre><code> <p>1 + 2 = {{ 1 + 2 }}</p></code></pre>
</li>
</ul>
<h1 id="summary">Summary</h1>
<p>Now let's go to <a href="tutorial/step_01">step 1</a> and add some content to the web app.</p>
<ul doc-tutorial-nav="0"></ul>
| {
"content_hash": "1575ab99572586bce489b962f809b992",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 198,
"avg_line_length": 61.525,
"alnum_prop": 0.7362860625761886,
"repo_name": "leandrooriente/racha-conta",
"id": "4d0bb85f0347aeed13a42a96e6fdc9d24b0a859d",
"size": "7385",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "src/libs/angular/docs/partials/tutorial/step_00.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "359323"
},
{
"name": "CoffeeScript",
"bytes": "1421"
},
{
"name": "JavaScript",
"bytes": "184879"
},
{
"name": "PHP",
"bytes": "707"
},
{
"name": "Perl",
"bytes": "10763"
},
{
"name": "Python",
"bytes": "3523"
},
{
"name": "Scala",
"bytes": "456"
},
{
"name": "Shell",
"bytes": "128"
}
],
"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/menu_item_share"
android:icon="@drawable/ic_share_dark"
android:title="@string/share_title"
app:showAsAction="ifRoom" />
<item
android:id="@+id/menu_item_edit"
android:icon="@drawable/ic_edit"
android:title="@string/profile_edit_menu_item"
app:showAsAction="ifRoom" />
<item
android:id="@+id/menu_item_settings"
android:icon="@drawable/ic_settings_dark"
android:title="@string/profile_settings_menu_item"
app:showAsAction="ifRoom" />
</menu> | {
"content_hash": "3d4ac390bbb6a07601724e45b36dc6d5",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 62,
"avg_line_length": 33.59090909090909,
"alnum_prop": 0.6224627875507442,
"repo_name": "StepicOrg/stepik-android",
"id": "c172c9b902eb8ed1256ae875b88346948607bc8c",
"size": "739",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "app/src/main/res/menu/profile_menu.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "5482"
},
{
"name": "Java",
"bytes": "1001894"
},
{
"name": "Kotlin",
"bytes": "4272355"
},
{
"name": "Prolog",
"bytes": "98"
},
{
"name": "Shell",
"bytes": "618"
}
],
"symlink_target": ""
} |
(function($){
function buildGrid(target){
var opts = $.data(target, 'edatagrid').options;
$(target).datagrid($.extend({}, opts, {
onDblClickCell:function(index,field){
if (opts.editing){
$(this).edatagrid('editRow', index);
focusEditor(field);
}
},
onClickCell:function(index,field){
if (opts.editing && opts.editIndex >= 0){
$(this).edatagrid('editRow', index);
focusEditor(field);
}
},
onAfterEdit: function(index, row){
opts.editIndex = undefined;
var url = row.isNewRecord ? opts.saveUrl : opts.updateUrl;
if (url){
$.post(url, row, function(data){
data.isNewRecord = null;
$(target).datagrid('updateRow', {
index: index,
row: data
});
if (opts.tree){
var t = $(opts.tree);
var node = t.tree('find', row.id);
if (node){
node.text = row[opts.treeTextField];
t.tree('update', node);
} else {
var pnode = t.tree('find', row[opts.treeParentField]);
t.tree('append', {
parent: (pnode ? pnode.target : null),
data: [{id:row.id,text:row[opts.treeTextField]}]
});
}
}
opts.onSave.call(target, index, row);
},'json');
}
if (opts.onAfterEdit) opts.onAfterEdit.call(target, index, row);
},
onCancelEdit: function(index, row){
opts.editIndex = undefined;
if (row.isNewRecord) {
$(this).datagrid('deleteRow', index);
}
if (opts.onCancelEdit) opts.onCancelEdit.call(target, index, row);
},
onBeforeLoad: function(param){
$(this).datagrid('rejectChanges');
if (opts.tree){
var node = $(opts.tree).tree('getSelected');
param[opts.treeParentField] = node ? node.id : undefined;
}
if (opts.onBeforeLoad) opts.onBeforeLoad.call(target, param);
}
}));
function focusEditor(field){
var editor = $(target).datagrid('getEditor', {index:opts.editIndex,field:field});
if (editor){
editor.target.focus();
} else {
var editors = $(target).datagrid('getEditors', opts.editIndex);
if (editors.length){
editors[0].target.focus();
}
}
}
if (opts.tree){
$(opts.tree).tree({
url: opts.treeUrl,
onClick: function(node){
$(target).datagrid('load');
},
onDrop: function(dest,source,point){
var targetId = $(this).tree('getNode', dest).id;
$.ajax({
url: opts.treeDndUrl,
type:'post',
data:{
id:source.id,
targetId:targetId,
point:point
},
dataType:'json',
success:function(){
$(target).datagrid('load');
}
});
}
});
}
}
$.fn.edatagrid = function(options, param){
if (typeof options == 'string'){
var method = $.fn.edatagrid.methods[options];
if (method){
return method(this, param);
} else {
return this.datagrid(options, param);
}
}
options = options || {};
return this.each(function(){
var state = $.data(this, 'edatagrid');
if (state){
$.extend(state.options, options);
} else {
$.data(this, 'edatagrid', {
options: $.extend({}, $.fn.edatagrid.defaults, $.fn.edatagrid.parseOptions(this), options)
});
}
buildGrid(this);
});
};
$.fn.edatagrid.parseOptions = function(target){
return $.extend({}, $.fn.datagrid.parseOptions(target), {
});
};
$.fn.edatagrid.methods = {
options: function(jq){
var opts = $.data(jq[0], 'edatagrid').options;
return opts;
},
enableEditing: function(jq){
return jq.each(function(){
var opts = $.data(this, 'edatagrid').options;
opts.editing = true;
});
},
disableEditing: function(jq){
return jq.each(function(){
var opts = $.data(this, 'edatagrid').options;
opts.editing = false;
});
},
editRow: function(jq, index){
return jq.each(function(){
var dg = $(this);
var opts = $.data(this, 'edatagrid').options;
var editIndex = opts.editIndex;
if (editIndex != index){
if (dg.datagrid('validateRow', editIndex)){
if (editIndex>=0){
if (opts.onBeforeSave.call(this, editIndex) == false) {
setTimeout(function(){
dg.datagrid('selectRow', editIndex);
},0);
return;
}
}
dg.datagrid('endEdit', editIndex);
dg.datagrid('beginEdit', index);
opts.editIndex = index;
} else {
setTimeout(function(){
dg.datagrid('selectRow', editIndex);
}, 0);
}
}
});
},
addRow: function(jq){
return jq.each(function(){
var dg = $(this);
var opts = $.data(this, 'edatagrid').options;
if (opts.editIndex >= 0){
if (!dg.datagrid('validateRow', opts.editIndex)){
dg.datagrid('selectRow', opts.editIndex);
return;
}
if (opts.onBeforeSave.call(this, opts.editIndex) == false){
setTimeout(function(){
dg.datagrid('selectRow', opts.editIndex);
},0);
return;
}
dg.datagrid('endEdit', opts.editIndex);
}
dg.datagrid('appendRow', {isNewRecord:true});
var rows = dg.datagrid('getRows');
opts.editIndex = rows.length - 1;
dg.datagrid('beginEdit', opts.editIndex);
dg.datagrid('selectRow', opts.editIndex);
if (opts.tree){
var node = $(opts.tree).tree('getSelected');
rows[opts.editIndex][opts.treeParentField] = (node ? node.id : 0);
}
opts.onAdd.call(this, opts.editIndex, rows[opts.editIndex]);
});
},
saveRow: function(jq){
return jq.each(function(){
var dg = $(this);
var opts = $.data(this, 'edatagrid').options;
if (opts.onBeforeSave.call(this, opts.editIndex) == false) {
setTimeout(function(){
dg.datagrid('selectRow', opts.editIndex);
},0);
return;
}
$(this).datagrid('endEdit', opts.editIndex);
});
},
cancelRow: function(jq){
return jq.each(function(){
var index = $(this).edatagrid('options').editIndex;
$(this).datagrid('cancelEdit', index);
});
},
destroyRow: function(jq){
return jq.each(function(){
var dg = $(this);
var opts = $.data(this, 'edatagrid').options;
var row = dg.datagrid('getSelected');
if (!row){
$.messager.show({
title: opts.destroyMsg.norecord.title,
msg: opts.destroyMsg.norecord.msg
});
return;
}
$.messager.confirm(opts.destroyMsg.confirm.title,opts.destroyMsg.confirm.msg,function(r){
if (r){
var index = dg.datagrid('getRowIndex', row);
if (row.isNewRecord){
dg.datagrid('cancelEdit', index);
} else {
if (opts.destroyUrl){
$.post(opts.destroyUrl, {id:row.id}, function(){
if (opts.tree){
dg.datagrid('reload');
var t = $(opts.tree);
var node = t.tree('find', row.id);
if (node){
t.tree('remove', node.target);
}
} else {
dg.datagrid('cancelEdit', index);
dg.datagrid('deleteRow', index);
}
opts.onDestroy.call(dg[0], index, row);
});
} else {
dg.datagrid('cancelEdit', index);
dg.datagrid('deleteRow', index);
}
}
}
});
});
}
};
$.fn.edatagrid.defaults = $.extend({}, $.fn.datagrid.defaults, {
editing: true,
editIndex: -1,
destroyMsg:{
norecord:{
title:'Warning',
msg:'No record is selected.'
},
confirm:{
title:'Confirm',
msg:'Are you sure you want to delete?'
}
},
destroyConfirmTitle: 'Confirm',
destroyConfirmMsg: 'Are you sure you want to delete?',
url: null, // return the datagrid data
saveUrl: null, // return the added row
updateUrl: null, // return the updated row
destroyUrl: null, // return {success:true}
tree: null, // the tree selector
treeUrl: null, // return tree data
treeDndUrl: null, // to process the drag and drop operation, return {success:true}
treeTextField: 'name',
treeParentField: 'parentId',
onAdd: function(index, row){},
onBeforeSave: function(index){},
onSave: function(index, row){},
onDestroy: function(index, row){}
});
})(jQuery); | {
"content_hash": "e83ad681df85e072f04e2907313bd05c",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 95,
"avg_line_length": 26.85,
"alnum_prop": 0.5787709497206703,
"repo_name": "masach/FjutOrgProject",
"id": "31f6f06786dd8772e2c1ab4b1e7a3687cc2478f9",
"size": "8270",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "js/jquery.edatagrid.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "174966"
},
{
"name": "C#",
"bytes": "485562"
},
{
"name": "CSS",
"bytes": "6597437"
},
{
"name": "HTML",
"bytes": "12612"
},
{
"name": "JavaScript",
"bytes": "36876133"
}
],
"symlink_target": ""
} |
using Test
using MPI
function find_sources(path::String, sources=String[])
if isdir(path)
for entry in readdir(path)
find_sources(joinpath(path, entry), sources)
end
elseif endswith(path, ".jl")
push!(sources, path)
end
sources
end
@testset "mpi examples" begin
examples_dir = joinpath(@__DIR__, "..", "examples")
examples = find_sources(examples_dir)
filter!(file -> readline(file) == "# INCLUDE IN MPI TEST", examples)
@testset "$(basename(example))" for example in examples
code = """
$(Base.load_path_setup_code())
include($(repr(example)))
"""
@test mpiexec() do mpi_cmd
cmd = `$mpi_cmd -n 4 $(Base.julia_cmd()) --startup-file=no -e $code`
@debug "Testing $example" Text(code) cmd
success(pipeline(cmd, stderr=stderr))
end
end
end
| {
"content_hash": "62769faf028f8ce307e47514af4ebee4",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 76,
"avg_line_length": 26.548387096774192,
"alnum_prop": 0.6318347509113001,
"repo_name": "JaredCrean2/PETSc.jl",
"id": "6cff2e484c5ee946a0bf2d258ca82c9022189863",
"size": "823",
"binary": false,
"copies": "2",
"ref": "refs/heads/compathelper/new_version/2022-10-04-02-09-13-961-02701808745",
"path": "test/mpi_examples.jl",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Julia",
"bytes": "3772993"
},
{
"name": "Shell",
"bytes": "93"
}
],
"symlink_target": ""
} |
package org.nd4j.linalg.schedule;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nd4j.shade.jackson.annotation.JsonProperty;
/**
* Inverse schedule, with 3 parameters: initial value, gamma and power.<br>
* value(i) = initialValue * (1 + gamma * iter)^(-power)
* where i is the iteration or epoch (depending on the setting)
*
* @author Alex Black
*/
@Data
@EqualsAndHashCode
public class InverseSchedule implements ISchedule {
private final ScheduleType scheduleType;
private final double initialValue;
private final double gamma;
private final double power;
public InverseSchedule(@JsonProperty("scheduleType") ScheduleType scheduleType,
@JsonProperty("initialValue") double initialValue,
@JsonProperty("gamma") double gamma,
@JsonProperty("power") double power){
this.scheduleType = scheduleType;
this.initialValue = initialValue;
this.gamma = gamma;
this.power = power;
}
@Override
public double valueAt(int iteration, int epoch) {
int i = (scheduleType == ScheduleType.ITERATION ? iteration : epoch);
return initialValue / Math.pow(1 + gamma * i, power);
}
@Override
public ISchedule clone() {
return new InverseSchedule(scheduleType, initialValue, gamma, power);
}
}
| {
"content_hash": "83d689ec8214af92d200e4dbbb04f41e",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 83,
"avg_line_length": 32.2093023255814,
"alnum_prop": 0.6664259927797834,
"repo_name": "deeplearning4j/nd4j",
"id": "5565313fc2c81dbaae1e00816e590eea4a97301b",
"size": "1385",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/schedule/InverseSchedule.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2469"
},
{
"name": "Java",
"bytes": "12814983"
},
{
"name": "Shell",
"bytes": "20358"
}
],
"symlink_target": ""
} |
//@result Submitted a few seconds ago • Score: 50.00 Status: Accepted Test Case #0: 0s Test Case #1: 0s Test Case #2: 0s Test Case #3: 0s Test Case #4: 0s Test Case #5: 0s Test Case #6: 0s Test Case #7: 0s Test Case #8: 0s Test Case #9: 0s
//@algorithm dfs
#include <cmath>
#include <climits>
#include <cstdio>
#include <vector>
#include <unordered_set>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
int dfs(size_t current, vector<unordered_set<int> > &graph_mat, vector<int> &child_list, int &cut_num) {
if (INT_MAX == child_list[current]) {
child_list[current] = 1;
for (unordered_set<int>::iterator it = graph_mat[current].begin(); it != graph_mat[current].end(); ++ it) {
if (INT_MAX == child_list[*it]) {
int child_count = dfs(*it, graph_mat, child_list, cut_num);
if (0 == child_count % 2) {
//graph_mat[current].erase(*it);
//graph_mat[*it].erase(current);
++ cut_num;
} else {
child_list[current] += child_count;
}
}
}
}
return child_list[current];
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int vertex_num = 0;
int edge_num = 0;
while (cin >> vertex_num >> edge_num) {
vector<unordered_set<int> > graph_mat(vertex_num);
for (int i = 0; i < edge_num; ++ i) {
int vertex0 = 0;
int vertex1 = 0;
cin >> vertex0 >> vertex1;
graph_mat[vertex0 - 1].insert(vertex1 - 1);
graph_mat[vertex1 - 1].insert(vertex0 - 1);
}
vector<int> child_list(vertex_num, INT_MAX);
int cut_num = 0;
dfs(0, graph_mat, child_list, cut_num);
cout << cut_num << endl;
}
return 0;
}
| {
"content_hash": "765f49477ac6129be3e3ffd598822955",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 239,
"avg_line_length": 36.30769230769231,
"alnum_prop": 0.541843220338983,
"repo_name": "FeiZhan/Algo-Collection",
"id": "6acfacc0bc6b11855bb430ab904d053fc1e67758",
"size": "1890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "answers/hackerrank/Even Tree.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "892410"
},
{
"name": "Java",
"bytes": "743448"
},
{
"name": "JavaScript",
"bytes": "3093"
},
{
"name": "Python",
"bytes": "93383"
},
{
"name": "Shell",
"bytes": "891"
}
],
"symlink_target": ""
} |
/**
Core script to handle the entire theme and core functions
**/
var Metronic = function() {
// IE mode
var isRTL = false;
var isIE8 = false;
var isIE9 = false;
var isIE10 = false;
var resizeHandlers = [];
var assetsPath = '../../assets/';
var globalImgPath = 'global/img/';
var globalPluginsPath = 'global/plugins/';
var globalCssPath = 'global/css/';
// theme layout color set
var brandColors = {
'blue': '#89C4F4',
'red': '#F3565D',
'green': '#1bbc9b',
'purple': '#9b59b6',
'grey': '#95a5a6',
'yellow': '#F8CB00'
};
// initializes main settings
var handleInit = function() {
if ($('body').css('direction') === 'rtl') {
isRTL = true;
}
isIE8 = !!navigator.userAgent.match(/MSIE 8.0/);
isIE9 = !!navigator.userAgent.match(/MSIE 9.0/);
isIE10 = !!navigator.userAgent.match(/MSIE 10.0/);
if (isIE10) {
$('html').addClass('ie10'); // detect IE10 version
}
if (isIE10 || isIE9 || isIE8) {
$('html').addClass('ie'); // detect IE10 version
}
};
// runs callback functions set by Metronic.addResponsiveHandler().
var _runResizeHandlers = function() {
// reinitialize other subscribed elements
for (var i = 0; i < resizeHandlers.length; i++) {
var each = resizeHandlers[i];
each.call();
}
};
// handle the layout reinitialization on window resize
var handleOnResize = function() {
var resize;
if (isIE8) {
var currheight;
$(window).resize(function() {
if (currheight == document.documentElement.clientHeight) {
return; //quite event since only body resized not window.
}
if (resize) {
clearTimeout(resize);
}
resize = setTimeout(function() {
_runResizeHandlers();
}, 50); // wait 50ms until window resize finishes.
currheight = document.documentElement.clientHeight; // store last body client height
});
} else {
$(window).resize(function() {
if (resize) {
clearTimeout(resize);
}
resize = setTimeout(function() {
_runResizeHandlers();
}, 50); // wait 50ms until window resize finishes.
});
}
};
// Handles portlet tools & actions
var handlePortletTools = function() {
// handle portlet remove
$('body').on('click', '.portlet > .portlet-title > .tools > a.remove', function(e) {
e.preventDefault();
var portlet = $(this).closest(".portlet");
if ($('body').hasClass('page-portlet-fullscreen')) {
$('body').removeClass('page-portlet-fullscreen');
}
portlet.find('.portlet-title .fullscreen').tooltip('destroy');
portlet.find('.portlet-title > .tools > .reload').tooltip('destroy');
portlet.find('.portlet-title > .tools > .remove').tooltip('destroy');
portlet.find('.portlet-title > .tools > .config').tooltip('destroy');
portlet.find('.portlet-title > .tools > .collapse, .portlet > .portlet-title > .tools > .expand').tooltip('destroy');
portlet.remove();
});
// handle portlet fullscreen
$('body').on('click', '.portlet > .portlet-title .fullscreen', function(e) {
e.preventDefault();
var portlet = $(this).closest(".portlet");
if (portlet.hasClass('portlet-fullscreen')) {
$(this).removeClass('on');
portlet.removeClass('portlet-fullscreen');
$('body').removeClass('page-portlet-fullscreen');
portlet.children('.portlet-body').css('height', 'auto');
} else {
var height = Metronic.getViewPort().height -
portlet.children('.portlet-title').outerHeight() -
parseInt(portlet.children('.portlet-body').css('padding-top')) -
parseInt(portlet.children('.portlet-body').css('padding-bottom'));
$(this).addClass('on');
portlet.addClass('portlet-fullscreen');
$('body').addClass('page-portlet-fullscreen');
portlet.children('.portlet-body').css('height', height);
}
});
$('body').on('click', '.portlet > .portlet-title > .tools > a.reload', function(e) {
e.preventDefault();
var el = $(this).closest(".portlet").children(".portlet-body");
var url = $(this).attr("data-url");
var error = $(this).attr("data-error-display");
if (url) {
Metronic.blockUI({
target: el,
animate: true,
overlayColor: 'none'
});
$.ajax({
type: "GET",
cache: false,
url: url,
dataType: "html",
success: function(res) {
Metronic.unblockUI(el);
el.html(res);
},
error: function(xhr, ajaxOptions, thrownError) {
Metronic.unblockUI(el);
var msg = 'Error on reloading the content. Please check your connection and try again.';
if (error == "toastr" && toastr) {
toastr.error(msg);
} else if (error == "notific8" && $.notific8) {
$.notific8('zindex', 11500);
$.notific8(msg, {
theme: 'ruby',
life: 3000
});
} else {
alert(msg);
}
}
});
} else {
// for demo purpose
Metronic.blockUI({
target: el,
animate: true,
overlayColor: 'none'
});
window.setTimeout(function() {
Metronic.unblockUI(el);
}, 1000);
}
});
// load ajax data on page init
$('.portlet .portlet-title a.reload[data-load="true"]').click();
$('body').on('click', '.portlet > .portlet-title > .tools > .collapse, .portlet .portlet-title > .tools > .expand', function(e) {
e.preventDefault();
var el = $(this).closest(".portlet").children(".portlet-body");
if ($(this).hasClass("collapse")) {
$(this).removeClass("collapse").addClass("expand");
el.slideUp(200);
} else {
$(this).removeClass("expand").addClass("collapse");
el.slideDown(200);
}
});
};
// Handles custom checkboxes & radios using jQuery Uniform plugin
var handleUniform = function() {
if (!$().uniform) {
return;
}
var test = $("input[type=checkbox]:not(.toggle, .md-check, .md-radiobtn, .make-switch, .icheck), input[type=radio]:not(.toggle, .md-check, .md-radiobtn, .star, .make-switch, .icheck)");
if (test.size() > 0) {
test.each(function() {
if ($(this).parents(".checker").size() === 0) {
$(this).show();
$(this).uniform();
}
});
}
};
// Handlesmaterial design checkboxes
var handleMaterialDesign = function() {
// Material design ckeckbox and radio effects
$('body').on('click', '.md-checkbox > label, .md-radio > label', function() {
var the = $(this);
// find the first span which is our circle/bubble
var el = $(this).children('span:first-child');
// add the bubble class (we do this so it doesnt show on page load)
el.addClass('inc');
// clone it
var newone = el.clone(true);
// add the cloned version before our original
el.before(newone);
// remove the original so that it is ready to run on next click
$("." + el.attr("class") + ":last", the).remove();
});
if ($('body').hasClass('page-md')) {
// Material design click effect
// credit where credit's due; http://thecodeplayer.com/walkthrough/ripple-click-effect-google-material-design
var element, circle, d, x, y;
$('body').on('click', 'a.btn, button.btn, input.btn, label.btn', function(e) {
element = $(this);
if(element.find(".md-click-circle").length == 0) {
element.prepend("<span class='md-click-circle'></span>");
}
circle = element.find(".md-click-circle");
circle.removeClass("md-click-animate");
if(!circle.height() && !circle.width()) {
d = Math.max(element.outerWidth(), element.outerHeight());
circle.css({height: d, width: d});
}
x = e.pageX - element.offset().left - circle.width()/2;
y = e.pageY - element.offset().top - circle.height()/2;
circle.css({top: y+'px', left: x+'px'}).addClass("md-click-animate");
setTimeout(function() {
circle.remove();
}, 1000);
});
}
// Floating labels
var handleInput = function(el) {
if (el.val() != "") {
el.addClass('edited');
} else {
el.removeClass('edited');
}
}
$('body').on('keydown', '.form-md-floating-label .form-control', function(e) {
handleInput($(this));
});
$('body').on('blur', '.form-md-floating-label .form-control', function(e) {
handleInput($(this));
});
$('.form-md-floating-label .form-control').each(function(){
if ($(this).val().length > 0) {
$(this).addClass('edited');
}
});
}
// Handles custom checkboxes & radios using jQuery iCheck plugin
var handleiCheck = function() {
if (!$().iCheck) {
return;
}
$('.icheck').each(function() {
var checkboxClass = $(this).attr('data-checkbox') ? $(this).attr('data-checkbox') : 'icheckbox_minimal-grey';
var radioClass = $(this).attr('data-radio') ? $(this).attr('data-radio') : 'iradio_minimal-grey';
if (checkboxClass.indexOf('_line') > -1 || radioClass.indexOf('_line') > -1) {
$(this).iCheck({
checkboxClass: checkboxClass,
radioClass: radioClass,
insert: '<div class="icheck_line-icon"></div>' + $(this).attr("data-label")
});
} else {
$(this).iCheck({
checkboxClass: checkboxClass,
radioClass: radioClass
});
}
});
};
// Handles Bootstrap switches
var handleBootstrapSwitch = function() {
if (!$().bootstrapSwitch) {
return;
}
$('.make-switch').bootstrapSwitch();
};
// Handles Bootstrap confirmations
var handleBootstrapConfirmation = function() {
if (!$().confirmation) {
return;
}
$('[data-toggle=confirmation]').confirmation({ container: 'body', btnOkClass: 'btn btn-sm btn-success', btnCancelClass: 'btn btn-sm btn-danger'});
}
// Handles Bootstrap Accordions.
var handleAccordions = function() {
$('body').on('shown.bs.collapse', '.accordion.scrollable', function(e) {
Metronic.scrollTo($(e.target));
});
};
// Handles Bootstrap Tabs.
var handleTabs = function() {
//activate tab if tab id provided in the URL
if (location.hash) {
var tabid = encodeURI(location.hash.substr(1));
$('a[href="#' + tabid + '"]').parents('.tab-pane:hidden').each(function() {
var tabid = $(this).attr("id");
$('a[href="#' + tabid + '"]').click();
});
$('a[href="#' + tabid + '"]').click();
}
if ($().tabdrop) {
$('.tabbable-tabdrop .nav-pills, .tabbable-tabdrop .nav-tabs').tabdrop({
text: '<i class="fa fa-ellipsis-v"></i> <i class="fa fa-angle-down"></i>'
});
}
};
// Handles Bootstrap Modals.
var handleModals = function() {
// fix stackable modal issue: when 2 or more modals opened, closing one of modal will remove .modal-open class.
$('body').on('hide.bs.modal', function() {
if ($('.modal:visible').size() > 1 && $('html').hasClass('modal-open') === false) {
$('html').addClass('modal-open');
} else if ($('.modal:visible').size() <= 1) {
$('html').removeClass('modal-open');
}
});
// fix page scrollbars issue
$('body').on('show.bs.modal', '.modal', function() {
if ($(this).hasClass("modal-scroll")) {
$('body').addClass("modal-open-noscroll");
}
});
// fix page scrollbars issue
$('body').on('hide.bs.modal', '.modal', function() {
$('body').removeClass("modal-open-noscroll");
});
// remove ajax content and remove cache on modal closed
$('body').on('hidden.bs.modal', '.modal:not(.modal-cached)', function () {
$(this).removeData('bs.modal');
});
};
// Handles Bootstrap Tooltips.
var handleTooltips = function() {
// global tooltips
$('.tooltips').tooltip();
// portlet tooltips
$('.portlet > .portlet-title .fullscreen').tooltip({
container: 'body',
title: 'Fullscreen'
});
$('.portlet > .portlet-title > .tools > .reload').tooltip({
container: 'body',
title: '刷新'
});
$('.portlet > .portlet-title > .tools > .remove').tooltip({
container: 'body',
title: 'Remove'
});
$('.portlet > .portlet-title > .tools > .config').tooltip({
container: 'body',
title: 'Settings'
});
$('.portlet > .portlet-title > .tools > .collapse, .portlet > .portlet-title > .tools > .expand').tooltip({
container: 'body',
title: '展开/收起'
});
};
// Handles Bootstrap Dropdowns
var handleDropdowns = function() {
/*
Hold dropdown on click
*/
$('body').on('click', '.dropdown-menu.hold-on-click', function(e) {
e.stopPropagation();
});
};
var handleAlerts = function() {
$('body').on('click', '[data-close="alert"]', function(e) {
$(this).parent('.alert').hide();
$(this).closest('.note').hide();
e.preventDefault();
});
$('body').on('click', '[data-close="note"]', function(e) {
$(this).closest('.note').hide();
e.preventDefault();
});
$('body').on('click', '[data-remove="note"]', function(e) {
$(this).closest('.note').remove();
e.preventDefault();
});
};
// Handle Hower Dropdowns
var handleDropdownHover = function() {
$('[data-hover="dropdown"]').not('.hover-initialized').each(function() {
$(this).dropdownHover();
$(this).addClass('hover-initialized');
});
};
// Handle textarea autosize
var handleTextareaAutosize = function() {
if (typeof(autosize) == "function") {
autosize(document.querySelector('textarea.autosizeme'));
}
}
// Handles Bootstrap Popovers
// last popep popover
var lastPopedPopover;
var handlePopovers = function() {
$('.popovers').popover();
// close last displayed popover
$(document).on('click.bs.popover.data-api', function(e) {
if (lastPopedPopover) {
lastPopedPopover.popover('hide');
}
});
};
// Handles scrollable contents using jQuery SlimScroll plugin.
var handleScrollers = function() {
Metronic.initSlimScroll('.scroller');
};
// Handles Image Preview using jQuery Fancybox plugin
var handleFancybox = function() {
if (!jQuery.fancybox) {
return;
}
if ($(".fancybox-button").size() > 0) {
$(".fancybox-button").fancybox({
groupAttr: 'data-rel',
prevEffect: 'none',
nextEffect: 'none',
closeBtn: true,
helpers: {
title: {
type: 'inside'
}
}
});
}
};
// Fix input placeholder issue for IE8 and IE9
var handleFixInputPlaceholderForIE = function() {
//fix html5 placeholder attribute for ie7 & ie8
if (isIE8 || isIE9) { // ie8 & ie9
// this is html5 placeholder fix for inputs, inputs with placeholder-no-fix class will be skipped(e.g: we need this for password fields)
$('input[placeholder]:not(.placeholder-no-fix), textarea[placeholder]:not(.placeholder-no-fix)').each(function() {
var input = $(this);
if (input.val() === '' && input.attr("placeholder") !== '') {
input.addClass("placeholder").val(input.attr('placeholder'));
}
input.focus(function() {
if (input.val() == input.attr('placeholder')) {
input.val('');
}
});
input.blur(function() {
if (input.val() === '' || input.val() == input.attr('placeholder')) {
input.val(input.attr('placeholder'));
}
});
});
}
};
// Handle Select2 Dropdowns
var handleSelect2 = function() {
if ($().select2) {
$('.select2me').select2({
placeholder: "Select",
allowClear: true
});
}
};
// handle group element heights
var handleHeight = function() {
$('[data-auto-height]').each(function() {
var parent = $(this);
var items = $('[data-height]', parent);
var height = 0;
var mode = parent.attr('data-mode');
var offset = parseInt(parent.attr('data-offset') ? parent.attr('data-offset') : 0);
items.each(function() {
if ($(this).attr('data-height') == "height") {
$(this).css('height', '');
} else {
$(this).css('min-height', '');
}
var height_ = (mode == 'base-height' ? $(this).outerHeight() : $(this).outerHeight(true));
if (height_ > height) {
height = height_;
}
});
height = height + offset;
items.each(function() {
if ($(this).attr('data-height') == "height") {
$(this).css('height', height);
} else {
$(this).css('min-height', height);
}
});
});
}
//* END:CORE HANDLERS *//
return {
//main function to initiate the theme
init: function() {
//IMPORTANT!!!: Do not modify the core handlers call order.
//Core handlers
handleInit(); // initialize core variables
handleOnResize(); // set and handle responsive
//UI Component handlers
handleMaterialDesign(); // handle material design
handleUniform(); // hanfle custom radio & checkboxes
handleiCheck(); // handles custom icheck radio and checkboxes
handleBootstrapSwitch(); // handle bootstrap switch plugin
handleScrollers(); // handles slim scrolling contents
handleFancybox(); // handle fancy box
handleSelect2(); // handle custom Select2 dropdowns
handlePortletTools(); // handles portlet action bar functionality(refresh, configure, toggle, remove)
handleAlerts(); //handle closabled alerts
handleDropdowns(); // handle dropdowns
handleTabs(); // handle tabs
handleTooltips(); // handle bootstrap tooltips
handlePopovers(); // handles bootstrap popovers
handleAccordions(); //handles accordions
handleModals(); // handle modals
handleBootstrapConfirmation(); // handle bootstrap confirmations
handleTextareaAutosize(); // handle autosize textareas
//Handle group element heights
handleHeight();
this.addResizeHandler(handleHeight); // handle auto calculating height on window resize
// Hacks
handleFixInputPlaceholderForIE(); //IE8 & IE9 input placeholder issue fix
},
//main function to initiate core javascript after ajax complete
initAjax: function() {
handleUniform(); // handles custom radio & checkboxes
handleiCheck(); // handles custom icheck radio and checkboxes
handleBootstrapSwitch(); // handle bootstrap switch plugin
handleDropdownHover(); // handles dropdown hover
handleScrollers(); // handles slim scrolling contents
handleSelect2(); // handle custom Select2 dropdowns
handleFancybox(); // handle fancy box
handleDropdowns(); // handle dropdowns
handleTooltips(); // handle bootstrap tooltips
handlePopovers(); // handles bootstrap popovers
handleAccordions(); //handles accordions
handleBootstrapConfirmation(); // handle bootstrap confirmations
},
//init main components
initComponents: function() {
this.initAjax();
},
//public function to remember last opened popover that needs to be closed on click
setLastPopedPopover: function(el) {
lastPopedPopover = el;
},
//public function to add callback a function which will be called on window resize
addResizeHandler: function(func) {
resizeHandlers.push(func);
},
//public functon to call _runresizeHandlers
runResizeHandlers: function() {
_runResizeHandlers();
},
// wrMetronicer function to scroll(focus) to an element
scrollTo: function(el, offeset) {
var pos = (el && el.size() > 0) ? el.offset().top : 0;
if (el) {
if ($('body').hasClass('page-header-fixed')) {
pos = pos - $('.page-header').height();
} else if ($('body').hasClass('page-header-top-fixed')) {
pos = pos - $('.page-header-top').height();
} else if ($('body').hasClass('page-header-menu-fixed')) {
pos = pos - $('.page-header-menu').height();
}
pos = pos + (offeset ? offeset : -1 * el.height());
}
$('html,body').animate({
scrollTop: pos
}, 'slow');
},
initSlimScroll: function(el) {
$(el).each(function() {
if ($(this).attr("data-initialized")) {
return; // exit
}
var height;
if ($(this).attr("data-height")) {
height = $(this).attr("data-height");
} else {
height = $(this).css('height');
}
$(this).slimScroll({
allowPageScroll: true, // allow page scroll when the element scroll is ended
size: '7px',
color: ($(this).attr("data-handle-color") ? $(this).attr("data-handle-color") : '#bbb'),
wrapperClass: ($(this).attr("data-wrapper-class") ? $(this).attr("data-wrapper-class") : 'slimScrollDiv'),
railColor: ($(this).attr("data-rail-color") ? $(this).attr("data-rail-color") : '#eaeaea'),
position: isRTL ? 'left' : 'right',
height: height,
alwaysVisible: ($(this).attr("data-always-visible") == "1" ? true : false),
railVisible: ($(this).attr("data-rail-visible") == "1" ? true : false),
disableFadeOut: true
});
$(this).attr("data-initialized", "1");
});
},
destroySlimScroll: function(el) {
$(el).each(function() {
if ($(this).attr("data-initialized") === "1") { // destroy existing instance before updating the height
$(this).removeAttr("data-initialized");
$(this).removeAttr("style");
var attrList = {};
// store the custom attribures so later we will reassign.
if ($(this).attr("data-handle-color")) {
attrList["data-handle-color"] = $(this).attr("data-handle-color");
}
if ($(this).attr("data-wrapper-class")) {
attrList["data-wrapper-class"] = $(this).attr("data-wrapper-class");
}
if ($(this).attr("data-rail-color")) {
attrList["data-rail-color"] = $(this).attr("data-rail-color");
}
if ($(this).attr("data-always-visible")) {
attrList["data-always-visible"] = $(this).attr("data-always-visible");
}
if ($(this).attr("data-rail-visible")) {
attrList["data-rail-visible"] = $(this).attr("data-rail-visible");
}
$(this).slimScroll({
wrapperClass: ($(this).attr("data-wrapper-class") ? $(this).attr("data-wrapper-class") : 'slimScrollDiv'),
destroy: true
});
var the = $(this);
// reassign custom attributes
$.each(attrList, function(key, value) {
the.attr(key, value);
});
}
});
},
// function to scroll to the top
scrollTop: function() {
Metronic.scrollTo();
},
// wrMetronicer function to block element(indicate loading)
blockUI: function(options) {
options = $.extend(true, {}, options);
var html = '';
if (options.animate) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '">' + '<div class="block-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' + '</div>';
} else if (options.iconOnly) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif" align=""></div>';
} else if (options.textOnly) {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><span> ' + (options.message ? options.message : 'LOADING...') + '</span></div>';
} else {
html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif" align=""><span> ' + (options.message ? options.message : 'LOADING...') + '</span></div>';
}
if (options.target) { // element blocking
var el = $(options.target);
if (el.height() <= ($(window).height())) {
options.cenrerY = true;
}
el.block({
message: html,
baseZ: options.zIndex ? options.zIndex : 1000,
centerY: options.cenrerY !== undefined ? options.cenrerY : false,
css: {
top: '10%',
border: '0',
padding: '0',
backgroundColor: 'none'
},
overlayCSS: {
backgroundColor: options.overlayColor ? options.overlayColor : '#555',
opacity: options.boxed ? 0.05 : 0.1,
cursor: 'wait'
}
});
} else { // page blocking
$.blockUI({
message: html,
baseZ: options.zIndex ? options.zIndex : 1000,
css: {
border: '0',
padding: '0',
backgroundColor: 'none'
},
overlayCSS: {
backgroundColor: options.overlayColor ? options.overlayColor : '#555',
opacity: options.boxed ? 0.05 : 0.1,
cursor: 'wait'
}
});
}
},
// wrMetronicer function to un-block element(finish loading)
unblockUI: function(target) {
if (target) {
$(target).unblock({
onUnblock: function() {
$(target).css('position', '');
$(target).css('zoom', '');
}
});
} else {
$.unblockUI();
}
},
startPageLoading: function(options) {
if (options && options.animate) {
$('.page-spinner-bar').remove();
$('body').append('<div class="page-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>');
} else {
$('.page-loading').remove();
$('body').append('<div class="page-loading"><img src="' + this.getGlobalImgPath() + 'loading-spinner-grey.gif"/> <span>' + (options && options.message ? options.message : 'Loading...') + '</span></div>');
}
},
stopPageLoading: function() {
$('.page-loading, .page-spinner-bar').remove();
},
alert: function(options) {
options = $.extend(true, {
container: "", // alerts parent container(by default placed after the page breadcrumbs)
place: "append", // "append" or "prepend" in container
type: 'success', // alert's type
message: "", // alert's message
close: true, // make alert closable
reset: true, // close all previouse alerts first
focus: true, // auto scroll to the alert after shown
closeInSeconds: 0, // auto close after defined seconds
icon: "" // put icon before the message
}, options);
var id = Metronic.getUniqueID("Metronic_alert");
var html = '<div id="' + id + '" class="Metronic-alerts alert alert-' + options.type + ' fade in">' + (options.close ? '<button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>' : '') + (options.icon !== "" ? '<i class="fa-lg fa fa-' + options.icon + '"></i> ' : '') + options.message + '</div>';
if (options.reset) {
$('.Metronic-alerts').remove();
}
if (!options.container) {
if ($('body').hasClass("page-container-bg-solid")) {
$('.page-title').after(html);
} else {
if ($('.page-bar').size() > 0) {
$('.page-bar').after(html);
} else {
$('.page-breadcrumb').after(html);
}
}
} else {
if (options.place == "append") {
$(options.container).append(html);
} else {
$(options.container).prepend(html);
}
}
if (options.focus) {
Metronic.scrollTo($('#' + id));
}
if (options.closeInSeconds > 0) {
setTimeout(function() {
$('#' + id).remove();
}, options.closeInSeconds * 1000);
}
return id;
},
// initializes uniform elements
initUniform: function(els) {
if (els) {
$(els).each(function() {
if ($(this).parents(".checker").size() === 0) {
$(this).show();
$(this).uniform();
}
});
} else {
handleUniform();
}
},
//wrMetronicer function to update/sync jquery uniform checkbox & radios
updateUniform: function(els) {
$.uniform.update(els); // update the uniform checkbox & radios UI after the actual input control state changed
},
//public function to initialize the fancybox plugin
initFancybox: function() {
handleFancybox();
},
//public helper function to get actual input value(used in IE9 and IE8 due to placeholder attribute not supported)
getActualVal: function(el) {
el = $(el);
if (el.val() === el.attr("placeholder")) {
return "";
}
return el.val();
},
//public function to get a paremeter by name from URL
getURLParameter: function(paramName) {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i = 0; i < params.length; i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return unescape(val[1]);
}
}
return null;
},
// check for device touch support
isTouchDevice: function() {
try {
document.createEvent("TouchEvent");
return true;
} catch (e) {
return false;
}
},
// To get the correct viewport width based on http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
getViewPort: function() {
var e = window,
a = 'inner';
if (!('innerWidth' in window)) {
a = 'client';
e = document.documentElement || document.body;
}
return {
width: e[a + 'Width'],
height: e[a + 'Height']
};
},
getUniqueID: function(prefix) {
return 'prefix_' + Math.floor(Math.random() * (new Date()).getTime());
},
// check IE8 mode
isIE8: function() {
return isIE8;
},
// check IE9 mode
isIE9: function() {
return isIE9;
},
//check RTL mode
isRTL: function() {
return isRTL;
},
// check IE8 mode
isAngularJsApp: function() {
return (typeof angular == 'undefined') ? false : true;
},
getAssetsPath: function() {
return assetsPath;
},
setAssetsPath: function(path) {
assetsPath = path;
},
setGlobalImgPath: function(path) {
globalImgPath = path;
},
getGlobalImgPath: function() {
return assetsPath + globalImgPath;
},
setGlobalPluginsPath: function(path) {
globalPluginsPath = path;
},
getGlobalPluginsPath: function() {
return assetsPath + globalPluginsPath;
},
getGlobalCssPath: function() {
return assetsPath + globalCssPath;
},
// get layout color code by color name
getBrandColor: function(name) {
if (brandColors[name]) {
return brandColors[name];
} else {
return '';
}
},
getResponsiveBreakpoint: function(size) {
// bootstrap responsive breakpoints
var sizes = {
'xs' : 480, // extra small
'sm' : 768, // small
'md' : 992, // medium
'lg' : 1200 // large
};
return sizes[size] ? sizes[size] : 0;
}
};
}(); | {
"content_hash": "6c37c833fcecf69b4dd727b394b386d3",
"timestamp": "",
"source": "github",
"line_count": 1022,
"max_line_length": 338,
"avg_line_length": 37.031311154598825,
"alnum_prop": 0.4708291497119907,
"repo_name": "lycheng423/yii2",
"id": "fd89fdf937e8da5322e981d00d13c51cde27bee4",
"size": "37860",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "frontend/web/static/css/oto/metbootstrap/css/assets/global/scripts/metronic.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "580"
},
{
"name": "ApacheConf",
"bytes": "932"
},
{
"name": "Batchfile",
"bytes": "2171"
},
{
"name": "CSS",
"bytes": "8180446"
},
{
"name": "CoffeeScript",
"bytes": "167262"
},
{
"name": "HTML",
"bytes": "11082225"
},
{
"name": "Java",
"bytes": "13196"
},
{
"name": "JavaScript",
"bytes": "40847532"
},
{
"name": "PHP",
"bytes": "339374"
},
{
"name": "Shell",
"bytes": "4744"
}
],
"symlink_target": ""
} |
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
?>
<script type='text/javascript'>
var idcomments_acct = '<?php echo $account; ?>';
var idcomments_post_id = 'zoo-<?php echo $this->_item->id; ?>';
var idcomments_post_url;
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type='text/javascript' src='http://www.intensedebate.com/js/genericCommentWrapperV2.js'></script>
| {
"content_hash": "9a24a74b3f610ddfcb4d021c9ce9c170",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 105,
"avg_line_length": 28.6,
"alnum_prop": 0.6946386946386947,
"repo_name": "notarget84/Grupo-Estudos-do-Pulmao",
"id": "941d5ecf893a3877dc004b3b25a7fa9f540fc344",
"size": "606",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "media/zoo/elements/intensedebate/tmpl/intensedebate.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "1589000"
},
{
"name": "JavaScript",
"bytes": "243108"
},
{
"name": "PHP",
"bytes": "6222901"
}
],
"symlink_target": ""
} |
package dcd.academic.DAO.impl;
import java.sql.ResultSet;
import java.util.ArrayList;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import dcd.academic.DAO.ShareDAO;
import dcd.academic.model.Gift;
import dcd.academic.mysql.dbpool.DBConnectionManage;
public class ShareDaoImpl implements ShareDAO {
@Override
public void addGift(Gift gift) {
String query = "insert into UserGift(user, type, content, url, " +
"tag, date) values(?, ?, ?, ?, ?, ?);";
Connection con = null;
PreparedStatement pst = null;
DBConnectionManage dbmanage = DBConnectionManage.getInstance();
try {
con = dbmanage.getFreeConnection();
pst = (PreparedStatement) con.prepareStatement(query);
pst.setString(1, gift.getUser());
pst.setString(2, gift.getType());
pst.setString(3, gift.getContent());
pst.setString(4, gift.getUrl());
pst.setString(5, gift.getTag());
pst.setString(6, gift.getDate());
pst.executeUpdate();
} catch (Exception e) {
System.out.println("#######addGift Exception#######");
e.printStackTrace();
} finally {
try {
dbmanage.closeConnection(con);
} catch (Exception e) {
}
}
}
@Override
public ArrayList<Gift> getGift(String username) {
ArrayList<Gift> gifts = new ArrayList<Gift>();
String query = "select * from UserGift where user=? order by date DESC;";
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
DBConnectionManage dbmanage = DBConnectionManage.getInstance();
try {
con = dbmanage.getFreeConnection();
pst = (PreparedStatement) con.prepareStatement(query);
pst.setString(1, username);
rs = pst.executeQuery();
while (rs.next()) {
Gift tmp = new Gift();
tmp.setContent(rs.getString("content").toString());
tmp.setDate(rs.getString("date").toString());
tmp.setUrl(rs.getString("url").toString());
tmp.setUser(rs.getString("user").toString());
tmp.setTag(rs.getString("tag").toString());
tmp.setType(rs.getString("type").toString());
gifts.add(tmp);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
dbmanage.closeConnection(con);
} catch (Exception e) {
e.printStackTrace();
}
}
return gifts;
}
}
| {
"content_hash": "9031758671a13abe677f7d90a2ff304b",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 75,
"avg_line_length": 29.756410256410255,
"alnum_prop": 0.6535975872468763,
"repo_name": "SchoolProjs/Gitsoo",
"id": "60c35efb5f377874033cce3d2f216ba8428f6556",
"size": "2321",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "gitsoo_academic/engine/src/dcd/academic/DAO/impl/ShareDaoImpl.java",
"mode": "33261",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.activiti5.camel.examples.multiinstance;
/**
* @author Saeid Mirzaei
*/
import java.util.List;
import org.activiti.engine.runtime.Job;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.test.Deployment;
import org.activiti5.spring.impl.test.SpringActivitiTestCase;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
@ContextConfiguration("classpath:generic-camel-activiti-context.xml")
public class MultiInstanceTest extends SpringActivitiTestCase {
@Autowired
protected CamelContext camelContext;
public void setUp() throws Exception {
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
from("activiti:miProcessExample:serviceTask1").to("seda:continueAsync1");
from("seda:continueAsync1").to("bean:sleepBean?method=sleep").to("activiti:miProcessExample:receive1");
}
});
}
@Deployment(resources = {"process/multiinstanceReceive.bpmn20.xml"})
public void testRunProcess() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("miProcessExample");
List<Job> jobList = managementService.createJobQuery().list();
assertEquals(5, jobList.size());
assertEquals(5, runtimeService.createExecutionQuery()
.processInstanceId(processInstance.getId())
.activityId("serviceTask1").count());
waitForJobExecutorToProcessAllJobs(3000, 500);
int counter = 0;
long processInstanceCount = 1;
while (processInstanceCount == 1 && counter < 20) {
Thread.sleep(500);
processInstanceCount = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count();
counter++;
}
assertEquals(0, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count());
}
}
| {
"content_hash": "bdc5c595ce6fda783bb32286ae82213d",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 124,
"avg_line_length": 37.94117647058823,
"alnum_prop": 0.7550387596899225,
"repo_name": "stefan-ziel/Activiti",
"id": "327c9b0ea2529ac92dcb89d656e2df68be2b6092",
"size": "2580",
"binary": false,
"copies": "3",
"ref": "refs/heads/6.x-c",
"path": "modules/activiti5-camel-test/src/test/java/org/activiti5/camel/examples/multiinstance/MultiInstanceTest.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "166"
},
{
"name": "CSS",
"bytes": "292473"
},
{
"name": "HTML",
"bytes": "774326"
},
{
"name": "Java",
"bytes": "20888915"
},
{
"name": "JavaScript",
"bytes": "8873337"
},
{
"name": "PLSQL",
"bytes": "1426"
},
{
"name": "PLpgSQL",
"bytes": "4868"
},
{
"name": "Shell",
"bytes": "8194"
}
],
"symlink_target": ""
} |
<?php
/**
* Created by PhpStorm.
* User: Gavin
* Date: 06/12/14
* Time: 13:33
*/
class InterestsTest extends UnitTestCase
{
public function testInterests()
{
$interests = Interest::getTopLevel();
$this->assertTrue($interests->count() == 25);
$links = $interests[0]->getChildrenLinks();
$this->assertTrue($links->count() == $interests[0]->getChildren()->count());
$int1 = $interests[0]->getChildren()[0]->getParents()[0]->getInterest();
$int2 = $interests[0]->getInterest();
$this->assertTrue($int1 == $int2);
}
} | {
"content_hash": "adbe7f037ccea5495f41f9dc3d77cec7",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 84,
"avg_line_length": 23.64,
"alnum_prop": 0.583756345177665,
"repo_name": "ApprecieOpenSource/Apprecie",
"id": "08e90502cd543fc2f73dac3068d7c2d47e3b2a0a",
"size": "591",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/interests/InterestsTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "108116"
},
{
"name": "HTML",
"bytes": "7703483"
},
{
"name": "JavaScript",
"bytes": "907844"
},
{
"name": "PHP",
"bytes": "1507607"
},
{
"name": "TypeScript",
"bytes": "13932"
},
{
"name": "Volt",
"bytes": "1525542"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2014 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">
<scale android:interpolator="@android:anim/decelerate_interpolator"
android:fromXScale="1.0" android:toXScale="0.9"
android:fromYScale="1.0" android:toYScale="0.9"
android:pivotX="50%" android:pivotY="100%"
android:duration="@integer/abc_config_activityDefaultDur" />
<alpha android:interpolator="@android:anim/decelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@integer/abc_config_activityShortDur" />
</set><!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/lmp-mr1-supportlib-release/frameworks/support/v7/appcompat/res/anim/abc_shrink_fade_out_from_bottom.xml --><!-- From: file:/Users/Guest/Desktop/android_instagram/ParseStarterProject/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.0/res/anim/abc_shrink_fade_out_from_bottom.xml --> | {
"content_hash": "312f6788d53bfac66ac765937cebba0a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 433,
"avg_line_length": 64.5925925925926,
"alnum_prop": 0.7173165137614679,
"repo_name": "haleyharrison/android_instagram",
"id": "3ff22cd71461acfb829cead275b81ddff81a4763",
"size": "1744",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ParseStarterProject/build/intermediates/res/merged/debug/anim/abc_shrink_fade_out_from_bottom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "437245"
}
],
"symlink_target": ""
} |
package org.apereo.cas.support.oauth.web.response.accesstoken.ext;
import org.apereo.cas.support.oauth.OAuth20Constants;
import org.apereo.cas.support.oauth.OAuth20GrantTypes;
import org.apereo.cas.support.oauth.services.OAuthRegisteredService;
import org.apereo.cas.support.oauth.util.OAuth20Utils;
import org.apereo.cas.support.oauth.web.endpoints.OAuth20ConfigurationContext;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import javax.servlet.http.HttpServletRequest;
/**
* This is {@link AccessTokenRefreshTokenGrantRequestExtractor}.
*
* @author Misagh Moayyed
* @since 5.1.0
*/
@Slf4j
public class AccessTokenRefreshTokenGrantRequestExtractor extends AccessTokenAuthorizationCodeGrantRequestExtractor {
public AccessTokenRefreshTokenGrantRequestExtractor(final OAuth20ConfigurationContext oAuthConfigurationContext) {
super(oAuthConfigurationContext);
}
@Override
protected String getOAuthParameterName() {
return OAuth20Constants.REFRESH_TOKEN;
}
@Override
protected boolean isAllowedToGenerateRefreshToken() {
return false;
}
@Override
public boolean supports(final HttpServletRequest context) {
val grantType = context.getParameter(OAuth20Constants.GRANT_TYPE);
return OAuth20Utils.isGrantType(grantType, getGrantType());
}
@Override
public OAuth20GrantTypes getGrantType() {
return OAuth20GrantTypes.REFRESH_TOKEN;
}
@Override
protected OAuthRegisteredService getOAuthRegisteredServiceBy(final HttpServletRequest request) {
val clientId = getRegisteredServiceIdentifierFromRequest(request);
val registeredService = OAuth20Utils.getRegisteredOAuthServiceByClientId(getOAuthConfigurationContext().getServicesManager(), clientId);
LOGGER.debug("Located registered service [{}]", registeredService);
return registeredService;
}
@Override
protected String getRegisteredServiceIdentifierFromRequest(final HttpServletRequest request) {
return request.getParameter(OAuth20Constants.CLIENT_ID);
}
}
| {
"content_hash": "62599fc89a4fea94d9646ee36083db0f",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 144,
"avg_line_length": 35.42372881355932,
"alnum_prop": 0.7760765550239235,
"repo_name": "philliprower/cas",
"id": "b01b19089d7449da624aa0189de2923c6508f32a",
"size": "2090",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/ext/AccessTokenRefreshTokenGrantRequestExtractor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "750333"
},
{
"name": "Dockerfile",
"bytes": "2544"
},
{
"name": "Groovy",
"bytes": "19040"
},
{
"name": "HTML",
"bytes": "408841"
},
{
"name": "Java",
"bytes": "15178582"
},
{
"name": "JavaScript",
"bytes": "206200"
},
{
"name": "Python",
"bytes": "140"
},
{
"name": "Ruby",
"bytes": "1417"
},
{
"name": "Shell",
"bytes": "131196"
},
{
"name": "TypeScript",
"bytes": "251817"
}
],
"symlink_target": ""
} |
from __future__ import division, with_statement
import functools
# http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
def memoized(obj):
cache = obj.cache = {}
@functools.wraps(obj)
def memoizer(*args, **kwargs):
key = str(args) + str(kwargs)
if key not in cache:
cache[key] = obj(*args, **kwargs)
return cache[key]
return memoizer
class Name:
def __init__(self, name, years):
self.name = name
self.years = years
self.score = 0 # until scored
self.scores = {}
self.yearly_popularity = {"M": [0] * len(self.years),
"F": [0] * len(self.years)}
self.normed_popularity = {"M": [0] * len(self.years),
"F": [0] * len(self.years)}
self.nicknames = {}
self.full_names = {}
def add_popularity(self, year, gender, count):
self.yearly_popularity[gender][year - self.years[0]] = count
def normalize_popularities(self, yearly_totals):
for g in ["M", "F"]:
for i, total in enumerate(yearly_totals):
self.normed_popularity[g][i] = (
self.yearly_popularity[g][i] / total)
@memoized
def get_popularity(self, gender=None, year=None, emphasize_recent=False,
normalized=False):
popularity = 0
pops = self.normed_popularity if normalized else self.yearly_popularity
for g in ["M", "F"]:
if gender and gender != g: continue
if year:
popularity += pops[g][year - self.years[0]]
else:
if emphasize_recent:
for i, pop in enumerate(pops[g]):
popularity += pop * 2 * i / len(self.years)
else:
popularity += sum(pops[g])
return popularity
def add_metaphones(self, primary, secondary):
if secondary:
self.metaphones = [primary, secondary]
else:
self.metaphones = [primary]
def __str__(self):
return "<%s, F: %d, M: %d | %s>"%(
self.name, self.get_popularity('F'), self.get_popularity('M'),
', '.join(self.metaphones))
def to_dict(self):
o = {"name": self.name, "scores": self.scores, "genders": self.get_genders()}
if hasattr(self, "meaning"):
o['meaning'] = self.meaning
return o
def get_genders(self):
male_pop = self.get_popularity("M", normalized=True, emphasize_recent=True)
female_pop = self.get_popularity("F", normalized=True, emphasize_recent=True)
genders = []
if male_pop > 10 * female_pop:
genders = ["M"]
elif female_pop > 10 * male_pop:
genders = ["F"]
else:
genders = ["F", "M"]
return genders
def add_nickname(self, nick):
if nick.name in self.nicknames: return 0
if nick.name is self.name: return 0
#print "Found nickname", nick.name, "for", self.name, "from", nick.meaning
self.nicknames[nick.name] = nick
return 1 + nick.add_full_name(self)
def add_full_name(self, full):
if full.name in self.full_names: return 0
if full.name is self.name: return 0
self.full_names[full.name] = full
return 1 + full.add_nickname(self)
| {
"content_hash": "f0a567df335485d21b198c7fa9b90543",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 85,
"avg_line_length": 35.395833333333336,
"alnum_prop": 0.5397292525014714,
"repo_name": "nwinter/bantling",
"id": "c597b24bf562067bce9475c53fa9c9441c507502",
"size": "3440",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "scripts/name.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "27785"
},
{
"name": "CoffeeScript",
"bytes": "7673"
},
{
"name": "HTML",
"bytes": "39109"
},
{
"name": "Java",
"bytes": "189898"
},
{
"name": "JavaScript",
"bytes": "262063"
},
{
"name": "Python",
"bytes": "1733571"
}
],
"symlink_target": ""
} |
package eventkitui.test.page.navpanel.groups;
import eventkitui.test.page.core.LoadablePage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class NewGroupPage extends LoadablePage {
@FindBy(id = "custom-text-field") private WebElement groupNameField;
@FindBy(xpath = "//button[contains (@class, 'qa-CreateGroupDialog-save')]") private WebElement saveButton;
@FindBy(xpath = "//button[contains (@class, 'qa-CreateGroupDialog-cancel')]") private WebElement cancelButton;
public NewGroupPage(WebDriver driver, long timeout) {
super(driver, timeout);
}
@Override
public WebElement loadedElement() {
return groupNameField;
}
public WebElement getGroupNameField() {
return groupNameField;
}
public WebElement getSaveButton() {
return saveButton;
}
public WebElement getCancelButton() {
return cancelButton;
}
}
| {
"content_hash": "4ce5698a81c0aacd6f3d498d500002d4",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 114,
"avg_line_length": 29.08823529411765,
"alnum_prop": 0.7138523761375126,
"repo_name": "terranodo/eventkit-cloud",
"id": "4c0e504d1c138fc54b4309e5c24ad4ff3126e699",
"size": "989",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "selenium/src/test/java/eventkitui/test/page/navpanel/groups/NewGroupPage.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "72684"
},
{
"name": "HTML",
"bytes": "87673"
},
{
"name": "JavaScript",
"bytes": "3699859"
},
{
"name": "Python",
"bytes": "634218"
},
{
"name": "Shell",
"bytes": "15117"
}
],
"symlink_target": ""
} |
/*
* This file is part of Nucleus, licensed under the MIT License (MIT). See the LICENSE.txt file
* at the root of this project for more details.
*/
package io.github.nucleuspowered.nucleus.modules.teleport.commands;
import com.google.inject.Inject;
import io.github.nucleuspowered.nucleus.api.teleport.data.TeleportResult;
import io.github.nucleuspowered.nucleus.api.teleport.data.TeleportScanners;
import io.github.nucleuspowered.nucleus.modules.teleport.TeleportPermissions;
import io.github.nucleuspowered.nucleus.modules.teleport.config.TeleportConfig;
import io.github.nucleuspowered.nucleus.modules.teleport.services.PlayerTeleporterService;
import io.github.nucleuspowered.nucleus.core.scaffold.command.ICommandContext;
import io.github.nucleuspowered.nucleus.core.scaffold.command.ICommandExecutor;
import io.github.nucleuspowered.nucleus.core.scaffold.command.ICommandResult;
import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.Command;
import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.CommandModifier;
import io.github.nucleuspowered.nucleus.core.scaffold.command.annotation.EssentialsEquivalent;
import io.github.nucleuspowered.nucleus.core.scaffold.command.modifier.CommandModifiers;
import io.github.nucleuspowered.nucleus.core.services.INucleusServiceCollection;
import io.github.nucleuspowered.nucleus.core.services.interfaces.IPermissionService;
import io.github.nucleuspowered.nucleus.core.services.interfaces.IReloadableService;
import io.github.nucleuspowered.nucleus.modules.teleport.services.TPAResult;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.exception.CommandException;
import org.spongepowered.api.command.parameter.Parameter;
import org.spongepowered.api.command.parameter.managed.Flag;
import org.spongepowered.api.entity.living.player.User;
import org.spongepowered.api.entity.living.player.server.ServerPlayer;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.api.world.server.ServerWorld;
import java.util.Optional;
import java.util.UUID;
import java.util.function.Supplier;
@EssentialsEquivalent(value = {"tp", "tele", "tp2p", "teleport", "tpo"}, isExact = false,
notes = "If you have permission, this will override '/tptoggle' automatically.")
@Command(
aliases = {"teleport", "tele", "$tp"},
basePermission = TeleportPermissions.BASE_TELEPORT,
commandDescriptionKey = "teleport",
modifiers = {
@CommandModifier(
value = CommandModifiers.HAS_WARMUP,
exemptPermission = TeleportPermissions.EXEMPT_WARMUP_TELEPORT
),
@CommandModifier(
value = CommandModifiers.HAS_COOLDOWN,
exemptPermission = TeleportPermissions.EXEMPT_COOLDOWN_TELEPORT
),
@CommandModifier(
value = CommandModifiers.HAS_COST,
exemptPermission = TeleportPermissions.EXEMPT_COST_TELEPORT
)
},
associatedPermissions = {
TeleportPermissions.TELEPORT_OFFLINE,
TeleportPermissions.TELEPORT_QUIET,
TeleportPermissions.OTHERS_TELEPORT,
TeleportPermissions.TPTOGGLE_EXEMPT
}
)
public class TeleportCommand implements ICommandExecutor, IReloadableService.Reloadable {
private final Parameter.Value<UUID> userToWarp;
private final Parameter.Value<ServerPlayer> playerToWarp;
private final Parameter.Value<UUID> userToWarpTo;
private final Parameter.Value<ServerPlayer> playerToWarpTo;
private final Parameter.Value<Boolean> quietOption = Parameter.bool().key("quiet").build();
private boolean isDefaultQuiet = false;
@Inject
public TeleportCommand(final INucleusServiceCollection serviceCollection) {
final IPermissionService permissionService = serviceCollection.permissionService();
this.userToWarp = Parameter.user()
.key("Offline player to warp")
.requirements(cause ->
permissionService.hasPermission(cause, TeleportPermissions.OTHERS_TELEPORT) &&
permissionService.hasPermission(cause, TeleportPermissions.TELEPORT_OFFLINE))
.build();
this.playerToWarp = Parameter.player()
.key("Player to warp")
.requirements(cause -> permissionService.hasPermission(cause, TeleportPermissions.OTHERS_TELEPORT))
.build();
this.userToWarpTo = Parameter.user()
.key("Offline player to warp to")
.requirements(cause -> permissionService.hasPermission(cause, TeleportPermissions.TELEPORT_OFFLINE))
.build();
this.playerToWarpTo = Parameter.player()
.key("Player to warp to")
.build();
}
@Override public void onReload(final INucleusServiceCollection serviceCollection) {
this.isDefaultQuiet = serviceCollection.configProvider().getModuleConfig(TeleportConfig.class).isDefaultQuiet();
}
@Override
public Flag[] flags(final INucleusServiceCollection serviceCollection) {
return new Flag[] {
Flag.of("f"),
Flag.builder().alias("q")
.setParameter(this.quietOption)
.setRequirement(commandCause -> serviceCollection.permissionService().hasPermission(commandCause, TeleportPermissions.TELEPORT_QUIET))
.build()
};
}
@Override
public Parameter[] parameters(final INucleusServiceCollection serviceCollection) {
return new Parameter[] {
Parameter.firstOf(
Parameter.seq(this.playerToWarp, Parameter.firstOf(this.playerToWarpTo, this.userToWarpTo)), // <player from> <to>
Parameter.seq(this.userToWarp, Parameter.firstOf(this.playerToWarpTo, this.userToWarpTo)), // <user from> <to>
this.playerToWarpTo, // <player to>
this.userToWarpTo // <user to>
)
};
}
@Override
public Optional<ICommandResult> preExecute(final ICommandContext context) {
@Nullable final User source =
context.getOptionalUserFromUUID(this.userToWarp)
.orElseGet(() -> context.getOne(this.playerToWarp).map(ServerPlayer::user).orElse(null));
final boolean isOther = source != null && context.uniqueId().filter(x -> !x.equals(source.uniqueId())).isPresent();
final User to = context.getOptionalUserFromUUID(this.userToWarpTo).orElseGet(() -> context.requireOne(this.playerToWarpTo).user());
final TPAResult result = context.getServiceCollection()
.getServiceUnchecked(PlayerTeleporterService.class)
.canTeleportTo(context.audience(), source, to, isOther);
if (result.isSuccess()) {
return Optional.empty();
}
return Optional.of(context.errorResult(result.key(), result.name()));
}
@Override public ICommandResult execute(final ICommandContext context) throws CommandException {
@Nullable final User externalSource =
context.getOptionalUserFromUUID(this.userToWarp)
.orElseGet(() -> context.getOne(this.playerToWarp).map(ServerPlayer::user).orElse(null));
@NonNull final User source;
if (externalSource != null) {
source = externalSource;
} else {
source = context.requirePlayer().user();
}
final boolean isOther = context.uniqueId().filter(x -> !x.equals(source.uniqueId())).isPresent();
final User to = context.getOptionalUserFromUUID(this.userToWarpTo).orElseGet(() -> context.requireOne(this.playerToWarpTo).user());
final boolean beQuiet = context.getOne(this.quietOption).orElse(this.isDefaultQuiet);
if (source.isOnline() && to.isOnline()) {
final TeleportResult result =
context.getServiceCollection()
.getServiceUnchecked(PlayerTeleporterService.class)
.teleportWithMessage(
context.audience(),
source.player().get(),
to.player().get(),
!context.hasFlag("f"),
false,
beQuiet
);
return result.isSuccessful() ? context.successResult() : context.failResult();
}
// We have an offline player.
if (!context.testPermission(TeleportPermissions.TELEPORT_OFFLINE)) {
return context.errorResult("command.teleport.noofflineperms");
}
// Can we get a location?
final Supplier<CommandException> r = () -> context.createException("command.teleport.nolastknown", to.name());
if (!source.isOnline()) {
if (source.setLocation(to.worldKey(), to.position())) {
context.sendMessage("command.teleport.offline.other", source.name(), to.name());
return context.successResult();
}
} else {
final ServerWorld w = Sponge.server().worldManager().world(to.worldKey()).orElseThrow(r);
final ServerLocation l = ServerLocation.of(w, to.position());
final boolean result = context.getServiceCollection()
.teleportService()
.teleportPlayerSmart(
source.player().get(),
l,
false,
true,
TeleportScanners.NO_SCAN.get()
).isSuccessful();
if (result) {
if (isOther) {
context.sendMessage("command.teleport.offline.other", source.name(), to.name());
}
context.sendMessage("command.teleport.offline.self", to.name());
return context.successResult();
}
}
return context.errorResult("command.teleport.error");
}
}
| {
"content_hash": "785711d65e062057d4f2d4efe3c84dcb",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 158,
"avg_line_length": 49.08450704225352,
"alnum_prop": 0.6425633668101387,
"repo_name": "NucleusPowered/Nucleus",
"id": "2dcf090e09e4ce413ae0e10f937f15b3c7baa238",
"size": "10455",
"binary": false,
"copies": "1",
"ref": "refs/heads/v3",
"path": "nucleus-modules/src/main/java/io/github/nucleuspowered/nucleus/modules/teleport/commands/TeleportCommand.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "2917844"
},
{
"name": "JavaScript",
"bytes": "975"
},
{
"name": "Kotlin",
"bytes": "36321"
},
{
"name": "Shell",
"bytes": "80"
}
],
"symlink_target": ""
} |
@implementation TKAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[TKNavigationController alloc] initWithRootViewController:[self topViewController]
navigatorToolBar:[self toolBar]
bottomViewController:[self bottomViewController]];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
- (UIViewController *)bottomViewController{
UIViewController *vc = [[TKViewController alloc] init];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back",nil)
style:UIBarButtonItemStyleBordered
target:self
action:@selector(hideBottom:)];
vc.navigationItem.leftBarButtonItem = backButton;
UINavigationController *bottomNav = [[UINavigationController alloc] initWithRootViewController:vc];
return bottomNav;
}
- (UIViewController *)topViewController{
UINavigationController *topNav = [[UINavigationController alloc] initWithRootViewController:[[TKViewController alloc] init]];
return topNav;
}
- (UIView *)toolBar{
UILabel *toolBar = [[UILabel alloc] initWithFrame:CGRectZero];
toolBar.text = NSLocalizedString(@"Checkout with 10 items",nil);
toolBar.backgroundColor = [UIColor colorWithRed:0.220 green:0.922 blue:0.349 alpha:1.000];
toolBar.font = [UIFont boldSystemFontOfSize:24.0f];
toolBar.textAlignment = NSTextAlignmentCenter;
return toolBar;
}
- (void)hideBottom:(id)sender{
[self.viewController.TKNavigationController showBottomViewController:NO animated:YES completion:nil];
}
@end
| {
"content_hash": "07b057bf21a7eced1c3efcdec55162e0",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 129,
"avg_line_length": 44.869565217391305,
"alnum_prop": 0.6497093023255814,
"repo_name": "mapedd/TKNavigationController",
"id": "e322b7600b24438b2f72e15c15f50c6de6f26d7a",
"size": "2309",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "TKNavigationControllerDemo/TKAppDelegate.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "11728"
},
{
"name": "Ruby",
"bytes": "525"
}
],
"symlink_target": ""
} |
package com.ansteel.common.tpl.domain;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import com.ansteel.core.constant.Constants;
import com.ansteel.core.domain.OperEntity;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* 创 建 人:gugu
* 创建日期:2015-05-17
* 修 改 人:
* 修改日 期:
* 描 述:模板实体。
*/
@Entity
@Table(name = Constants.G_TABLE_PREFIX + "tpl")
public class Tpl extends OperEntity {
/**
*
*/
private static final long serialVersionUID = 1624423892211131614L;
/**
* 描述
*/
@Column(length = 4000)
private String scription;
/**
* 模块全名称
*/
private String moduleClass;
/**
* 模板路径
*/
private String tplPath;
/**
* 模板jsp名称
*/
private String jspName;
/**
* 所占列数
*/
private Integer columnNumber;
/**
* 是否表格编辑
*/
private Integer isTableEditor;
/**
* 项内容(数)的偏移量。对于块项目唯一
*/
private Number blockOffset ;
/**
* 设置输入的高度。默认值是自动
*/
private Integer inputHeight ;
/**
* 设置输入的宽度。默认值是自动
*/
private Integer inputWidth ;
/**
* (左,右或中心)(left, right or center) 的标签定义的宽度内的对准
*/
private String labelAlign ;
/**
* (整数或自动)设置标签的高度。默认值是自动
*/
private String labelHeight ;
/**
* (整数或自动)设置标签的宽度。默认值是自动
*/
private Integer labelWidth ;
/**
* (整数或自动)设置的细节的宽度方框(其被放置在输入下)
*/
private Integer noteWidth ;
/**
* (整数)设置在左侧的相对项的偏移(两个输入和标签)
*/
private Integer offsetLeft ;
/**
* (整数)设置顶相对项的偏移(两个输入和标签)
*/
private Integer offsetTop ;
/**
* (标签左,标签右,标记顶或绝对)(label-left, label-right, label-top or absolute) 定义相对于输入标签的位置
*/
private String position ;
/**
* 表单块宽度
*/
private Integer blockWidth ;
@Column(name = "VERSION_PUBLISH", columnDefinition="INT default 0")
private Long versionPublish;
public Long getVersionPublish() {
return versionPublish;
}
public void setVersionPublish(Long versionPublish) {
this.versionPublish = versionPublish;
}
public Integer getBlockWidth() {
return blockWidth;
}
public void setBlockWidth(Integer blockWidth) {
this.blockWidth = blockWidth;
}
public Number getBlockOffset() {
return blockOffset;
}
public void setBlockOffset(Number blockOffset) {
this.blockOffset = blockOffset;
}
public Integer getInputHeight() {
return inputHeight;
}
public void setInputHeight(Integer inputHeight) {
this.inputHeight = inputHeight;
}
public Integer getInputWidth() {
return inputWidth;
}
public void setInputWidth(Integer inputWidth) {
this.inputWidth = inputWidth;
}
public String getLabelAlign() {
return labelAlign;
}
public void setLabelAlign(String labelAlign) {
this.labelAlign = labelAlign;
}
public String getLabelHeight() {
return labelHeight;
}
public void setLabelHeight(String labelHeight) {
this.labelHeight = labelHeight;
}
public Integer getLabelWidth() {
return labelWidth;
}
public void setLabelWidth(Integer labelWidth) {
this.labelWidth = labelWidth;
}
public Integer getNoteWidth() {
return noteWidth;
}
public void setNoteWidth(Integer noteWidth) {
this.noteWidth = noteWidth;
}
public Integer getOffsetLeft() {
return offsetLeft;
}
public void setOffsetLeft(Integer offsetLeft) {
this.offsetLeft = offsetLeft;
}
public Integer getOffsetTop() {
return offsetTop;
}
public void setOffsetTop(Integer offsetTop) {
this.offsetTop = offsetTop;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public Integer getIsTableEditor() {
return isTableEditor;
}
public void setIsTableEditor(Integer isTableEditor) {
this.isTableEditor = isTableEditor;
}
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tpl")
@Fetch(FetchMode.SUBSELECT)
@OrderBy("displayOrder")
@JsonIgnore
private Collection<TplCss> tplCssList = new ArrayList<TplCss>();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tpl")
@Fetch(FetchMode.SUBSELECT)
@OrderBy("displayOrder")
@JsonIgnore
private Collection<TplUrl> tplUrlList = new ArrayList<TplUrl>();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tpl")
@Fetch(FetchMode.SUBSELECT)
@OrderBy("displayOrder")
@JsonIgnore
private Collection<TplSecurity> tplSecurityList=new ArrayList<TplSecurity>();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tpl")
@Fetch(FetchMode.SUBSELECT)
@OrderBy("displayOrder")
@JsonIgnore
private Collection<TplVariable> tplVariableList=new ArrayList<TplVariable>();
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "tpl")
@Fetch(FetchMode.SUBSELECT)
@OrderBy("displayOrder")
@JsonIgnore
private Collection<TplJavascript> javaScriptList=new ArrayList<TplJavascript>();
public Collection<TplVariable> getTplVariableList() {
return tplVariableList;
}
public void setTplVariableList(Collection<TplVariable> tplVariableList) {
this.tplVariableList = tplVariableList;
}
public Collection<TplSecurity> getTplSecurityList() {
return tplSecurityList;
}
public void setTplSecurityList(Collection<TplSecurity> tplSecurityList) {
this.tplSecurityList = tplSecurityList;
}
public Collection<TplJavascript> getJavaScriptList() {
return javaScriptList;
}
public void setJavaScriptList(Collection<TplJavascript> javaScriptList) {
this.javaScriptList = javaScriptList;
}
public Collection<TplCss> getTplCssList() {
return tplCssList;
}
public void setTplCssList(Collection<TplCss> tplCssList) {
this.tplCssList = tplCssList;
}
public Integer getColumnNumber() {
return columnNumber;
}
public void setColumnNumber(Integer columnNumber) {
this.columnNumber = columnNumber;
}
public String getScription() {
return scription;
}
public void setScription(String scription) {
this.scription = scription;
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(getId()).toHashCode();
}
public String getTplPath() {
return tplPath;
}
public void setTplPath(String tplPath) {
this.tplPath = tplPath;
}
public String getJspName() {
return jspName;
}
public void setJspName(String jspName) {
this.jspName = jspName;
}
public Collection<TplUrl> getTplUrlList() {
return tplUrlList;
}
public void setTplUrlList(Collection<TplUrl> tplUrlList) {
this.tplUrlList = tplUrlList;
}
public String getModuleClass() {
return moduleClass;
}
public void setModuleClass(String moduleClass) {
this.moduleClass = moduleClass;
}
}
| {
"content_hash": "1971e3ef9208ff0bb789d52a59938434",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 82,
"avg_line_length": 20.56756756756757,
"alnum_prop": 0.7316396554241495,
"repo_name": "LittleLazyCat/TXEYXXK",
"id": "5daa61882a2607846e4c556102820bc8a3f6071f",
"size": "7381",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "2017workspace/go-public/go-core/src/main/java/com/ansteel/common/tpl/domain/Tpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "35841"
},
{
"name": "ApacheConf",
"bytes": "768"
},
{
"name": "Batchfile",
"bytes": "2067"
},
{
"name": "C#",
"bytes": "16030"
},
{
"name": "CSS",
"bytes": "3799756"
},
{
"name": "FreeMarker",
"bytes": "33818"
},
{
"name": "HTML",
"bytes": "4677568"
},
{
"name": "Java",
"bytes": "13081066"
},
{
"name": "JavaScript",
"bytes": "30072557"
},
{
"name": "PHP",
"bytes": "38697"
},
{
"name": "PLSQL",
"bytes": "13547"
},
{
"name": "PLpgSQL",
"bytes": "5316"
},
{
"name": "Shell",
"bytes": "1357"
}
],
"symlink_target": ""
} |
@interface ARNImageStoreCache : NSObject
+ (void)clear;
+ (void)setThumbnailCacheLimit:(NSUInteger)cacheLimit;
+ (void)setImageCacheLimit:(NSUInteger)cacheLimit;
+ (void)addThumbnailImageWithImage:(UIImage *)image imageURL:(NSURL *)imageURL;
+ (void)addImageWithImage:(UIImage *)image imageURL:(NSURL *)imageURL;
+ (UIImage *)cacheThumbnailImageWIthURL:(NSURL *)imageURL;
+ (UIImage *)cacheImageWIthURL:(NSURL *)imageURL;
@end
| {
"content_hash": "0639f3fb666422ad0c06ee437c8d31ca",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 30.857142857142858,
"alnum_prop": 0.7754629629629629,
"repo_name": "xxxAIRINxxx/ARNImageCache",
"id": "4c9783089298afcbc3bd48fd7a4ad8b8c863781b",
"size": "714",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Pod/Classes/ARNImageStoreCache.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "6078"
},
{
"name": "Objective-C",
"bytes": "169987"
},
{
"name": "Ruby",
"bytes": "2900"
},
{
"name": "Shell",
"bytes": "7260"
}
],
"symlink_target": ""
} |
from .base import BaseImporter
from pupa.utils import get_pseudo_id, _make_pseudo_id
from opencivicdata.legislative.models import (Event, EventLocation, EventSource, EventDocument,
EventDocumentLink, EventLink, EventParticipant,
EventMedia, EventMediaLink, EventAgendaItem,
EventRelatedEntity, EventAgendaMedia,
EventAgendaMediaLink)
class EventImporter(BaseImporter):
_type = 'event'
model_class = Event
related_models = {
'sources': (EventSource, 'event_id', {}),
'documents': (EventDocument, 'event_id', {
'links': (EventDocumentLink, 'document_id', {})
}),
'links': (EventLink, 'event_id', {}),
'participants': (EventParticipant, 'event_id', {}),
'media': (EventMedia, 'event_id', {
'links': (EventMediaLink, 'media_id', {}),
}),
'agenda': (EventAgendaItem, 'event_id', {
'related_entities': (EventRelatedEntity, 'agenda_item_id', {}),
'media': (EventAgendaMedia, 'agenda_item_id', {
'links': (EventAgendaMediaLink, 'media_id', {}),
}),
})
}
preserve_order = ('agenda',)
def __init__(self, jurisdiction_id, org_importer, person_importer, bill_importer,
vote_event_importer):
super(EventImporter, self).__init__(jurisdiction_id)
self.org_importer = org_importer
self.person_importer = person_importer
self.bill_importer = bill_importer
self.vote_event_importer = vote_event_importer
def get_object(self, event):
if event.get('pupa_id'):
e_id = self.lookup_obj_id(event['pupa_id'], Event)
if e_id:
spec = {'id': e_id}
else:
return None
else:
spec = {
'name': event['name'],
'description': event['description'],
'start_date': event['start_date'],
'end_date': event['end_date'],
'jurisdiction_id': self.jurisdiction_id
}
return self.model_class.objects.get(**spec)
def get_location(self, location_data):
obj, created = EventLocation.objects.get_or_create(name=location_data['name'],
url=location_data.get('url', ''),
jurisdiction_id=self.jurisdiction_id)
# TODO: geocode here?
return obj
def prepare_for_db(self, data):
data['jurisdiction_id'] = self.jurisdiction_id
if data['location']:
data['location'] = self.get_location(data['location'])
data['start_date'] = data['start_date']
data['end_date'] = data.get('end_date', "")
for participant in data['participants']:
if 'person_id' in participant:
participant['person_id'] = self.person_importer.resolve_json_id(
participant['person_id'],
allow_no_match=True)
elif 'organization_id' in participant:
participant['organization_id'] = self.org_importer.resolve_json_id(
participant['organization_id'],
allow_no_match=True)
for item in data['agenda']:
for entity in item['related_entities']:
if 'person_id' in entity:
entity['person_id'] = self.person_importer.resolve_json_id(
entity['person_id'],
allow_no_match=True)
elif 'organization_id' in entity:
entity['organization_id'] = self.org_importer.resolve_json_id(
entity['organization_id'],
allow_no_match=True)
elif 'bill_id' in entity:
# unpack and repack bill psuedo id in case filters alter it
bill = get_pseudo_id(entity['bill_id'])
self.bill_importer.apply_transformers(bill)
bill = _make_pseudo_id(**bill)
entity['bill_id'] = self.bill_importer.resolve_json_id(
bill,
allow_no_match=True)
elif 'vote_event_id' in entity:
entity['vote_event_id'] = self.vote_event_importer.resolve_json_id(
entity['vote_event_id'],
allow_no_match=True)
return data
| {
"content_hash": "93d576f2d063ce06ea0f7987e775e3ab",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 96,
"avg_line_length": 44.371428571428574,
"alnum_prop": 0.5091221292122773,
"repo_name": "opencivicdata/pupa",
"id": "8d4e0dac52f85bf225d45d836f42ae53a562bd1b",
"size": "4659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pupa/importers/events.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "297332"
},
{
"name": "Shell",
"bytes": "109"
}
],
"symlink_target": ""
} |
static sandbox::BrokerServices* g_broker_services = NULL;
namespace content {
namespace {
// The DLLs listed here are known (or under strong suspicion) of causing crashes
// when they are loaded in the renderer. Note: at runtime we generate short
// versions of the dll name only if the dll has an extension.
// For more information about how this list is generated, and how to get off
// of it, see:
// https://sites.google.com/a/chromium.org/dev/Home/third-party-developers
const wchar_t* const kTroublesomeDlls[] = {
L"adialhk.dll", // Kaspersky Internet Security.
L"acpiz.dll", // Unknown.
L"activedetect32.dll", // Lenovo One Key Theater (crbug.com/536056).
L"activedetect64.dll", // Lenovo One Key Theater (crbug.com/536056).
L"airfoilinject3.dll", // Airfoil.
L"akinsofthook32.dll", // Akinsoft Software Engineering.
L"assistant_x64.dll", // Unknown.
L"avcuf64.dll", // Bit Defender Internet Security x64.
L"avgrsstx.dll", // AVG 8.
L"babylonchromepi.dll", // Babylon translator.
L"btkeyind.dll", // Widcomm Bluetooth.
L"cmcsyshk.dll", // CMC Internet Security.
L"cmsetac.dll", // Unknown (suspected malware).
L"cooliris.dll", // CoolIris.
L"cplushook.dll", // Unknown (suspected malware).
L"dockshellhook.dll", // Stardock Objectdock.
L"easyhook32.dll", // GDIPP and others.
L"esspd.dll", // Samsung Smart Security ESCORT.
L"googledesktopnetwork3.dll", // Google Desktop Search v5.
L"fwhook.dll", // PC Tools Firewall Plus.
L"guard64.dll", // Comodo Internet Security x64.
L"hookprocesscreation.dll", // Blumentals Program protector.
L"hookterminateapis.dll", // Blumentals and Cyberprinter.
L"hookprintapis.dll", // Cyberprinter.
L"imon.dll", // NOD32 Antivirus.
L"icatcdll.dll", // Samsung Smart Security ESCORT.
L"icdcnl.dll", // Samsung Smart Security ESCORT.
L"ioloHL.dll", // Iolo (System Mechanic).
L"kloehk.dll", // Kaspersky Internet Security.
L"lawenforcer.dll", // Spyware-Browser AntiSpyware (Spybro).
L"libdivx.dll", // DivX.
L"lvprcinj01.dll", // Logitech QuickCam.
L"madchook.dll", // Madshi (generic hooking library).
L"mdnsnsp.dll", // Bonjour.
L"moonsysh.dll", // Moon Secure Antivirus.
L"mpk.dll", // KGB Spy.
L"npdivx32.dll", // DivX.
L"npggNT.des", // GameGuard 2008.
L"npggNT.dll", // GameGuard (older).
L"oawatch.dll", // Online Armor.
L"pastali32.dll", // PastaLeads.
L"pavhook.dll", // Panda Internet Security.
L"pavlsphook.dll", // Panda Antivirus.
L"pavshook.dll", // Panda Antivirus.
L"pavshookwow.dll", // Panda Antivirus.
L"pctavhook.dll", // PC Tools Antivirus.
L"pctgmhk.dll", // PC Tools Spyware Doctor.
L"picrmi32.dll", // PicRec.
L"picrmi64.dll", // PicRec.
L"prntrack.dll", // Pharos Systems.
L"protector.dll", // Unknown (suspected malware).
L"radhslib.dll", // Radiant Naomi Internet Filter.
L"radprlib.dll", // Radiant Naomi Internet Filter.
L"rapportnikko.dll", // Trustware Rapport.
L"rlhook.dll", // Trustware Bufferzone.
L"rooksdol.dll", // Trustware Rapport.
L"rndlpepperbrowserrecordhelper.dll", // RealPlayer.
L"rpchromebrowserrecordhelper.dll", // RealPlayer.
L"r3hook.dll", // Kaspersky Internet Security.
L"sahook.dll", // McAfee Site Advisor.
L"sbrige.dll", // Unknown.
L"sc2hook.dll", // Supercopier 2.
L"sdhook32.dll", // Spybot - Search & Destroy Live Protection.
L"sguard.dll", // Iolo (System Guard).
L"smum32.dll", // Spyware Doctor version 6.
L"smumhook.dll", // Spyware Doctor version 5.
L"ssldivx.dll", // DivX.
L"syncor11.dll", // SynthCore Midi interface.
L"systools.dll", // Panda Antivirus.
L"tfwah.dll", // Threatfire (PC tools).
L"wblind.dll", // Stardock Object desktop.
L"wbhelp.dll", // Stardock Object desktop.
L"windowsapihookdll32.dll", // Lenovo One Key Theater (crbug.com/536056).
L"windowsapihookdll64.dll", // Lenovo One Key Theater (crbug.com/536056).
L"winstylerthemehelper.dll" // Tuneup utilities 2006.
};
#if !defined(NACL_WIN64)
// Adds the policy rules for the path and path\ with the semantic |access|.
// If |children| is set to true, we need to add the wildcard rules to also
// apply the rule to the subfiles and subfolders.
bool AddDirectory(int path, const wchar_t* sub_dir, bool children,
sandbox::TargetPolicy::Semantics access,
sandbox::TargetPolicy* policy) {
base::FilePath directory;
if (!PathService::Get(path, &directory))
return false;
if (sub_dir)
directory = base::MakeAbsoluteFilePath(directory.Append(sub_dir));
sandbox::ResultCode result;
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, access,
directory.value().c_str());
if (result != sandbox::SBOX_ALL_OK)
return false;
std::wstring directory_str = directory.value() + L"\\";
if (children)
directory_str += L"*";
// Otherwise, add the version of the path that ends with a separator.
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES, access,
directory_str.c_str());
if (result != sandbox::SBOX_ALL_OK)
return false;
return true;
}
#endif // !defined(NACL_WIN64)
// Compares the loaded |module| file name matches |module_name|.
bool IsExpandedModuleName(HMODULE module, const wchar_t* module_name) {
wchar_t path[MAX_PATH];
DWORD sz = ::GetModuleFileNameW(module, path, arraysize(path));
if ((sz == arraysize(path)) || (sz == 0)) {
// XP does not set the last error properly, so we bail out anyway.
return false;
}
if (!::GetLongPathName(path, path, arraysize(path)))
return false;
base::FilePath fname(path);
return (fname.BaseName().value() == module_name);
}
// Adds a single dll by |module_name| into the |policy| blacklist.
// If |check_in_browser| is true we only add an unload policy only if the dll
// is also loaded in this process.
void BlacklistAddOneDll(const wchar_t* module_name,
bool check_in_browser,
sandbox::TargetPolicy* policy) {
HMODULE module = check_in_browser ? ::GetModuleHandleW(module_name) : NULL;
if (!module) {
// The module could have been loaded with a 8.3 short name. We check
// the three most common cases: 'thelongname.dll' becomes
// 'thelon~1.dll', 'thelon~2.dll' and 'thelon~3.dll'.
std::wstring name(module_name);
size_t period = name.rfind(L'.');
DCHECK_NE(std::string::npos, period);
DCHECK_LE(3U, (name.size() - period));
if (period <= 8)
return;
for (wchar_t ix = '1'; ix <= '3'; ++ix) {
const wchar_t suffix[] = {'~', ix, 0};
std::wstring alt_name = name.substr(0, 6) + suffix;
alt_name += name.substr(period, name.size());
if (check_in_browser) {
module = ::GetModuleHandleW(alt_name.c_str());
if (!module)
return;
// We found it, but because it only has 6 significant letters, we
// want to make sure it is the right one.
if (!IsExpandedModuleName(module, module_name))
return;
}
// Found a match. We add both forms to the policy.
policy->AddDllToUnload(alt_name.c_str());
}
}
policy->AddDllToUnload(module_name);
DVLOG(1) << "dll to unload found: " << module_name;
return;
}
// Adds policy rules for unloaded the known dlls that cause chrome to crash.
// Eviction of injected DLLs is done by the sandbox so that the injected module
// does not get a chance to execute any code.
void AddGenericDllEvictionPolicy(sandbox::TargetPolicy* policy) {
for (int ix = 0; ix != arraysize(kTroublesomeDlls); ++ix)
BlacklistAddOneDll(kTroublesomeDlls[ix], true, policy);
}
// Returns the object path prepended with the current logon session.
base::string16 PrependWindowsSessionPath(const base::char16* object) {
// Cache this because it can't change after process creation.
static DWORD s_session_id = 0;
if (s_session_id == 0) {
HANDLE token;
DWORD session_id_length;
DWORD session_id = 0;
CHECK(::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token));
CHECK(::GetTokenInformation(token, TokenSessionId, &session_id,
sizeof(session_id), &session_id_length));
CloseHandle(token);
if (session_id)
s_session_id = session_id;
}
return base::StringPrintf(L"\\Sessions\\%lu%ls", s_session_id, object);
}
// Checks if the sandbox should be let to run without a job object assigned.
bool ShouldSetJobLevel(const base::CommandLine& cmd_line) {
if (!cmd_line.HasSwitch(switches::kAllowNoSandboxJob))
return true;
// Windows 8 allows nested jobs so we don't need to check if we are in other
// job.
if (base::win::GetVersion() >= base::win::VERSION_WIN8)
return true;
BOOL in_job = true;
// Either there is no job yet associated so we must add our job,
if (!::IsProcessInJob(::GetCurrentProcess(), NULL, &in_job))
NOTREACHED() << "IsProcessInJob failed. " << GetLastError();
if (!in_job)
return true;
// ...or there is a job but the JOB_OBJECT_LIMIT_BREAKAWAY_OK limit is set.
JOBOBJECT_EXTENDED_LIMIT_INFORMATION job_info = {};
if (!::QueryInformationJobObject(NULL,
JobObjectExtendedLimitInformation, &job_info,
sizeof(job_info), NULL)) {
NOTREACHED() << "QueryInformationJobObject failed. " << GetLastError();
return true;
}
if (job_info.BasicLimitInformation.LimitFlags & JOB_OBJECT_LIMIT_BREAKAWAY_OK)
return true;
return false;
}
// Adds the generic policy rules to a sandbox TargetPolicy.
sandbox::ResultCode AddGenericPolicy(sandbox::TargetPolicy* policy) {
sandbox::ResultCode result;
// Add the policy for the client side of a pipe. It is just a file
// in the \pipe\ namespace. We restrict it to pipes that start with
// "chrome." so the sandboxed process cannot connect to system services.
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_ANY,
L"\\??\\pipe\\chrome.*");
if (result != sandbox::SBOX_ALL_OK)
return result;
// Add the policy for the server side of nacl pipe. It is just a file
// in the \pipe\ namespace. We restrict it to pipes that start with
// "chrome.nacl" so the sandboxed process cannot connect to
// system services.
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
L"\\\\.\\pipe\\chrome.nacl.*");
if (result != sandbox::SBOX_ALL_OK)
return result;
// Allow the server side of sync sockets, which are pipes that have
// the "chrome.sync" namespace and a randomly generated suffix.
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
L"\\\\.\\pipe\\chrome.sync.*");
if (result != sandbox::SBOX_ALL_OK)
return result;
// Add the policy for debug message only in debug
#ifndef NDEBUG
base::FilePath app_dir;
if (!PathService::Get(base::DIR_MODULE, &app_dir))
return sandbox::SBOX_ERROR_GENERIC;
wchar_t long_path_buf[MAX_PATH];
DWORD long_path_return_value = GetLongPathName(app_dir.value().c_str(),
long_path_buf,
MAX_PATH);
if (long_path_return_value == 0 || long_path_return_value >= MAX_PATH)
return sandbox::SBOX_ERROR_NO_SPACE;
base::FilePath debug_message(long_path_buf);
debug_message = debug_message.AppendASCII("debug_message.exe");
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS,
sandbox::TargetPolicy::PROCESS_MIN_EXEC,
debug_message.value().c_str());
if (result != sandbox::SBOX_ALL_OK)
return result;
#endif // NDEBUG
// Add the policy for read-only PDB file access for stack traces.
#if !defined(OFFICIAL_BUILD)
base::FilePath exe;
if (!PathService::Get(base::FILE_EXE, &exe))
return sandbox::SBOX_ERROR_GENERIC;
base::FilePath pdb_path = exe.DirName().Append(L"*.pdb");
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_READONLY,
pdb_path.value().c_str());
if (result != sandbox::SBOX_ALL_OK)
return result;
#endif
#if defined(SANITIZER_COVERAGE)
DWORD coverage_dir_size =
::GetEnvironmentVariable(L"SANITIZER_COVERAGE_DIR", NULL, 0);
if (coverage_dir_size == 0) {
LOG(WARNING) << "SANITIZER_COVERAGE_DIR was not set, coverage won't work.";
} else {
std::wstring coverage_dir;
wchar_t* coverage_dir_str =
base::WriteInto(&coverage_dir, coverage_dir_size);
coverage_dir_size = ::GetEnvironmentVariable(
L"SANITIZER_COVERAGE_DIR", coverage_dir_str, coverage_dir_size);
CHECK(coverage_dir.size() == coverage_dir_size);
base::FilePath sancov_path =
base::FilePath(coverage_dir).Append(L"*.sancov");
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_ANY,
sancov_path.value().c_str());
if (result != sandbox::SBOX_ALL_OK)
return result;
}
#endif
AddGenericDllEvictionPolicy(policy);
return sandbox::SBOX_ALL_OK;
}
sandbox::ResultCode AddPolicyForSandboxedProcess(
sandbox::TargetPolicy* policy) {
sandbox::ResultCode result = sandbox::SBOX_ALL_OK;
// Win8+ adds a device DeviceApi that we don't need.
if (base::win::GetVersion() > base::win::VERSION_WIN7)
result = policy->AddKernelObjectToClose(L"File", L"\\Device\\DeviceApi");
if (result != sandbox::SBOX_ALL_OK)
return result;
// Close the proxy settings on XP.
if (base::win::GetVersion() <= base::win::VERSION_SERVER_2003)
result = policy->AddKernelObjectToClose(L"Key",
L"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\" \
L"CurrentVersion\\Internet Settings");
if (result != sandbox::SBOX_ALL_OK)
return result;
sandbox::TokenLevel initial_token = sandbox::USER_UNPROTECTED;
if (base::win::GetVersion() > base::win::VERSION_XP) {
// On 2003/Vista the initial token has to be restricted if the main
// token is restricted.
initial_token = sandbox::USER_RESTRICTED_SAME_ACCESS;
}
result = policy->SetTokenLevel(initial_token, sandbox::USER_LOCKDOWN);
if (result != sandbox::SBOX_ALL_OK)
return result;
// Prevents the renderers from manipulating low-integrity processes.
result = policy->SetDelayedIntegrityLevel(sandbox::INTEGRITY_LEVEL_UNTRUSTED);
if (result != sandbox::SBOX_ALL_OK)
return result;
result = policy->SetIntegrityLevel(sandbox::INTEGRITY_LEVEL_LOW);
if (result != sandbox::SBOX_ALL_OK)
return result;
policy->SetLockdownDefaultDacl();
result = policy->SetAlternateDesktop(true);
if (result != sandbox::SBOX_ALL_OK) {
DLOG(WARNING) << "Failed to apply desktop security to the renderer";
return result;
}
return result;
}
// Updates the command line arguments with debug-related flags. If debug flags
// have been used with this process, they will be filtered and added to
// command_line as needed.
void ProcessDebugFlags(base::CommandLine* command_line) {
const base::CommandLine& current_cmd_line =
*base::CommandLine::ForCurrentProcess();
std::string type = command_line->GetSwitchValueASCII(switches::kProcessType);
if (current_cmd_line.HasSwitch(switches::kWaitForDebuggerChildren)) {
// Look to pass-on the kWaitForDebugger flag.
std::string value = current_cmd_line.GetSwitchValueASCII(
switches::kWaitForDebuggerChildren);
if (value.empty() || value == type) {
command_line->AppendSwitch(switches::kWaitForDebugger);
}
command_line->AppendSwitchASCII(switches::kWaitForDebuggerChildren, value);
}
}
// This code is test only, and attempts to catch unsafe uses of
// DuplicateHandle() that copy privileged handles into sandboxed processes.
#ifndef OFFICIAL_BUILD
base::win::IATPatchFunction g_iat_patch_duplicate_handle;
typedef BOOL (WINAPI *DuplicateHandleFunctionPtr)(HANDLE source_process_handle,
HANDLE source_handle,
HANDLE target_process_handle,
LPHANDLE target_handle,
DWORD desired_access,
BOOL inherit_handle,
DWORD options);
DuplicateHandleFunctionPtr g_iat_orig_duplicate_handle;
NtQueryObject g_QueryObject = NULL;
static const char* kDuplicateHandleWarning =
"You are attempting to duplicate a privileged handle into a sandboxed"
" process.\n Please contact [email protected] for assistance.";
void CheckDuplicateHandle(HANDLE handle) {
// Get the object type (32 characters is safe; current max is 14).
BYTE buffer[sizeof(OBJECT_TYPE_INFORMATION) + 32 * sizeof(wchar_t)];
OBJECT_TYPE_INFORMATION* type_info =
reinterpret_cast<OBJECT_TYPE_INFORMATION*>(buffer);
ULONG size = sizeof(buffer) - sizeof(wchar_t);
NTSTATUS error;
error = g_QueryObject(handle, ObjectTypeInformation, type_info, size, &size);
CHECK(NT_SUCCESS(error));
type_info->Name.Buffer[type_info->Name.Length / sizeof(wchar_t)] = L'\0';
// Get the object basic information.
OBJECT_BASIC_INFORMATION basic_info;
size = sizeof(basic_info);
error = g_QueryObject(handle, ObjectBasicInformation, &basic_info, size,
&size);
CHECK(NT_SUCCESS(error));
CHECK(!(basic_info.GrantedAccess & WRITE_DAC)) <<
kDuplicateHandleWarning;
if (0 == _wcsicmp(type_info->Name.Buffer, L"Process")) {
const ACCESS_MASK kDangerousMask =
~static_cast<DWORD>(PROCESS_QUERY_LIMITED_INFORMATION | SYNCHRONIZE);
CHECK(!(basic_info.GrantedAccess & kDangerousMask)) <<
kDuplicateHandleWarning;
}
}
BOOL WINAPI DuplicateHandlePatch(HANDLE source_process_handle,
HANDLE source_handle,
HANDLE target_process_handle,
LPHANDLE target_handle,
DWORD desired_access,
BOOL inherit_handle,
DWORD options) {
// Duplicate the handle so we get the final access mask.
if (!g_iat_orig_duplicate_handle(source_process_handle, source_handle,
target_process_handle, target_handle,
desired_access, inherit_handle, options))
return FALSE;
// We're not worried about broker handles or not crossing process boundaries.
if (source_process_handle == target_process_handle ||
target_process_handle == ::GetCurrentProcess())
return TRUE;
// Only sandboxed children are placed in jobs, so just check them.
BOOL is_in_job = FALSE;
if (!::IsProcessInJob(target_process_handle, NULL, &is_in_job)) {
// We need a handle with permission to check the job object.
if (ERROR_ACCESS_DENIED == ::GetLastError()) {
HANDLE temp_handle;
CHECK(g_iat_orig_duplicate_handle(::GetCurrentProcess(),
target_process_handle,
::GetCurrentProcess(),
&temp_handle,
PROCESS_QUERY_INFORMATION,
FALSE, 0));
base::win::ScopedHandle process(temp_handle);
CHECK(::IsProcessInJob(process.Get(), NULL, &is_in_job));
}
}
if (is_in_job) {
// We never allow inheritable child handles.
CHECK(!inherit_handle) << kDuplicateHandleWarning;
// Duplicate the handle again, to get the final permissions.
HANDLE temp_handle;
CHECK(g_iat_orig_duplicate_handle(target_process_handle, *target_handle,
::GetCurrentProcess(), &temp_handle,
0, FALSE, DUPLICATE_SAME_ACCESS));
base::win::ScopedHandle handle(temp_handle);
// Callers use CHECK macro to make sure we get the right stack.
CheckDuplicateHandle(handle.Get());
}
return TRUE;
}
#endif
bool IsAppContainerEnabled() {
if (base::win::GetVersion() < base::win::VERSION_WIN8)
return false;
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
const std::string appcontainer_group_name =
base::FieldTrialList::FindFullName("EnableAppContainer");
if (command_line.HasSwitch(switches::kDisableAppContainer))
return false;
if (command_line.HasSwitch(switches::kEnableAppContainer))
return true;
return base::StartsWith(appcontainer_group_name, "Enabled",
base::CompareCase::INSENSITIVE_ASCII);
}
} // namespace
sandbox::ResultCode SetJobLevel(const base::CommandLine& cmd_line,
sandbox::JobLevel job_level,
uint32_t ui_exceptions,
sandbox::TargetPolicy* policy) {
if (!ShouldSetJobLevel(cmd_line))
return policy->SetJobLevel(sandbox::JOB_NONE, 0);
#ifdef _WIN64
sandbox::ResultCode ret =
policy->SetJobMemoryLimit(4ULL * 1024 * 1024 * 1024);
if (ret != sandbox::SBOX_ALL_OK)
return ret;
#endif
return policy->SetJobLevel(job_level, ui_exceptions);
}
// TODO(jschuh): Need get these restrictions applied to NaCl and Pepper.
// Just have to figure out what needs to be warmed up first.
sandbox::ResultCode AddBaseHandleClosePolicy(sandbox::TargetPolicy* policy) {
// TODO(cpu): Add back the BaseNamedObjects policy.
base::string16 object_path = PrependWindowsSessionPath(
L"\\BaseNamedObjects\\windows_shell_global_counters");
return policy->AddKernelObjectToClose(L"Section", object_path.data());
}
sandbox::ResultCode AddAppContainerPolicy(sandbox::TargetPolicy* policy,
const wchar_t* sid) {
if (IsAppContainerEnabled())
return policy->SetLowBox(sid);
return sandbox::SBOX_ALL_OK;
}
sandbox::ResultCode AddWin32kLockdownPolicy(sandbox::TargetPolicy* policy,
bool enable_opm) {
#if !defined(NACL_WIN64)
if (!IsWin32kRendererLockdownEnabled())
return sandbox::SBOX_ALL_OK;
// Enable win32k lockdown if not already.
sandbox::MitigationFlags flags = policy->GetProcessMitigations();
if ((flags & sandbox::MITIGATION_WIN32K_DISABLE) ==
sandbox::MITIGATION_WIN32K_DISABLE)
return sandbox::SBOX_ALL_OK;
sandbox::ResultCode result =
policy->AddRule(sandbox::TargetPolicy::SUBSYS_WIN32K_LOCKDOWN,
enable_opm ? sandbox::TargetPolicy::IMPLEMENT_OPM_APIS
: sandbox::TargetPolicy::FAKE_USER_GDI_INIT,
nullptr);
if (result != sandbox::SBOX_ALL_OK)
return result;
if (enable_opm)
policy->SetEnableOPMRedirection();
flags |= sandbox::MITIGATION_WIN32K_DISABLE;
return policy->SetProcessMitigations(flags);
#else
return sandbox::SBOX_ALL_OK;
#endif
}
bool InitBrokerServices(sandbox::BrokerServices* broker_services) {
// TODO(abarth): DCHECK(CalledOnValidThread());
// See <http://b/1287166>.
DCHECK(broker_services);
DCHECK(!g_broker_services);
sandbox::ResultCode result = broker_services->Init();
g_broker_services = broker_services;
// In non-official builds warn about dangerous uses of DuplicateHandle.
#ifndef OFFICIAL_BUILD
BOOL is_in_job = FALSE;
CHECK(::IsProcessInJob(::GetCurrentProcess(), NULL, &is_in_job));
// In a Syzygy-profiled binary, instrumented for import profiling, this
// patch will end in infinite recursion on the attempted delegation to the
// original function.
if (!base::debug::IsBinaryInstrumented() &&
!is_in_job && !g_iat_patch_duplicate_handle.is_patched()) {
HMODULE module = NULL;
wchar_t module_name[MAX_PATH];
CHECK(::GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
reinterpret_cast<LPCWSTR>(InitBrokerServices),
&module));
DWORD result = ::GetModuleFileNameW(module, module_name, MAX_PATH);
if (result && (result != MAX_PATH)) {
ResolveNTFunctionPtr("NtQueryObject", &g_QueryObject);
result = g_iat_patch_duplicate_handle.Patch(
module_name, "kernel32.dll", "DuplicateHandle",
DuplicateHandlePatch);
CHECK(result == 0);
g_iat_orig_duplicate_handle =
reinterpret_cast<DuplicateHandleFunctionPtr>(
g_iat_patch_duplicate_handle.original_function());
}
}
#endif
return sandbox::SBOX_ALL_OK == result;
}
bool InitTargetServices(sandbox::TargetServices* target_services) {
DCHECK(target_services);
sandbox::ResultCode result = target_services->Init();
return sandbox::SBOX_ALL_OK == result;
}
sandbox::ResultCode StartSandboxedProcess(
SandboxedProcessLauncherDelegate* delegate,
base::CommandLine* cmd_line,
const base::HandlesToInheritVector& handles_to_inherit,
base::Process* process) {
DCHECK(delegate);
const base::CommandLine& browser_command_line =
*base::CommandLine::ForCurrentProcess();
std::string type_str = cmd_line->GetSwitchValueASCII(switches::kProcessType);
TRACE_EVENT1("startup", "StartProcessWithAccess", "type", type_str);
// Propagate the --allow-no-job flag if present.
if (browser_command_line.HasSwitch(switches::kAllowNoSandboxJob) &&
!cmd_line->HasSwitch(switches::kAllowNoSandboxJob)) {
cmd_line->AppendSwitch(switches::kAllowNoSandboxJob);
}
ProcessDebugFlags(cmd_line);
if ((!delegate->ShouldSandbox()) ||
browser_command_line.HasSwitch(switches::kNoSandbox) ||
cmd_line->HasSwitch(switches::kNoSandbox)) {
base::LaunchOptions options;
base::HandlesToInheritVector handles = handles_to_inherit;
if (!handles_to_inherit.empty()) {
options.inherit_handles = true;
options.handles_to_inherit = &handles;
}
base::Process unsandboxed_process = base::LaunchProcess(*cmd_line, options);
*process = std::move(unsandboxed_process);
return sandbox::SBOX_ALL_OK;
}
sandbox::TargetPolicy* policy = g_broker_services->CreatePolicy();
// Add any handles to be inherited to the policy.
for (HANDLE handle : handles_to_inherit)
policy->AddHandleToShare(handle);
// Pre-startup mitigations.
sandbox::MitigationFlags mitigations =
sandbox::MITIGATION_HEAP_TERMINATE |
sandbox::MITIGATION_BOTTOM_UP_ASLR |
sandbox::MITIGATION_DEP |
sandbox::MITIGATION_DEP_NO_ATL_THUNK |
sandbox::MITIGATION_SEHOP |
sandbox::MITIGATION_NONSYSTEM_FONT_DISABLE |
sandbox::MITIGATION_IMAGE_LOAD_NO_REMOTE |
sandbox::MITIGATION_IMAGE_LOAD_NO_LOW_LABEL;
sandbox::ResultCode result = sandbox::SBOX_ERROR_GENERIC;
result = policy->SetProcessMitigations(mitigations);
if (result != sandbox::SBOX_ALL_OK)
return result;
#if !defined(NACL_WIN64)
if (type_str == switches::kRendererProcess &&
IsWin32kRendererLockdownEnabled()) {
result = AddWin32kLockdownPolicy(policy, false);
if (result != sandbox::SBOX_ALL_OK)
return result;
}
#endif
// Post-startup mitigations.
mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS |
sandbox::MITIGATION_DLL_SEARCH_ORDER;
result = policy->SetDelayedProcessMitigations(mitigations);
if (result != sandbox::SBOX_ALL_OK)
return result;
result = SetJobLevel(*cmd_line, sandbox::JOB_LOCKDOWN, 0, policy);
if (result != sandbox::SBOX_ALL_OK)
return result;
if (!delegate->DisableDefaultPolicy()) {
result = AddPolicyForSandboxedProcess(policy);
if (result != sandbox::SBOX_ALL_OK)
return result;
}
#if !defined(NACL_WIN64)
if (type_str == switches::kRendererProcess ||
type_str == switches::kPpapiPluginProcess) {
AddDirectory(base::DIR_WINDOWS_FONTS, NULL, true,
sandbox::TargetPolicy::FILES_ALLOW_READONLY, policy);
}
#endif
if (type_str != switches::kRendererProcess) {
// Hack for Google Desktop crash. Trick GD into not injecting its DLL into
// this subprocess. See
// http://code.google.com/p/chromium/issues/detail?id=25580
cmd_line->AppendSwitchASCII("ignored", " --type=renderer ");
}
result = AddGenericPolicy(policy);
if (result != sandbox::SBOX_ALL_OK) {
NOTREACHED();
return result;
}
// Allow the renderer and gpu processes to access the log file.
if (type_str == switches::kRendererProcess ||
type_str == switches::kGpuProcess) {
if (logging::IsLoggingToFileEnabled()) {
DCHECK(base::FilePath(logging::GetLogFileFullPath()).IsAbsolute());
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_ANY,
logging::GetLogFileFullPath().c_str());
if (result != sandbox::SBOX_ALL_OK)
return result;
}
}
#if !defined(OFFICIAL_BUILD)
// If stdout/stderr point to a Windows console, these calls will
// have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS.
policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE));
policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE));
#endif
if (!delegate->PreSpawnTarget(policy))
return sandbox::SBOX_ERROR_DELEGATE_PRE_SPAWN;
TRACE_EVENT_BEGIN0("startup", "StartProcessWithAccess::LAUNCHPROCESS");
PROCESS_INFORMATION temp_process_info = {};
result = g_broker_services->SpawnTarget(
cmd_line->GetProgram().value().c_str(),
cmd_line->GetCommandLineString().c_str(), policy, &temp_process_info);
DWORD last_error = ::GetLastError();
base::win::ScopedProcessInformation target(temp_process_info);
TRACE_EVENT_END0("startup", "StartProcessWithAccess::LAUNCHPROCESS");
if (sandbox::SBOX_ALL_OK != result) {
UMA_HISTOGRAM_SPARSE_SLOWLY("Process.Sandbox.Launch.Error", last_error);
if (result == sandbox::SBOX_ERROR_GENERIC)
DPLOG(ERROR) << "Failed to launch process";
else
DLOG(ERROR) << "Failed to launch process. Error: " << result;
return result;
}
delegate->PostSpawnTarget(target.process_handle());
CHECK(ResumeThread(target.thread_handle()) != static_cast<DWORD>(-1));
*process = base::Process(target.TakeProcessHandle());
return sandbox::SBOX_ALL_OK;
}
} // namespace content
| {
"content_hash": "eef9c27654d06c1f302d60f50b8868a6",
"timestamp": "",
"source": "github",
"line_count": 779,
"max_line_length": 80,
"avg_line_length": 40.67522464698331,
"alnum_prop": 0.6376002019819479,
"repo_name": "wuhengzhi/chromium-crosswalk",
"id": "35c33d597cc2a730df0c55f89cfa67fb6ea27f5f",
"size": "33320",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "content/common/sandbox_win.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
import pyaudio
import wave
import sys
CHUNK = 1024
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
p = pyaudio.PyAudio()
stream = p.open(format=p.get_format_from_width(wf.getsampwidth()),
channels=wf.getnchannels(),
rate=wf.getframerate(),
output=True)
data = wf.readframes(CHUNK)
while data != '':
stream.write(data)
data = wf.readframes(CHUNK)
stream.stop_stream()
stream.close()
p.terminate()
| {
"content_hash": "44377b4bfdcc753f031591703a7daf00",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 18.633333333333333,
"alnum_prop": 0.6189624329159212,
"repo_name": "tdb-alcorn/pymusic",
"id": "f828549b7ec984c74f87eae157b7482fa396233a",
"size": "559",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "play.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "7139"
}
],
"symlink_target": ""
} |
% Unify.tex
% vim:set ft=tex spell:
\documentclass{article}
\usepackage {xcolor}
\newcommand \todo[1] {\textcolor{red}{TODO: }#1}
\newcommand \catname[1] {{\normalfont\textbf{#1}}}
\newcommand \Set {\catname {Set}}
\newcommand \Cat {\catname {Cat}}
\begin{document}
\section {Intro}
Normally unification is presented in catergory-theoretic terms as a coequalizer:
we have an indexed set of equations $s_i = t_i$ where the $\{s_i, t_i\}$ are terms.
Then we ask the algorithm for a most generic unifier $q$.
\todo {describe how the unification works.}
\section {Observation 1}
The first observation is that why not only deal with substitutions only? I.e. invent a finite set of variable names $vl_i$ and $vr_i$ and let those point to $s_i$ resp. $t_i$. Then we have a bona fide substitution $V \to T_{\Omega}W$, where $W$ is the variable set of our terms $\{s_i, t_i\}$. This appears to be one of the ingredients of the coequalizer approach. We pretend to not unify two (sets of) terms, but two corresponding Kleisli-arrows $vl_i \mapsto s_i$ and $vr_i \mapsto t_i$ (which are substitutions).
\section {Observation 2}
The second observation is that having substitutions with just variables as the substituend kills the symmetry in the unification algorithm. (HOW SO?) So we'll forbid $v \to w$ substitutions altogether. Now when we encounter a unification necessity $v \equiv w$ what should we do?
My suggestion is to create an equivalence class of variable names that contains both $v$ and $w$. We'll revisit this issue later but for now it is enough to hint at path-connectedness (i.e. \emph{groupoids}).
Then the domain of our Kleisli-arrows must be equivalence classes of variable names. Since a single variable name in $T_{\Omega}W$ uniquely determines the equivalence class of variable names, why not also pass to quotients in $T_{\Omega}W$?
We'll do so now. What we get is monads over equivalence classes (quotiened sets). This also means that the number of bindings in unifiers will potentially decrease, because
\begin{itemize}
\item[a)] we do not have variable-to-variable substitutions any more,
\item[b)] we'll have only one instead of $\{a \to x, b \to y\}$ bindings when $a$ and $b$ happen to land in the same equivalence class.
\end{itemize}
But this brings us to the principal problem with this approach. When we augment an equivalence class for whatever reason, we have to hunt down all bindings that are affected and coalesce them. Which in turn may expose more obligations to merge classes until a fixpoint is reached. When we had a finite number of variable names to start with, this process will terminate.
\par Our algorithm must keep a worklist of outstanding unification necessities (i.e. unmerged terms) and the current up-to-date substitution with consolidated equivalence classes.
When the former list becomes empty, we have the desired mgu in our hands.
If we can establish a correct-by construction data type for substitutions that precludes the possibility of overlapping equivalence classes in the key- as well as the term set of the substitution, then we get an almost machine-checked algorithm.
\section {Groupoids}
Let's come back to the idea of equivalence classes. We noted that they merge when we encounter two variable names (or more precisely their classes) that must be unified. But how can we make the notion of the classes precise? I propose to build paths between variable names, thus obtain path-connected components in the set of variable names. The elements of the loop space then become the connected components and classes. \todo {check that this is indeed a groupoid.} $T_{\Omega}$ is then a functor between groupoids. Of course passage to quotients reverts $T_{\Omega}$ to a \Set monad again.
\par When applying the slogan of HoTT, that \emph {types are groupoids}, then we might wonder whether a substitution is a mapping from types to terms with variable sets that are (equivalence classes of) inhabitants of a type. Thus unification, by creating bridges between equivalence classes, could be seen as a way of defining \emph {higher inductive types} (HITs). \todo {does this in some way add computational content to HITs?}
\subsection {Conversion of variable names to inhabitants}
Suppose we can track the individual identifications between variable names in the course of the unification algorithm. (Remember that these are symmetric in nature, because we avoid variable-to-variable substitutions.) Then, upon successful termination of the algorithm we'll end up with the \emph {continents} (a.k.a. path-connected components) and its \emph {roards} between its \emph {cities} (a.k.a. paths between objects). Since the obtained unifications can represent any identity compatible with the groupoid structure, we can insist that they are actually the groupoid morphisms. Then we can instantiate each variable, (non-composite) morphism, and possibly higher homotopies, from a set of inhabitants and consider it as the synthetic blueprint of a new type. It will satisfy the defining equation by definition and the inhabitants can be pattern matched (path induction!) against.
\par While this may sound as a tedious way of defining a new type, there might be nice applications to it, who knows.
\section {Bibliography}
\begin{itemize}
\item Goguen 89
\item Burstall-Rydeheard
\item HoTT Book
\end{itemize}
\end{document}
| {
"content_hash": "9dde81083f400a233d991926ad849bc8",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 890,
"avg_line_length": 99.5925925925926,
"alnum_prop": 0.7772406098921533,
"repo_name": "cartazio/omega",
"id": "32e9e11e61193e269276eea90b2702bf04401bf4",
"size": "5378",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "mosaic/latex/Unify.tex",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Awk",
"bytes": "264"
},
{
"name": "C++",
"bytes": "3567"
},
{
"name": "Haskell",
"bytes": "1007843"
},
{
"name": "Makefile",
"bytes": "3220"
},
{
"name": "TeX",
"bytes": "10113"
},
{
"name": "xBase",
"bytes": "245324"
}
],
"symlink_target": ""
} |
"use strict";import"../../Series/WordcloudSeries.js"; | {
"content_hash": "d2bac3341b27bfb8abbdf33c4879b1c9",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 53,
"avg_line_length": 53,
"alnum_prop": 0.7169811320754716,
"repo_name": "cdnjs/cdnjs",
"id": "06625ac63094783402670ccf4337fe524c149626",
"size": "53",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ajax/libs/highcharts/8.2.2/es-modules/masters/modules/wordcloud.src.min.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package edu.msu.mi.socnet;
/**
* Created by josh on 6/9/15.
*/
public interface AttributeProvider {
MyGraphMLExporter.AttributeType getType();
String getName();
String getDataType();
String getValue(Object obj);
}
| {
"content_hash": "90189934c62ffbb937b71e6e4ea9b726",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 46,
"avg_line_length": 14.058823529411764,
"alnum_prop": 0.6778242677824268,
"repo_name": "jintrone/knoeval",
"id": "f2f4d0ee1106ffca71b3892a8b0d6868f6add888",
"size": "239",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/groovy/edu/msu/mi/socnet/AttributeProvider.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "49695"
},
{
"name": "Java",
"bytes": "12963"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<bean id="httpClient" class="org.apache.http.impl.client.DefaultHttpClient">
<constructor-arg>
<bean class="org.esxx.js.protocol.GAEConnectionManager">
<constructor-arg ref="urlFetchService" />
</bean>
</constructor-arg>
</bean>
<util:set id="urlsToWatch" value-type="java.lang.String">
<value>http://store.apple.com/de</value>
<value>http://www.microsoft.com</value>
<value>http://www.facebook.com</value>
</util:set>
<bean id="schedule.MINUTELY" class="de.openended.cloudurlwatcher.cron.Schedule" factory-method="valueOf">
<constructor-arg value="MINUTELY" />
</bean>
<bean id="schedule.HOURLY" class="de.openended.cloudurlwatcher.cron.Schedule" factory-method="valueOf">
<constructor-arg value="HOURLY" />
</bean>
<bean id="schedule.DAILY" class="de.openended.cloudurlwatcher.cron.Schedule" factory-method="valueOf">
<constructor-arg value="DAILY" />
</bean>
<bean id="schedule.WEEKLY" class="de.openended.cloudurlwatcher.cron.Schedule" factory-method="valueOf">
<constructor-arg value="WEEKLY" />
</bean>
<bean id="schedule.MONTHLY" class="de.openended.cloudurlwatcher.cron.Schedule" factory-method="valueOf">
<constructor-arg value="MONTHLY" />
</bean>
<bean id="schedule.YEARLY" class="de.openended.cloudurlwatcher.cron.Schedule" factory-method="valueOf">
<constructor-arg value="YEARLY" />
</bean>
<util:map id="scheduleToQueueMapping" key-type="de.openended.cloudurlwatcher.cron.Schedule" value-type="java.lang.String">
<entry key-ref="schedule.MINUTELY" value="watchUrl" />
<entry key-ref="schedule.HOURLY" value="aggregateUrl" />
<entry key-ref="schedule.DAILY" value="aggregateUrl" />
<entry key-ref="schedule.WEEKLY" value="aggregateUrl" />
<entry key-ref="schedule.MONTHLY" value="aggregateUrl" />
<entry key-ref="schedule.YEARLY" value="aggregateUrl" />
</util:map>
</beans>
| {
"content_hash": "5966fe01a15ce0b1a1167bbbba0c5aba",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 168,
"avg_line_length": 49.5625,
"alnum_prop": 0.7116435477091215,
"repo_name": "jensfischerhh/cloudurlwatcher",
"id": "c8ec2cabbd89998b74bbeae184f872d0d741e316",
"size": "2379",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/resources/spring-service.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "78461"
}
],
"symlink_target": ""
} |
package main
import (
"github.com/cznic/cc"
bg "github.com/gorgonia/bindgen"
)
func isInput(fnName string, p bg.Parameter) bool {
return inList(p.Name(), inputParams[fnName])
}
func isOutput(fnName string, p bg.Parameter) bool {
return inList(p.Name(), outputParams[fnName])
}
func isIO(fnName string, p bg.Parameter) bool {
return inList(p.Name(), ioParams[fnName])
}
func isAlphaBeta(fnName string, p bg.Parameter) bool {
locs := alphaBetas[fnName]
for _, v := range locs {
if v == p.Name() {
return true
}
}
return false
}
// functions for convertibility
func isOutputPtrOfPrim(fnName string, p bg.Parameter) bool {
if !isOutput(fnName, p) && !isIO(fnName, p) {
return false
}
if !p.IsPointer() {
return false
}
return isBuiltin(depointerize(nameOfType(p.Type())))
}
func isEnumOutput(fnName string, p bg.Parameter) bool {
if !isOutput(fnName, p) {
return false
}
if !p.IsPointer() {
return false
}
cType := nameOfType(p.Type())
_, ok := enumMappings[cType]
return ok
}
func cParam2GoParam(p bg.Parameter) (retVal Param) {
retVal.Name = safeParamName(p.Name())
cTypeName := nameOfType(p.Type())
gTypeName := goNameOf(p.Type())
isPtr, isBuiltin := isPointerOfBuiltin(cTypeName)
switch {
case gTypeName == "" && isPtr && isBuiltin:
retVal.Type = goNameOfStr(depointerize(cTypeName))
case gTypeName != "":
retVal.Type = gTypeName
case gTypeName == "" && !isBuiltin:
retVal.Type = "TODO"
}
return
}
func ctype2gotype2ctype(t cc.Type) string {
cName := nameOfType(t)
goName := goNameOfStr(depointerize(cName))
return go2cBuiltins[goName]
}
| {
"content_hash": "20d9e7ec21ee0f06699347210351471f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 60,
"avg_line_length": 21.66216216216216,
"alnum_prop": 0.6949469744229569,
"repo_name": "chewxy/cu",
"id": "875082f11fb289864195fe005c78622616b74ecb",
"size": "1603",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "cmd/gencudnn/params.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "69476"
},
{
"name": "Go",
"bytes": "470440"
}
],
"symlink_target": ""
} |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1HostAlias(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self, hostnames=None, ip=None):
"""
V1HostAlias - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
'hostnames': 'list[str]',
'ip': 'str'
}
self.attribute_map = {
'hostnames': 'hostnames',
'ip': 'ip'
}
self._hostnames = hostnames
self._ip = ip
@property
def hostnames(self):
"""
Gets the hostnames of this V1HostAlias.
Hostnames for the above IP address.
:return: The hostnames of this V1HostAlias.
:rtype: list[str]
"""
return self._hostnames
@hostnames.setter
def hostnames(self, hostnames):
"""
Sets the hostnames of this V1HostAlias.
Hostnames for the above IP address.
:param hostnames: The hostnames of this V1HostAlias.
:type: list[str]
"""
self._hostnames = hostnames
@property
def ip(self):
"""
Gets the ip of this V1HostAlias.
IP address of the host file entry.
:return: The ip of this V1HostAlias.
:rtype: str
"""
return self._ip
@ip.setter
def ip(self, ip):
"""
Sets the ip of this V1HostAlias.
IP address of the host file entry.
:param ip: The ip of this V1HostAlias.
:type: str
"""
self._ip = ip
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, V1HostAlias):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
| {
"content_hash": "fc327dd05927dc0c7c8098d1facb1fdb",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 105,
"avg_line_length": 25.49645390070922,
"alnum_prop": 0.5171070931849792,
"repo_name": "sebgoa/client-python",
"id": "1af24f87300316f48f0e888977fbf9cd9550c884",
"size": "3612",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "kubernetes/client/models/v1_host_alias.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "5855378"
},
{
"name": "Shell",
"bytes": "16387"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "f85a257d6fb33411b9a953ad6b4c627b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "5fdbded255146d546867ef3f9cab687566b25214",
"size": "169",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Brassicales/Resedaceae/Reseda/Reseda tridens/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
| {
"content_hash": "8c81202a8ff8161d85bf222c80a7127c",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 102,
"avg_line_length": 40.329268292682926,
"alnum_prop": 0.7514363471424251,
"repo_name": "cmu-is-projects/Manna",
"id": "9873b9ceaa2c2573a36f08d4771744717db5211a",
"size": "3307",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "config/environments/production.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "73018"
},
{
"name": "CoffeeScript",
"bytes": "1269"
},
{
"name": "HTML",
"bytes": "239056"
},
{
"name": "JavaScript",
"bytes": "1617"
},
{
"name": "Ruby",
"bytes": "101495"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "7fc617cdf3434edf5295463f21fd0a64",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "34eb87af9fc69ec0e7fb49646a0dc9e5b4a95f3d",
"size": "194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Euphorbiaceae/Bernardia/Bernardia confertifolia/ Syn. Bernardia confertifolia glabrata/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
using Cofoundry.Core.AutoUpdate;
namespace Cofoundry.Domain.Installation;
public class ImportPermissionsCommand : IVersionedUpdateCommand
{
public string Description
{
get { return GetType().Name; }
}
public int Version
{
get { return 1; }
}
}
| {
"content_hash": "3448fb34bda5defb0c7a4af3427a15f7",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 18,
"alnum_prop": 0.6631944444444444,
"repo_name": "cofoundry-cms/cofoundry",
"id": "d2a935688acd0a08995858ea0b1583e2d71c1ed4",
"size": "290",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Cofoundry.Domain/Install/UpdateCommands/ImportPermissionsCommand.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "4940398"
},
{
"name": "CSS",
"bytes": "185312"
},
{
"name": "HTML",
"bytes": "348286"
},
{
"name": "JavaScript",
"bytes": "869157"
},
{
"name": "PowerShell",
"bytes": "8549"
},
{
"name": "SCSS",
"bytes": "245339"
},
{
"name": "TSQL",
"bytes": "160288"
}
],
"symlink_target": ""
} |
using NineRays.ILOMD;
using NineRays.ILOMD.Options;
namespace MiniObfuscator.Core
{
public class Obfuscator
{
public ObfuscatorSettings Settings { get; private set; }
public Obfuscator(ObfuscatorSettings settings)
{
Settings = settings;
}
public bool Obfuscate()
{
if (!Settings.Validate()) return false;
var mdl = new ILOMDProvider(new ObfuscateLogger(Settings.ObfuscateLoggerSettings));
return mdl.Obfuscate(GenerateObfuscateProject());
}
private Project GenerateObfuscateProject()
{
var project = new Project
{
StripDebugInfo = Settings.StripDebugInfo,
VerifyAfterObfuscation = (YesNoPrompt)Settings.VerifyAfterObfuscation,
SaveToDirectory = Settings.OutputPath,
CheckConsistencyBeforeObfuscation = Settings.CheckConsistencyBeforeObfuscation
};
var options = (Settings.ObfuscateOptions ?? ObfuscateOptions.Default).Options;
foreach (var path in Settings.AssemblyPaths)
{
project.AssemblyList.Add(new AssemblyFileName(path, options));
}
foreach (var bookmark in Settings.Bookmarks)
{
project.Bookmarks.Add(bookmark);
}
if (Settings.HasSnKey())
{
project.StrongNameKeyFile = Settings.StrongNameKeyFilePath;
if (!string.IsNullOrEmpty(Settings.StrongNameKeyFilePassword))
{
project.StrongNameKeyFilePassword = Settings.StrongNameKeyFilePassword;
}
}
return project;
}
}
} | {
"content_hash": "3fc1db821034bcadce6ee73cba6c3c8c",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 89,
"avg_line_length": 27.87272727272727,
"alnum_prop": 0.6777560339204175,
"repo_name": "msynk/obfuscator",
"id": "d141d40dedfde77daaf8a92d8e9de7c567c83dc7",
"size": "1535",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MiniObfuscator/MiniObfuscator.Core/Obfuscator.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "37007"
},
{
"name": "Smalltalk",
"bytes": "2866"
}
],
"symlink_target": ""
} |
class Spree::Admin::PromotionRulesController < Spree::Admin::BaseController
helper 'spree/promotion_rules'
before_filter :load_promotion, :only => [:create, :destroy]
before_filter :validate_promotion_rule_type, :only => :create
def create
# Remove type key from this hash so that we don't attempt
# to set it when creating a new record, as this is raises
# an error in ActiveRecord 3.2.
promotion_rule_type = params[:promotion_rule].delete(:type)
@promotion_rule = promotion_rule_type.constantize.new(params[:promotion_rule])
@promotion_rule.promotion = @promotion
if @promotion_rule.save
flash[:success] = I18n.t(:successfully_created, :resource => I18n.t(:promotion_rule))
end
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion)}
format.js { render :layout => false }
end
end
def destroy
@promotion_rule = @promotion.promotion_rules.find(params[:id])
if @promotion_rule.destroy
flash[:success] = I18n.t(:successfully_removed, :resource => I18n.t(:promotion_rule))
end
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion)}
format.js { render :layout => false }
end
end
private
def load_promotion
@promotion = Spree::Promotion.find(params[:promotion_id])
end
def validate_promotion_rule_type
valid_promotion_rule_types = Rails.application.config.spree.promotions.rules.map(&:to_s)
if !valid_promotion_rule_types.include?(params[:promotion_rule][:type])
flash[:error] = t(:invalid_promotion_rule)
respond_to do |format|
format.html { redirect_to spree.edit_admin_promotion_path(@promotion)}
format.js { render :layout => false }
end
end
end
end
| {
"content_hash": "582843ed91de358e0b2a95dc9925aeca",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 92,
"avg_line_length": 36.16,
"alnum_prop": 0.6847345132743363,
"repo_name": "codesavvy/sandbox",
"id": "bff790d246ba5423417e067a6e3da7ca4f2a7524",
"size": "1808",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "backend/app/controllers/spree/admin/promotion_rules_controller.rb",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "CoffeeScript",
"bytes": "9178"
},
{
"name": "JavaScript",
"bytes": "250807"
},
{
"name": "Perl",
"bytes": "9443"
},
{
"name": "Ruby",
"bytes": "1341498"
},
{
"name": "Shell",
"bytes": "2111"
}
],
"symlink_target": ""
} |
require 'spec_helper'
describe Admin::Config::ShippingZonesController do
render_views
before(:each) do
activate_authlogic
@user = create_super_admin_user
login_as(@user)
end
it "index action should render index template" do
get :index
response.should render_template(:index)
end
#it "show action should render show template" do
# @shipping_zone = ShippingZone.first
# get :show, :id => @shipping_zone.id
# response.should render_template(:show)
#end
it "new action should render new template" do
get :new
response.should render_template(:new)
end
it "create action should render new template when model is invalid" do
ShippingZone.any_instance.stubs(:valid?).returns(false)
post :create, :shipping_zone => {:name => 'Alaska'}
response.should render_template(:new)
end
it "create action should redirect when model is valid" do
ShippingZone.any_instance.stubs(:valid?).returns(true)
post :create, :shipping_zone => {:name => 'Alaska'}
response.should redirect_to(admin_config_shipping_zones_url())
end
it "edit action should render edit template" do
@shipping_zone = ShippingZone.first
get :edit, :id => @shipping_zone.id
response.should render_template(:edit)
end
it "update action should render edit template when model is invalid" do
@shipping_zone = ShippingZone.first
ShippingZone.any_instance.stubs(:valid?).returns(false)
put :update, :id => @shipping_zone.id, :shipping_zone => {:name => 'Alaska'}
response.should render_template(:edit)
end
it "update action should redirect when model is valid" do
@shipping_zone = ShippingZone.first
ShippingZone.any_instance.stubs(:valid?).returns(true)
put :update, :id => @shipping_zone.id, :shipping_zone => {:name => 'Alaska'}
response.should redirect_to(admin_config_shipping_zones_url())
end
end
| {
"content_hash": "ab79c3dea221dd19c31315fdcaf73013",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 80,
"avg_line_length": 31.147540983606557,
"alnum_prop": 0.7,
"repo_name": "hbdev012/ror-e-comm",
"id": "5e987a10928788010da93b6e08a7376f842f70ae",
"size": "1900",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "spec/controllers/admin/config/shipping_zones_controller_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "524903"
},
{
"name": "JavaScript",
"bytes": "770602"
},
{
"name": "Ruby",
"bytes": "753496"
}
],
"symlink_target": ""
} |
require('dotenv').load();
// Require keystone
var keystone = require('keystone');
var swig = require('swig');
// Disable swig's bulit-in template caching, express handles it
swig.setDefaults({ cache: false });
// Initialise Keystone with your project's configuration.
// See http://keystonejs.com/guide/config for available options
// and documentation.
keystone.init({
'name': 'andrewhackmann.com',
'brand': 'andrewhackmann.com',
'less': 'public',
'static': 'public',
'favicon': 'public/favicon.ico',
'views': 'templates/views',
'view engine': 'swig',
'custom engine': swig.renderFile,
'emails': 'templates/emails',
'auto update': true,
'session': true,
'auth': true,
'user model': 'User'
});
// Load your project's Models
keystone.import('models');
// Setup common locals for your templates. The following are required for the
// bundled templates and layouts. Any runtime locals (that should be set uniquely
// for each request) should be added to ./routes/middleware.js
keystone.set('locals', {
_: require('underscore'),
env: keystone.get('env'),
utils: keystone.utils,
editable: keystone.content.editable
});
// Load your project's Routes
keystone.set('routes', require('./routes'));
// Setup common locals for your emails. The following are required by Keystone's
// default email templates, you may remove them if you're using your own.
keystone.set('email locals', {
logo_src: '/images/logo-email.gif',
logo_width: 194,
logo_height: 76,
theme: {
email_bg: '#f9f9f9',
link_color: '#2697de',
buttons: {
color: '#fff',
background_color: '#2697de',
border_color: '#1a7cb7'
}
}
});
// Setup replacement rules for emails, to automate the handling of differences
// between development a production.
// Be sure to update this rule to include your site's actual domain, and add
// other rules your email templates require.
keystone.set('email rules', [{
find: '/images/',
replace: (keystone.get('env') == 'production') ? 'http://www.your-server.com/images/' : 'http://localhost:3000/images/'
}, {
find: '/keystone/',
replace: (keystone.get('env') == 'production') ? 'http://www.your-server.com/keystone/' : 'http://localhost:3000/keystone/'
}]);
// Load your project's email test routes
keystone.set('email tests', require('./routes/emails'));
// Configure the navigation bar in Keystone's Admin UI
keystone.set('nav', {
'posts': ['posts', 'post-categories'],
'enquiries': 'enquiries',
'users': 'users',
'projects': ['projects', 'technologies']
});
// Start Keystone to connect to your database and initialise the web server
keystone.start();
| {
"content_hash": "efceaa4c7a0492fee093d8add1dd452e",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 124,
"avg_line_length": 25.41747572815534,
"alnum_prop": 0.6913674560733384,
"repo_name": "minehartdesign/andrewhackmann.com",
"id": "783ba4d9070760e498fc79d3562c17946641c8c3",
"size": "2741",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "keystone.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1999"
},
{
"name": "JavaScript",
"bytes": "89065"
}
],
"symlink_target": ""
} |
package ecs
//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.
// DedicatedHostRenewAttribute is a nested struct in ecs response
type DedicatedHostRenewAttribute struct {
PeriodUnit string `json:"PeriodUnit" xml:"PeriodUnit"`
Duration int `json:"Duration" xml:"Duration"`
DedicatedHostId string `json:"DedicatedHostId" xml:"DedicatedHostId"`
RenewalStatus string `json:"RenewalStatus" xml:"RenewalStatus"`
AutoRenewEnabled bool `json:"AutoRenewEnabled" xml:"AutoRenewEnabled"`
AutoRenewWithEcs string `json:"AutoRenewWithEcs" xml:"AutoRenewWithEcs"`
}
| {
"content_hash": "9cfe6d9011cb8942ca74b2e22c245746",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 84,
"avg_line_length": 46.80769230769231,
"alnum_prop": 0.7682826622843056,
"repo_name": "kubernetes/cloud-provider-alibaba-cloud",
"id": "7c1ce28b3b8facb01f9721d4f78fe84e12da4176",
"size": "1217",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/ecs/struct_dedicated_host_renew_attribute.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "386"
},
{
"name": "Go",
"bytes": "1403631"
},
{
"name": "Makefile",
"bytes": "3566"
},
{
"name": "Shell",
"bytes": "3564"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Prodr. 1:644. 1824
#### Original name
null
### Remarks
null | {
"content_hash": "3fc2a06789a2152cb468d870dd5c0fce",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 11.384615384615385,
"alnum_prop": 0.6891891891891891,
"repo_name": "mdoering/backbone",
"id": "1aaac20ea13c80490d69fd9c3f120bfba5fb7221",
"size": "205",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Geraniales/Geraniaceae/Geranium/Geranium retrorsum/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class vw_usuario_ativo_venda extends Model
{
public $fillable = ['id','user_id','ativ_cd_id','ativo_cd_ativo','usav_dt_venda','usav_qt_ativo'];
} | {
"content_hash": "14de87ef1780562b9c61053e76dd90d6",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 102,
"avg_line_length": 20.636363636363637,
"alnum_prop": 0.6563876651982379,
"repo_name": "wcneto/laravel-stocks-robo-advisor",
"id": "e84fb2104294bdf29d0f75814bd98ed0bc0c828d",
"size": "227",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/vw_usuario_ativo_venda.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "95236"
},
{
"name": "PHP",
"bytes": "73757"
}
],
"symlink_target": ""
} |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.09.18 at 08:43:30 PM BRT
//
package org.w3._2000._09.xmldsig_;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlID;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for SignatureType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="SignatureType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="SignedInfo" type="{http://www.w3.org/2000/09/xmldsig#}SignedInfoType"/>
* <element name="SignatureValue" type="{http://www.w3.org/2000/09/xmldsig#}SignatureValueType"/>
* <element name="KeyInfo" type="{http://www.w3.org/2000/09/xmldsig#}KeyInfoType"/>
* </sequence>
* <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SignatureType", propOrder = {
"signedInfo",
"signatureValue",
"keyInfo"
})
public class SignatureType {
@XmlElement(name = "SignedInfo", required = true)
protected SignedInfoType signedInfo;
@XmlElement(name = "SignatureValue", required = true)
protected SignatureValueType signatureValue;
@XmlElement(name = "KeyInfo", required = true)
protected KeyInfoType keyInfo;
@XmlAttribute(name = "Id")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlID
@XmlSchemaType(name = "ID")
protected String id;
/**
* Gets the value of the signedInfo property.
*
* @return
* possible object is
* {@link SignedInfoType }
*
*/
public SignedInfoType getSignedInfo() {
return signedInfo;
}
/**
* Sets the value of the signedInfo property.
*
* @param value
* allowed object is
* {@link SignedInfoType }
*
*/
public void setSignedInfo(SignedInfoType value) {
this.signedInfo = value;
}
/**
* Gets the value of the signatureValue property.
*
* @return
* possible object is
* {@link SignatureValueType }
*
*/
public SignatureValueType getSignatureValue() {
return signatureValue;
}
/**
* Sets the value of the signatureValue property.
*
* @param value
* allowed object is
* {@link SignatureValueType }
*
*/
public void setSignatureValue(SignatureValueType value) {
this.signatureValue = value;
}
/**
* Gets the value of the keyInfo property.
*
* @return
* possible object is
* {@link KeyInfoType }
*
*/
public KeyInfoType getKeyInfo() {
return keyInfo;
}
/**
* Sets the value of the keyInfo property.
*
* @param value
* allowed object is
* {@link KeyInfoType }
*
*/
public void setKeyInfo(KeyInfoType value) {
this.keyInfo = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
}
| {
"content_hash": "6cdeabc5f02799328e6ea56023290c7b",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 122,
"avg_line_length": 26.51875,
"alnum_prop": 0.6132453452745699,
"repo_name": "h3nrique/CTeModel",
"id": "cec2dbe0428fbc4118a760c7341ca0faf16d6718",
"size": "4243",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "project/CTeModel/src/main/java/org/w3/_2000/_09/xmldsig_/SignatureType.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "1554736"
},
{
"name": "Shell",
"bytes": "73"
}
],
"symlink_target": ""
} |
//
// ImageViewDemoController.m
// MeiTuanDemo
//
// Created by CarlXu on 16/9/9.
// Copyright © 2016年 CarlXu. All rights reserved.
//
#import "ImageViewDemoController.h"
@interface ImageViewDemoController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *properties;
@property (nonatomic, strong) NSMutableArray *methodes;
@end
@implementation ImageViewDemoController
- (void)viewDidLoad {
[super viewDidLoad];
[self configNavBarStyle:XXBarStyleTitleAndLeftItem title:@"UIImageView"];
[self.view addSubview:self.tableView];
}
- (NSMutableArray *)properties
{
if (!_properties) {
NSArray *allArr = [NSArray getProperties:[UIImageView class]];
_properties = [NSMutableArray arrayWithArray:allArr];
NSInteger startNum = [_properties indexOfObject:@"image"];
[_properties removeObjectsInRange:NSMakeRange(0, startNum)];
NSInteger endNum = [_properties indexOfObject:@"adjustsImageWhenAncestorFocused"];
[_properties removeObjectsInRange:NSMakeRange(endNum+1, _properties.count-endNum-1)];
}
return _properties;
}
- (NSMutableArray *)methodes
{
if (!_methodes) {
_methodes = [NSMutableArray arrayWithObjects:@"- (instancetype)initWithImage:(nullable UIImage *)image",@"- (instancetype)initWithImage:(nullable UIImage *)image highlightedImage:(nullable UIImage *)highlightedImage",@"- (void)startAnimating",@"- (void)stopAnimating",@"- (BOOL)isAnimating", nil];
}
return _methodes;
}
#pragma mark - UI
- (UITableView *)tableView
{
if (!_tableView) {
_tableView =[UITableView tableViewWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight-64) tableViewStyle:UITableViewStylePlain registerClass:@[@"UITableViewCell"] delegateObject:self];
_tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}
return _tableView;
}
#pragma mark - UITableView DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return (section == 0) ? self.properties.count : self.methodes.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" forIndexPath:indexPath];
if (indexPath.section == 0) {
cell.textLabel.text = [self.properties objectAtIndex:indexPath.row];
cell.textLabel.shadowColor = [UIColor redColor];
}else{
cell.textLabel.text = self.methodes[indexPath.row];
cell.textLabel.numberOfLines = 0;
cell.textLabel.adjustsFontSizeToFitWidth = YES;
cell.textLabel.shadowColor = [UIColor cyanColor];
}
cell.textLabel.font = [UIFont systemFontOfSize:17];
cell.textLabel.shadowOffset = CGSizeMake(-1, 0);
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return (indexPath.section == 0) ? 44 : 60;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return (section == 0) ? @"属性名" : @"方法名";
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
| {
"content_hash": "6a5fc541788f40c4134508dfaface331",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 305,
"avg_line_length": 32.6910569105691,
"alnum_prop": 0.7266849042526735,
"repo_name": "CarlXu1008/CodeFarmers",
"id": "e9faf3d97e64e4f919d1394621db261b05a1667d",
"size": "4036",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "LearniOS/class/More/subClass/UIKitClass/ImageViewDemoController.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Objective-C",
"bytes": "627840"
},
{
"name": "Ruby",
"bytes": "871"
}
],
"symlink_target": ""
} |
/* Delphi brush is contributed by Eddie Shipman */
dp.sh.Brushes.Delphi = function()
{
var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
'case char class comp const constructor currency destructor div do double ' +
'downto else end except exports extended false file finalization finally ' +
'for function goto if implementation in inherited int64 initialization ' +
'integer interface is label library longint longword mod nil not object ' +
'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
'pint64 pointer private procedure program property pshortstring pstring ' +
'pvariant pwidechar pwidestring protected public published raise real real48 ' +
'record repeat set shl shortint shortstring shr single smallint string then ' +
'threadvar to true try type unit until uses val var varirnt while widechar ' +
'widestring with word write writeln xor';
this.regexList = [
{ regex: new RegExp('\\(\\*[\\s\\S]*?\\*\\)', 'gm'), css: 'comment' }, // multiline comments (* *)
{ regex: new RegExp('{(?!\\$)[\\s\\S]*?}', 'gm'), css: 'comment' }, // multiline comments { }
{ regex: new RegExp('//.*$', 'gm'), css: 'comment' }, // one line
{ regex: new RegExp('\'(?:\\.|[^\\\'\'])*\'', 'g'), css: 'string' }, // strings
{ regex: new RegExp('\\{\\$[a-zA-Z]+ .+\\}', 'g'), css: 'directive' }, // Compiler Directives and Region tags
{ regex: new RegExp('\\b[\\d\\.]+\\b', 'g'), css: 'number' }, // numbers 12345
{ regex: new RegExp('\\$[a-zA-Z0-9]+\\b', 'g'), css: 'number' }, // numbers $F5D3
{ regex: new RegExp(this.GetKeywords(keywords), 'gm'), css: 'keyword' } // keyword
];
this.CssClass = 'dp-delphi';
}
dp.sh.Brushes.Delphi.prototype = new dp.sh.Highlighter();
dp.sh.Brushes.Delphi.Aliases = ['delphi', 'pascal'];
| {
"content_hash": "d164c653f02c537cc39b3820d68d2172",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 115,
"avg_line_length": 62.25806451612903,
"alnum_prop": 0.6212435233160621,
"repo_name": "boneman1231/org.apache.felix",
"id": "efeb2f704b5e363cc701791e2b3f1ef371602148",
"size": "1930",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "trunk/ipojo/api/doc/apache-felix-ipojo-api_files/shBrushDelphi.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1113"
},
{
"name": "CSS",
"bytes": "117591"
},
{
"name": "Groovy",
"bytes": "2059"
},
{
"name": "HTML",
"bytes": "2334581"
},
{
"name": "Inno Setup",
"bytes": "4502"
},
{
"name": "Java",
"bytes": "21825788"
},
{
"name": "JavaScript",
"bytes": "280063"
},
{
"name": "Perl",
"bytes": "6262"
},
{
"name": "Scala",
"bytes": "27038"
},
{
"name": "Shell",
"bytes": "11658"
},
{
"name": "XSLT",
"bytes": "136384"
}
],
"symlink_target": ""
} |
<?php
namespace GP\OpenAlboPretorio\Scraper;
use GP\OpenAlboPretorio\Scraper;
/**
* @author Giovanni Pirrotta <[email protected]>
*/
class AlboPretorioScraperFactory implements AlboPretorioScraperFactoryInterface
{
const TERME_VIGLIATORE = 1;
const BARCELLONA_POZZO_DI_GOTTO = 2;
private $mapper = array( 1 => 'GP\OpenAlboPretorio\Scraper\ME\TermeVigliatore\TermeVigliatore',
2 => 'GP\OpenAlboPretorio\Scraper\ME\BarcellonaPG\BarcellonaPG');
/**
* @param string $city The city identification for the class to build
*
* @return AlboPretorioScraperInterface
*
* @throws \Exception If a id city does not exist
*/
final public function build($city)
{
if (! array_key_exists($city, $this->mapper)) {
throw new \Exception('Scraper class not found');
}
$class = $this->mapper[$city] . 'Scraper';
$master = $this->mapper[$city] . 'MasterPageScraper';
$detail = $this->mapper[$city] . 'DetailPageScraper';
return new $class(new $master, new $detail);
}
}
| {
"content_hash": "5002c4efe6e742ebf144cee2dc3b2eda",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 99,
"avg_line_length": 27.463414634146343,
"alnum_prop": 0.6349911190053286,
"repo_name": "gpirrotta/OpenAlboPretorio",
"id": "b602b088acf456c1f0034dc65ed965e5a3920678",
"size": "1341",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/GP/OpenAlboPretorio/Scraper/AlboPretorioScraperFactory.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "76506"
},
{
"name": "PHP",
"bytes": "96896"
}
],
"symlink_target": ""
} |
create serial ser1
START WITH -10000000000000000000000000000000000000;
select * from db_serial WHERE name='ser1';
drop serial ser1; | {
"content_hash": "d63c923d1d96854fdee6103866df9237",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 51,
"avg_line_length": 22.166666666666668,
"alnum_prop": 0.8120300751879699,
"repo_name": "CUBRID/cubrid-testcases",
"id": "27ac6745ac9ddbba9c3f218df8ff61d573a00b2a",
"size": "228",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "sql/_01_object/_05_serial/_002_with_option/cases/1013.sql",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PLSQL",
"bytes": "682246"
},
{
"name": "Roff",
"bytes": "23262735"
},
{
"name": "TSQL",
"bytes": "5619"
},
{
"name": "eC",
"bytes": "710"
}
],
"symlink_target": ""
} |
package net.violet.platform.datamodel.mock;
import java.util.ArrayList;
import java.util.List;
import net.violet.db.records.AbstractMockRecord;
import net.violet.platform.datamodel.Feed;
import net.violet.platform.datamodel.FeedItem;
import net.violet.platform.datamodel.Files;
import net.violet.platform.datamodel.factories.Factories;
public class FeedItemMock extends AbstractMockRecord<FeedItem, FeedItemMock> implements FeedItem {
private final long feedId;
private final List<Files> contents;
private final String title;
private final String link;
private final String uri;
public FeedItemMock(long feedId, List<Files> contents, String title, String link, String uri) {
super(0);
this.feedId = feedId;
this.contents = contents;
this.title = title;
this.link = link;
this.uri = uri;
}
public List<Files> getContents() {
return new ArrayList<Files>(this.contents);
}
public Feed getFeed() {
return Factories.FEED.find(this.feedId);
}
public String getLink() {
return this.link;
}
public String getTitle() {
return this.title;
}
public String getUri() {
return this.uri;
}
}
| {
"content_hash": "6b8021054a197d06875ebf52c15b9946",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 98,
"avg_line_length": 23,
"alnum_prop": 0.7533274179236912,
"repo_name": "sebastienhouzet/nabaztag-source-code",
"id": "d5d2c307babaa6448dc3be9866a8f35987145752",
"size": "1127",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "server/OS/net/violet/platform/datamodel/mock/FeedItemMock.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "20745"
},
{
"name": "Batchfile",
"bytes": "8750"
},
{
"name": "C",
"bytes": "4993666"
},
{
"name": "C++",
"bytes": "1334194"
},
{
"name": "CSS",
"bytes": "181849"
},
{
"name": "Dylan",
"bytes": "98"
},
{
"name": "HTML",
"bytes": "788676"
},
{
"name": "Inno Setup",
"bytes": "532"
},
{
"name": "Java",
"bytes": "13700728"
},
{
"name": "JavaScript",
"bytes": "710228"
},
{
"name": "Lex",
"bytes": "4485"
},
{
"name": "Makefile",
"bytes": "9861"
},
{
"name": "PHP",
"bytes": "44903"
},
{
"name": "Perl",
"bytes": "12017"
},
{
"name": "Ruby",
"bytes": "2935"
},
{
"name": "Shell",
"bytes": "40087"
},
{
"name": "SourcePawn",
"bytes": "21480"
},
{
"name": "TeX",
"bytes": "13161"
}
],
"symlink_target": ""
} |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE23_Relative_Path_Traversal__wchar_t_listen_socket_w32CreateFile_64a.cpp
Label Definition File: CWE23_Relative_Path_Traversal.label.xml
Template File: sources-sink-64a.tmpl.cpp
*/
/*
* @description
* CWE: 23 Relative Path Traversal
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Use a fixed file name
* Sinks: w32CreateFile
* BadSink : Open the file named in data using CreateFile()
* Flow Variant: 64 Data flow: void pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#ifdef _WIN32
#define BASEPATH L"c:\\temp\\"
#else
#include <wchar.h>
#define BASEPATH L"/tmp/"
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
namespace CWE23_Relative_Path_Traversal__wchar_t_listen_socket_w32CreateFile_64
{
#ifndef OMITBAD
/* bad function declaration */
void badSink(void * dataVoidPtr);
void bad()
{
wchar_t * data;
wchar_t dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
wchar_t *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = wcslen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a listen socket */
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(wchar_t) * (FILENAME_MAX - dataLen - 1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[dataLen + recvResult / sizeof(wchar_t)] = L'\0';
/* Eliminate CRLF */
replace = wcschr(data, L'\r');
if (replace)
{
*replace = L'\0';
}
replace = wcschr(data, L'\n');
if (replace)
{
*replace = L'\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
badSink(&data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(void * dataVoidPtr);
static void goodG2B()
{
wchar_t * data;
wchar_t dataBuffer[FILENAME_MAX] = BASEPATH;
data = dataBuffer;
/* FIX: Use a fixed file name */
wcscat(data, L"file.txt");
goodG2BSink(&data);
}
void good()
{
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE23_Relative_Path_Traversal__wchar_t_listen_socket_w32CreateFile_64; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| {
"content_hash": "890eec8e7e0bf56df28fc4fc229d2f25",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 131,
"avg_line_length": 27.02051282051282,
"alnum_prop": 0.5655722148415259,
"repo_name": "maurer/tiamat",
"id": "07d6b50707e608ba5a228cdd0a4e474069876413",
"size": "5269",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "samples/Juliet/testcases/CWE23_Relative_Path_Traversal/s05/CWE23_Relative_Path_Traversal__wchar_t_listen_socket_w32CreateFile_64a.cpp",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
@interface LSPEmotionPage()
@property (strong,nonatomic) LSPEmotionPopView *popView;
@property (nonatomic,weak) UIButton *deleteBtn;
@end
@implementation LSPEmotionPage
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UIButton *deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[deleteBtn setImage:[UIImage imageNamed:@"compose_emotion_delete_highlighted"] forState:UIControlStateHighlighted];
[deleteBtn setImage:[UIImage imageNamed:@"compose_emotion_delete"] forState:UIControlStateNormal];
[deleteBtn addTarget:self action:@selector(deleteContent) forControlEvents:UIControlEventTouchUpInside];
[self addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressGestureRecognizer:)]];
[self addSubview:deleteBtn];
self.deleteBtn = deleteBtn;
}
return self;
}
- (void)deleteContent
{
[[NSNotificationCenter defaultCenter] postNotificationName:@"LSPEmotionPageDeleteNotification" object:nil];
}
-(LSPEmotionPopView *)popView
{
if (_popView == nil) {
self.popView = [LSPEmotionPopView popView];
}
return _popView;
}
- (void)setEmojis:(NSArray *)emojis
{
_emojis = emojis;
NSUInteger count = emojis.count;
for (NSUInteger i = 0; i < count; i ++) {
LSPEmotionButton *btn = [LSPEmotionButton buttonWithType:UIButtonTypeCustom];
LSPEmotion *emotion = emojis[i];
btn.emotion = emotion;
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:btn];
}
}
- (LSPEmotionButton *)enumerateButtonWithLocation:(CGPoint)location
{
NSUInteger count = self.emojis.count;
for (NSUInteger i = 0; i < count; i ++) {
LSPEmotionButton *button = self.subviews[i + 1];
if (CGRectContainsPoint(button.frame, location)) {
return button;
}
}
return nil;
}
- (void)longPressGestureRecognizer:(UILongPressGestureRecognizer *)recognizer
{
CGPoint location = [recognizer locationInView:recognizer.view];
LSPEmotionButton *btn = [self enumerateButtonWithLocation:location];
switch (recognizer.state) {
case UIGestureRecognizerStateCancelled:
case UIGestureRecognizerStateEnded:
[self.popView removeFromSuperview];
if (btn) {
[self selectEmotion:btn.emotion];
}
break;
case UIGestureRecognizerStateBegan:
case UIGestureRecognizerStateChanged:
[self.popView showFromButton:btn];
break;
default:
break;
}
}
- (void)layoutSubviews
{
[super layoutSubviews];
CGFloat padding = 10;
NSUInteger count = self.emojis.count;
CGFloat btnW = (self.width - 2 * padding) / LSPEmotionMaxCols;
CGFloat btnH = (self.height - padding) / LSPEmotionMaxRows;
for (NSUInteger i = 0; i < count; i ++) {
UIButton *btn = self.subviews[i + 1];
//btn.backgroundColor = LSPRandomColor;
btn.x = (i % 7) * btnW + padding;
btn.y = (i / 7) * btnH + padding;
btn.width = btnW;
btn.height = btnH;
}
CGFloat deleteBtnW = btnW;
CGFloat deleteBtnH = btnH;
self.deleteBtn.width = deleteBtnW;
self.deleteBtn.height = deleteBtnH;
self.deleteBtn.x = self.width - padding - deleteBtnW;
self.deleteBtn.y = self.height - deleteBtnH;
}
- (void)btnClick:(LSPEmotionButton *)button
{
[self.popView showFromButton:button];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.popView removeFromSuperview];
});
//按钮被点击的发送通知
[self selectEmotion:button.emotion];
}
- (void)selectEmotion:(LSPEmotion *)emotion
{
[LSPEmotionTool addRecentEmotion:emotion];
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[@"emotionDidSelected"] = emotion;
[[NSNotificationCenter defaultCenter] postNotificationName:@"LSPEmotionDidSelectedNotification" object:nil userInfo:userInfo];
}
@end
| {
"content_hash": "9855758a5cbaf6b7accdbc364a857378",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 141,
"avg_line_length": 29.2972972972973,
"alnum_prop": 0.6510608856088561,
"repo_name": "lispeng/LSPStatus",
"id": "d62fd56c0944736fa6f81d1a4eb677c2edae422d",
"size": "4889",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "微视界/微视界/Class/Compose/View/LSPEmotionPage.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "278"
},
{
"name": "Objective-C",
"bytes": "929351"
}
],
"symlink_target": ""
} |
package edu.usu.sdl.openstorefront.security;
import javax.servlet.http.HttpServletRequest;
import org.apache.shiro.authc.AuthenticationToken;
/**
* This hold the Header info used in the auth
*
* @author dshurtleff
*/
public class HeaderAuthToken
implements AuthenticationToken
{
private String username;
private String firstname;
private String lastname;
private String email;
private String group;
private String guid;
private String organization;
private String adminGroupName;
private HttpServletRequest request;
private UserContext userContext;
public HeaderAuthToken()
{
}
@Override
public Object getPrincipal()
{
return username;
}
@Override
public Object getCredentials()
{
//There really isn't any
return username;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getFirstname()
{
return firstname;
}
public void setFirstname(String firstname)
{
this.firstname = firstname;
}
public String getLastname()
{
return lastname;
}
public void setLastname(String lastname)
{
this.lastname = lastname;
}
public String getEmail()
{
return email;
}
public void setEmail(String email)
{
this.email = email;
}
public String getGroup()
{
return group;
}
public void setGroup(String group)
{
this.group = group;
}
public String getGuid()
{
return guid;
}
public void setGuid(String guid)
{
this.guid = guid;
}
public String getOrganization()
{
return organization;
}
public void setOrganization(String organization)
{
this.organization = organization;
}
public String getAdminGroupName()
{
return adminGroupName;
}
public void setAdminGroupName(String adminGroupName)
{
this.adminGroupName = adminGroupName;
}
public HttpServletRequest getRequest()
{
return request;
}
public void setRequest(HttpServletRequest request)
{
this.request = request;
}
public UserContext getUserContext()
{
return userContext;
}
public void setUserContext(UserContext userContext)
{
this.userContext = userContext;
}
}
| {
"content_hash": "688853e01da54f1fa3046392a2d283e2",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 53,
"avg_line_length": 14.86111111111111,
"alnum_prop": 0.7299065420560747,
"repo_name": "skycow/openstorefront",
"id": "da9cceca072917ff82da1753be86ef94e400f9d0",
"size": "2794",
"binary": false,
"copies": "3",
"ref": "refs/heads/v1.5",
"path": "server/openstorefront/openstorefront-web/src/main/java/edu/usu/sdl/openstorefront/security/HeaderAuthToken.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "24139"
},
{
"name": "CSS",
"bytes": "235452"
},
{
"name": "HTML",
"bytes": "909915"
},
{
"name": "Java",
"bytes": "2171522"
},
{
"name": "JavaScript",
"bytes": "1481458"
},
{
"name": "PHP",
"bytes": "2199"
},
{
"name": "Ruby",
"bytes": "44"
}
],
"symlink_target": ""
} |
title: Shallow Dream
categories:
- Machine Learning
- Perceptron
- Python
- Deep Dream
---
So far, this experiment has yielded one major take away: **_I need more tools!_**
Based on the very broad concept behind [Google's Deep Dream project](http://deepdreamgenerator.com/), [Thunder](https://github.com/ThunderShiviah) wondered what it was my little pet Perceptron had actually learned. Seemed an innocent enough quesion.
First step involved backing up a bit and polishing some of the project's rougher edges. I needed a visualization of the input and output. [Matplotlib](http://matplotlib.org/) was the easy answer, especially since it was all over [SciKit-learn](http://scikit-learn.org/stable/index.html) in the first place. And voilá.

Oops. Rabbit hole. Back now. A visualization now firmly in hand, what to work with next. It was growing tedious to rerun the training set each time I needed to adjust something that would not present itself as afoul until the end of the run. But as the state of the training vectors and therefor the state of the network object itself (specifically the weight sets for each neuron) was unchanged, I could just save that and re-import it for each run. Some hacky i/o code later (that I'll choose not to share) and next step down. It is only now that I found out about "pickling", which is just one more for the list (see paragraph 1).
Okay, let's feed it something other than a number and have it guess what it is. An 8 x 8 grid of "random normalized values between 0 and 255".
{% highlight python %}
x = np.random.normal(128, 1, (8, 8))
y = x.flatten()
{% endhighlight %}
The network thinks it sees a four. I pat it on the head and give it a cookie. So let's help it out a bit and tweak the image "toward" what it thinks it sees.
{% highlight python %}
def feedback(vector, weights, direction):
new_vector = []
for idx, x in enumerate(vector):
new_vector.append(x + (weights[idx] * direction))
return new_vector
{% endhighlight %}
Basically undoing the error correction from the learning run, but instead of *correcting* the weights, we adjust the pixel intensities of the input vector. And then feed that back in. And again. Until it seems to settle down.


And it did always settle.
Picking how to adjust the image was completely arbitrary. In the end I settled on adding to the intensity of the pixels heavily represented in the neuron that first fired, and subtracting (a much smaller portion) of the pixels that were heavily correlated with the neurons that didn't fire.
Now playing with the hyper-parameters changed the outcomes in various directions, but most settled around this output.
It turns out that the final outputs of this process look very similar to visual representations of the weight sets as an input vector. Now this is hardly surprising given the linear nature of this single layer network. So the next step is going to require a more complicated neural network. So, over here on the drawing board ... oh wait, that is for another post.
Until then, sweet dreams little perceptron.
Cheers. | {
"content_hash": "bc5590c5a7edb8162fe1b73d73960b70",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 639,
"avg_line_length": 61.80769230769231,
"alnum_prop": 0.7576228998133168,
"repo_name": "uglyboxer/uglyboxer.github.io",
"id": "6f7173767fef019e753dd709a54ddc915aa4ab23",
"size": "3219",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2015-10-15-shallow-dream.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12413"
},
{
"name": "HTML",
"bytes": "195412"
},
{
"name": "Ruby",
"bytes": "138"
}
],
"symlink_target": ""
} |
package edu.mecc.race2ged.navigation;
import android.R;
import android.app.ActionBar;
import android.app.Activity;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.lang.reflect.Method;
/**
* This class encapsulates some awful hacks.
*
* Before JB-MR2 (API 18) it was not possible to change the home-as-up indicator glyph
* in an action bar without some really gross hacks. Since the MR2 SDK is not published as of
* this writing, the new API is accessed via reflection here if available.
*/
class ActionBarDrawerToggleHoneycomb {
private static final String TAG = "ActionBarDrawerToggleHoneycomb";
private static final int[] THEME_ATTRS = new int[] {
R.attr.homeAsUpIndicator
};
public static Object setActionBarUpIndicator(Object info, Activity activity,
Drawable drawable, int contentDescRes) {
if (info == null) {
info = new SetIndicatorInfo(activity);
}
final SetIndicatorInfo sii = (SetIndicatorInfo) info;
if (sii.setHomeAsUpIndicator != null) {
try {
final ActionBar actionBar = activity.getActionBar();
sii.setHomeAsUpIndicator.invoke(actionBar, drawable);
sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
} catch (Exception e) {
Log.w(TAG, "Couldn't set home-as-up indicator via JB-MR2 API", e);
}
} else if (sii.upIndicatorView != null) {
sii.upIndicatorView.setImageDrawable(drawable);
} else {
Log.w(TAG, "Couldn't set home-as-up indicator");
}
return info;
}
public static Object setActionBarDescription(Object info, Activity activity,
int contentDescRes) {
if (info == null) {
info = new SetIndicatorInfo(activity);
}
final SetIndicatorInfo sii = (SetIndicatorInfo) info;
if (sii.setHomeAsUpIndicator != null) {
try {
final ActionBar actionBar = activity.getActionBar();
sii.setHomeActionContentDescription.invoke(actionBar, contentDescRes);
} catch (Exception e) {
Log.w(TAG, "Couldn't set content description via JB-MR2 API", e);
}
}
return info;
}
public static Drawable getThemeUpIndicator(Activity activity) {
final TypedArray a = activity.obtainStyledAttributes(THEME_ATTRS);
final Drawable result = a.getDrawable(0);
a.recycle();
return result;
}
private static class SetIndicatorInfo {
public Method setHomeAsUpIndicator;
public Method setHomeActionContentDescription;
public ImageView upIndicatorView;
SetIndicatorInfo(Activity activity) {
try {
setHomeAsUpIndicator = ActionBar.class.getDeclaredMethod("setHomeAsUpIndicator",
Drawable.class);
setHomeActionContentDescription = ActionBar.class.getDeclaredMethod(
"setHomeActionContentDescription", Integer.TYPE);
// If we got the method we won't need the stuff below.
return;
} catch (NoSuchMethodException e) {
// Oh well. We'll use the other mechanism below instead.
}
final View home = activity.findViewById(R.id.home);
if (home == null) {
// Action bar doesn't have a known configuration, an OEM messed with things.
return;
}
final ViewGroup parent = (ViewGroup) home.getParent();
final int childCount = parent.getChildCount();
if (childCount != 2) {
// No idea which one will be the right one, an OEM messed with things.
return;
}
final View first = parent.getChildAt(0);
final View second = parent.getChildAt(1);
final View up = first.getId() == R.id.home ? second : first;
if (up instanceof ImageView) {
// Jackpot! (Probably...)
upIndicatorView = (ImageView) up;
}
}
}
}
| {
"content_hash": "0b6489fb6bfdabbf7490b75babaf7000",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 96,
"avg_line_length": 36.91525423728814,
"alnum_prop": 0.6117998163452709,
"repo_name": "RegionalAdultEducation/Race2GED2",
"id": "a37c97d0435883c91280a1e8056db8717ba65c1a",
"size": "5045",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Race2GED2/src/main/java/edu/mecc/race2ged/navigation/ActionBarDrawerToggleHoneycomb.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "224596"
}
],
"symlink_target": ""
} |
package com.hazelcast.spi.impl;
import com.hazelcast.logging.ILogger;
import com.hazelcast.nio.Packet;
import static com.hazelcast.instance.OutOfMemoryErrorDispatcher.inspectOutOfMemoryError;
import static com.hazelcast.nio.Packet.FLAG_OP_CONTROL;
import static com.hazelcast.nio.Packet.FLAG_OP_RESPONSE;
/**
* A {@link PacketHandler} that dispatches the {@link Packet} to the right service. So operations are send to the
* {@link com.hazelcast.spi.OperationService}, events are send to the {@link com.hazelcast.spi.EventService} etc.
*/
public final class PacketDispatcher implements PacketHandler {
private final ILogger logger;
private final PacketHandler eventService;
private final PacketHandler operationExecutor;
private final PacketHandler jetService;
private final PacketHandler connectionManager;
private final PacketHandler responseHandler;
private final PacketHandler invocationMonitor;
public PacketDispatcher(ILogger logger,
PacketHandler operationExecutor,
PacketHandler responseHandler,
PacketHandler invocationMonitor,
PacketHandler eventService,
PacketHandler connectionManager,
PacketHandler jetService) {
this.logger = logger;
this.responseHandler = responseHandler;
this.eventService = eventService;
this.invocationMonitor = invocationMonitor;
this.connectionManager = connectionManager;
this.operationExecutor = operationExecutor;
this.jetService = jetService;
}
@Override
public void handle(Packet packet) throws Exception {
try {
switch (packet.getPacketType()) {
case OPERATION:
if (packet.isFlagRaised(FLAG_OP_RESPONSE)) {
responseHandler.handle(packet);
} else if (packet.isFlagRaised(FLAG_OP_CONTROL)) {
invocationMonitor.handle(packet);
} else {
operationExecutor.handle(packet);
}
break;
case EVENT:
eventService.handle(packet);
break;
case BIND:
connectionManager.handle(packet);
break;
case JET:
jetService.handle(packet);
break;
default:
logger.severe("Header flags [" + Integer.toBinaryString(packet.getFlags())
+ "] specify an undefined packet type " + packet.getPacketType().name());
}
} catch (Throwable t) {
inspectOutOfMemoryError(t);
logger.severe("Failed to process:" + packet, t);
}
}
}
| {
"content_hash": "f2efa1aa05d2775a77e6d7089c3242ed",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 113,
"avg_line_length": 39.78082191780822,
"alnum_prop": 0.5946969696969697,
"repo_name": "tombujok/hazelcast",
"id": "2c952bc2613c39144763a20e08cbaeef64123e15",
"size": "3529",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "hazelcast/src/main/java/com/hazelcast/spi/impl/PacketDispatcher.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1449"
},
{
"name": "Java",
"bytes": "33147517"
},
{
"name": "Shell",
"bytes": "12286"
}
],
"symlink_target": ""
} |
import React, { PureComponent } from "react";
import studentReporturl from "../../util/student-report-url";
export default class StudentReportLink extends PureComponent {
render() {
const {student, started, activityIndex} = this.props;
const studentId = student.get("id");
const name = student.get("name");
const link = studentReporturl(studentId, activityIndex);
const linkToWork = (
<a href={link} target="_blank">
Open {name}'s report
</a>
);
const noLinkToWork = (
<span>
{name} hasn't started yet
</span>
);
if (started) {
return linkToWork;
}
return noLinkToWork;
}
}
| {
"content_hash": "95e07c07ea47c026ba5117c0b096ab7c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 62,
"avg_line_length": 23.20689655172414,
"alnum_prop": 0.6166419019316494,
"repo_name": "concord-consortium/portal-report",
"id": "a96522b7308e5c05ac80b162ead5f8ea69107189",
"size": "673",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "js/components/report/student-report-link.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12402"
},
{
"name": "HTML",
"bytes": "2207"
},
{
"name": "JavaScript",
"bytes": "461208"
},
{
"name": "Less",
"bytes": "107912"
},
{
"name": "Shell",
"bytes": "3185"
},
{
"name": "TypeScript",
"bytes": "307248"
}
],
"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 (version 1.7.0_55) on Sun Oct 26 05:56:44 EDT 2014 -->
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>API Help (Solr 4.10.2 API)</title>
<meta name="date" content="2014-10-26">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="API Help (Solr 4.10.2 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Help</li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
<li><a href="help-doc.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">
<h1 class="title">How This API Document Is Organized</h1>
<div class="subTitle">This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.</div>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<h2>Overview</h2>
<p>The <a href="overview-summary.html">Overview</a> page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.</p>
</li>
<li class="blockList">
<h2>Package</h2>
<p>Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:</p>
<ul>
<li>Interfaces (italic)</li>
<li>Classes</li>
<li>Enums</li>
<li>Exceptions</li>
<li>Errors</li>
<li>Annotation Types</li>
</ul>
</li>
<li class="blockList">
<h2>Class/Interface</h2>
<p>Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:</p>
<ul>
<li>Class inheritance diagram</li>
<li>Direct Subclasses</li>
<li>All Known Subinterfaces</li>
<li>All Known Implementing Classes</li>
<li>Class/interface declaration</li>
<li>Class/interface description</li>
</ul>
<ul>
<li>Nested Class Summary</li>
<li>Field Summary</li>
<li>Constructor Summary</li>
<li>Method Summary</li>
</ul>
<ul>
<li>Field Detail</li>
<li>Constructor Detail</li>
<li>Method Detail</li>
</ul>
<p>Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</p>
</li>
<li class="blockList">
<h2>Annotation Type</h2>
<p>Each annotation type has its own separate page with the following sections:</p>
<ul>
<li>Annotation Type declaration</li>
<li>Annotation Type description</li>
<li>Required Element Summary</li>
<li>Optional Element Summary</li>
<li>Element Detail</li>
</ul>
</li>
<li class="blockList">
<h2>Enum</h2>
<p>Each enum has its own separate page with the following sections:</p>
<ul>
<li>Enum declaration</li>
<li>Enum description</li>
<li>Enum Constant Summary</li>
<li>Enum Constant Detail</li>
</ul>
</li>
<li class="blockList">
<h2>Use</h2>
<p>Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.</p>
</li>
<li class="blockList">
<h2>Tree (Class Hierarchy)</h2>
<p>There is a <a href="overview-tree.html">Class Hierarchy</a> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.</p>
<ul>
<li>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.</li>
<li>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</li>
</ul>
</li>
<li class="blockList">
<h2>Deprecated API</h2>
<p>The <a href="deprecated-list.html">Deprecated API</a> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</p>
</li>
<li class="blockList">
<h2>Prev/Next</h2>
<p>These links take you to the next or previous class, interface, package, or related page.</p>
</li>
<li class="blockList">
<h2>Frames/No Frames</h2>
<p>These links show and hide the HTML frames. All pages are available with or without frames.</p>
</li>
<li class="blockList">
<h2>All Classes</h2>
<p>The <a href="allclasses-noframe.html">All Classes</a> link shows all classes and interfaces except non-static nested types.</p>
</li>
<li class="blockList">
<h2>Serialized Form</h2>
<p>Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.</p>
</li>
<li class="blockList">
<h2>Constant Field Values</h2>
<p>The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.</p>
</li>
</ul>
<em>This help file applies to API documentation generated using the standard doclet.</em></div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="overview-summary.html">Overview</a></li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li class="navBarCell1Rev">Help</li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?help-doc.html" target="_top">Frames</a></li>
<li><a href="help-doc.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>
<i>Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.</i>
<script src='/prettify.js' type='text/javascript'></script>
<script type='text/javascript'>
(function(){
var oldonload = window.onload;
if (typeof oldonload != 'function') {
window.onload = prettyPrint;
} else {
window.onload = function() {
oldonload();
prettyPrint();
}
}
})();
</script>
</small></p>
</body>
</html>
| {
"content_hash": "76563d505f8b94f20993bce5af55f22a",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 497,
"avg_line_length": 39.758620689655174,
"alnum_prop": 0.6682567215958369,
"repo_name": "kilfu0701/Solr4-Scaffold",
"id": "ebb465f460b2c1e4117a338b48502861a6a9bd7e",
"size": "9224",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "solr-4.10.2/docs/solr-clustering/help-doc.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "117761"
},
{
"name": "C++",
"bytes": "73666"
},
{
"name": "CSS",
"bytes": "331462"
},
{
"name": "Java",
"bytes": "304833"
},
{
"name": "JavaScript",
"bytes": "1035058"
},
{
"name": "Makefile",
"bytes": "3890"
},
{
"name": "Prolog",
"bytes": "75664"
},
{
"name": "Shell",
"bytes": "252633"
},
{
"name": "XSLT",
"bytes": "132573"
}
],
"symlink_target": ""
} |
package org.drools.compiler.integrationtests;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.drools.core.marshalling.impl.ProtobufMarshaller;
import org.drools.core.util.DroolsStreamUtils;
import org.kie.api.KieBase;
import org.kie.api.marshalling.ObjectMarshallingStrategy;
import org.kie.api.runtime.EnvironmentName;
import org.kie.api.runtime.KieSession;
import org.kie.api.time.SessionClock;
import org.kie.internal.marshalling.MarshallerFactory;
import org.kie.internal.runtime.StatefulKnowledgeSession;
/**
* Marshalling helper class to perform serialize/de-serialize a given object
*/
public class SerializationHelper {
public static <T> T serializeObject(T obj) throws IOException,
ClassNotFoundException {
return serializeObject( obj,
null );
}
@SuppressWarnings("unchecked")
public static <T> T serializeObject(T obj,
ClassLoader classLoader) throws IOException,
ClassNotFoundException {
return (T) DroolsStreamUtils.streamIn( DroolsStreamUtils.streamOut( obj ),
classLoader );
}
public static StatefulKnowledgeSession getSerialisedStatefulKnowledgeSession(KieSession ksession,
boolean dispose) throws Exception {
return getSerialisedStatefulKnowledgeSession( ksession,
dispose,
true );
}
public static StatefulKnowledgeSession getSerialisedStatefulKnowledgeSession(KieSession ksession,
boolean dispose,
boolean testRoundTrip ) throws Exception {
return getSerialisedStatefulKnowledgeSession( ksession,ksession.getKieBase(), dispose, testRoundTrip );
}
public static StatefulKnowledgeSession getSerialisedStatefulKnowledgeSession(KieSession ksession,
KieBase kbase,
boolean dispose ) throws Exception {
return getSerialisedStatefulKnowledgeSession( ksession, kbase, dispose, true );
}
public static StatefulKnowledgeSession getSerialisedStatefulKnowledgeSession(KieSession ksession,
KieBase kbase,
boolean dispose,
boolean testRoundTrip ) throws Exception {
ProtobufMarshaller marshaller = (ProtobufMarshaller) MarshallerFactory.newMarshaller( kbase,
(ObjectMarshallingStrategy[])ksession.getEnvironment().get(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES) );
long time = ksession.<SessionClock>getSessionClock().getCurrentTime();
// make sure globas are in the environment of the session
ksession.getEnvironment().set( EnvironmentName.GLOBALS, ksession.getGlobals() );
// Serialize object
final byte [] b1;
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
marshaller.marshall( bos,
ksession,
time );
b1 = bos.toByteArray();
bos.close();
}
// Deserialize object
StatefulKnowledgeSession ksession2;
{
ByteArrayInputStream bais = new ByteArrayInputStream( b1 );
ksession2 = marshaller.unmarshall( bais,
ksession.getSessionConfiguration(),
ksession.getEnvironment());
bais.close();
}
if( testRoundTrip ) {
// for now, we can ensure the IDs will match because queries are creating untraceable fact handles at the moment
// int previous_id = ((StatefulKnowledgeSessionImpl)ksession).session.getFactHandleFactory().getId();
// long previous_recency = ((StatefulKnowledgeSessionImpl)ksession).session.getFactHandleFactory().getRecency();
// int current_id = ((StatefulKnowledgeSessionImpl)ksession2).session.getFactHandleFactory().getId();
// long current_recency = ((StatefulKnowledgeSessionImpl)ksession2).session.getFactHandleFactory().getRecency();
// ((StatefulKnowledgeSessionImpl)ksession2).session.getFactHandleFactory().clear( previous_id, previous_recency );
// Reserialize and check that byte arrays are the same
final byte[] b2;
{
ByteArrayOutputStream bos = new ByteArrayOutputStream();
marshaller.marshall( bos,
ksession2,
time );
b2 = bos.toByteArray();
bos.close();
}
// bytes should be the same.
if ( !areByteArraysEqual( b1,
b2 ) ) {
// throw new IllegalArgumentException( "byte streams for serialisation test are not equal" );
}
// ((StatefulKnowledgeSessionImpl) ksession2).session.getFactHandleFactory().clear( current_id, current_recency );
// ((StatefulKnowledgeSessionImpl) ksession2).session.setGlobalResolver( ((StatefulKnowledgeSessionImpl) ksession).session.getGlobalResolver() );
}
if ( dispose ) {
ksession.dispose();
}
return ksession2;
}
private static boolean areByteArraysEqual(byte[] b1, byte[] b2) {
if ( b1.length != b2.length ) {
System.out.println( "Different length: b1=" + b1.length + " b2=" + b2.length );
return false;
}
// System.out.println( "b1" );
// for ( int i = 0, length = b1.length; i < length; i++ ) {
// if ( i == 81 ) {
// System.out.print( "!" );
// }
// System.out.print( b1[i] );
// if ( i == 83 ) {
// System.out.print( "!" );
// }
// }
//
// System.out.println( "\nb2" );
// for ( int i = 0, length = b2.length; i < length; i++ ) {
// if ( i == 81 ) {
// System.out.print( "!" );
// }
// System.out.print( b2[i] );
// if ( i == 83 ) {
// System.out.print( "!" );
// }
// }
boolean result = true;
for ( int i = 0, length = b1.length; i < length; i++ ) {
if ( b1[i] != b2[i] ) {
System.out.println( "Difference at " + i + ": [" + b1[i] + "] != [" + b2[i] + "]" );
result = false;
}
}
return result;
}
}
| {
"content_hash": "f708e297fba55c12d686b1b8ddc4b2ee",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 173,
"avg_line_length": 44.945454545454545,
"alnum_prop": 0.5161812297734628,
"repo_name": "ngs-mtech/drools",
"id": "22f41d886ea37d45c1267fa0c1f530d957c92060",
"size": "7993",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "drools-compiler/src/test/java/org/drools/compiler/integrationtests/SerializationHelper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "14766"
},
{
"name": "Batchfile",
"bytes": "2554"
},
{
"name": "CSS",
"bytes": "1412"
},
{
"name": "GAP",
"bytes": "197080"
},
{
"name": "HTML",
"bytes": "9298"
},
{
"name": "Java",
"bytes": "28253841"
},
{
"name": "Python",
"bytes": "4555"
},
{
"name": "Ruby",
"bytes": "491"
},
{
"name": "Shell",
"bytes": "1120"
},
{
"name": "Standard ML",
"bytes": "82260"
},
{
"name": "XSLT",
"bytes": "24302"
}
],
"symlink_target": ""
} |
#include <aws/codestar-connections/CodeStarconnectionsEndpoint.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <aws/core/utils/HashingUtils.h>
using namespace Aws;
using namespace Aws::CodeStarconnections;
namespace Aws
{
namespace CodeStarconnections
{
namespace CodeStarconnectionsEndpoint
{
static const int CN_NORTH_1_HASH = Aws::Utils::HashingUtils::HashString("cn-north-1");
static const int CN_NORTHWEST_1_HASH = Aws::Utils::HashingUtils::HashString("cn-northwest-1");
static const int US_ISO_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-iso-east-1");
static const int US_ISOB_EAST_1_HASH = Aws::Utils::HashingUtils::HashString("us-isob-east-1");
Aws::String ForRegion(const Aws::String& regionName, bool useDualStack)
{
// Fallback to us-east-1 if global endpoint does not exists.
Aws::String region = regionName == Aws::Region::AWS_GLOBAL ? Aws::Region::US_EAST_1 : regionName;
auto hash = Aws::Utils::HashingUtils::HashString(region.c_str());
Aws::StringStream ss;
ss << "codestar-connections" << ".";
if(useDualStack)
{
ss << "dualstack.";
}
ss << region;
if (hash == CN_NORTH_1_HASH || hash == CN_NORTHWEST_1_HASH)
{
ss << ".amazonaws.com.cn";
}
else if (hash == US_ISO_EAST_1_HASH)
{
ss << ".c2s.ic.gov";
}
else if (hash == US_ISOB_EAST_1_HASH)
{
ss << ".sc2s.sgov.gov";
}
else
{
ss << ".amazonaws.com";
}
return ss.str();
}
} // namespace CodeStarconnectionsEndpoint
} // namespace CodeStarconnections
} // namespace Aws
| {
"content_hash": "52e2c471a623e582fd44c4f7e98b9374",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 101,
"avg_line_length": 26.39344262295082,
"alnum_prop": 0.6577639751552795,
"repo_name": "cedral/aws-sdk-cpp",
"id": "03af3c6ac45eb7703334cf735349fec95312cb50",
"size": "1729",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-codestar-connections/source/CodeStarconnectionsEndpoint.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "294220"
},
{
"name": "C++",
"bytes": "428637022"
},
{
"name": "CMake",
"bytes": "862025"
},
{
"name": "Dockerfile",
"bytes": "11688"
},
{
"name": "HTML",
"bytes": "7904"
},
{
"name": "Java",
"bytes": "352201"
},
{
"name": "Python",
"bytes": "106761"
},
{
"name": "Shell",
"bytes": "10891"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>flocq-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.5.0~camlp4 / flocq-quickchick - 1.0.2</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
flocq-quickchick
<small>
1.0.2
<span class="label label-info">Not compatible</span>
</small>
</h1>
<p><em><script>document.write(moment("2020-09-23 22:02:02 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-09-23 22:02:02 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-ocamlbuild base OCamlbuild binary and libraries distributed with the OCaml compiler
base-threads base
base-unix base
camlp4 4.02+7 Camlp4 is a system for writing extensible parsers for programming languages
conf-findutils 1 Virtual package relying on findutils
conf-which 1 Virtual package relying on which
coq 8.5.0~camlp4 Formal proof management system.
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.02.3 The OCaml compiler (virtual package)
ocaml-base-compiler 4.02.3 Official 4.02.3 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0 Build system distributed with the OCaml compiler since OCaml 3.10.0
# opam file:
opam-version: "2.0"
maintainer: "Yaroslav Kogevnikov <[email protected]>"
authors: "Yaroslav Kogevnikov <[email protected]>"
homepage: "https://github.com/digamma-ai/flocq-quickchick"
synopsis: "Flocq binary_float generators for QuickChick testing framework"
license: "MIT"
bug-reports: "https://github.com/digamma-ai/flocq-quickchick/issues"
depends: [
"coq" {= "8.11.0"}
"coq-quickchick" {>= "1.3.0"}
"coq-flocq" {>= "3.2.0"}
]
build: [
["coq_makefile" "-f" "_CoqProject" "-o" "Makefile"]
[make]
]
install: [make "install"]
dev-repo: "git+https://github.com/digamma-ai/flocq-quickchick.git"
tags: [
"logpath: FlocqQuickChick"
"date: 2020-04-01"
]
url {
src: "https://github.com/digamma-ai/flocq-quickchick/archive/1.0.2.tar.gz"
checksum: "sha256=a68ad644eebb17bfaac67758da1dd571a069a26f1e9290c6d633e2e407b0c156"
}
</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-flocq-quickchick.1.0.2 coq.8.5.0~camlp4</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~camlp4).
The following dependencies couldn't be met:
- coq-flocq-quickchick -> coq = 8.11.0 -> ocaml >= 4.05.0
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-flocq-quickchick.1.0.2</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">
<small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small>
</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": "b827ac00b75265392b84703a9d400f22",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 157,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.5489313835770528,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "ffabf9c78fcbb65e284e6943d4cdeb5fd932ad19",
"size": "7114",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.02.3-2.0.1/released/8.5.0~camlp4/flocq-quickchick/1.0.2.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
module Builderator
module Control
class Version
##
# Sort earliest -> latest
# (Array.last -> latest (e.g. 1.0.0), Array.first -> earliest(e.g. 0.0.1))
##
module Comparable
include ::Comparable
def <=>(other)
## Simple version comparison
return major <=> other.major unless same?(:major, other)
return minor <=> other.minor unless same?(:minor, other)
return patch <=> other.patch unless same?(:patch, other)
## Prereleases: prerelease < non-prerelease
return compare(:is_prerelease, other) if one?(:is_prerelease, other)
if both?(:is_prerelease, other)
## This is a little sketchy... We're assuming that pre-releases
## have a lexicological order.
return prerelease_name <=> other.prerelease_name unless same?(:prerelease_name, other)
return prerelease_iteration <=> other.prerelease_iteration unless same?(:prerelease_iteration, other)
end
## Build number. With build number > without build number
compare(:build, other)
end
private
## this == that
def same?(parameter, other)
send(parameter) == other.send(parameter)
end
## this && that
def both?(parameter, other)
send(parameter) && other.send(parameter)
end
## this ^ that (XOR)
def one?(parameter, other)
(send(parameter)) ^ (other.send(parameter))
end
## this || that
def either?(parameter, other)
send(parameter) || other.send(parameter)
end
## !(this || that)
def neither?(parameter, other)
!either?(parameter, other)
end
## Compare with support for `nil` values
def compare(parameter, other)
a = send(parameter)
b = other.send(parameter)
## NilClass, TrueClass, and FalseClass' <=> operators return nil
return a <=> b unless a.nil? || b.nil? ||
a.is_a?(TrueClass) || b.is_a?(TrueClass) ||
a.is_a?(FalseClass) || b.is_a?(FalseClass)
return 1 if a && !b
return -1 if !a && b
## a && b || !a && !b
0
end
end
end
end
end
| {
"content_hash": "24aef88d2d9b08840083ff8963307461",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 113,
"avg_line_length": 30.61038961038961,
"alnum_prop": 0.5337293169282987,
"repo_name": "rapid7/builderator",
"id": "d688ad3a918de470feacab9b6f1e830f131e24e1",
"size": "2357",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/builderator/control/version/comparable.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2876"
},
{
"name": "Ruby",
"bytes": "154520"
}
],
"symlink_target": ""
} |
<?php
/**
* @see Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* @see Zend_Gdata_Gbase_Query
*/
require_once('Zend/Gdata/Gbase/Query.php');
/**
* Assists in constructing queries for Google Base Customer Items Feed
*
* @link http://code.google.com/apis/base/
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gbase
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gbase_ItemQuery extends Zend_Gdata_Gbase_Query
{
/**
* Path to the customer items feeds on the Google Base server.
*/
const GBASE_ITEM_FEED_URI = 'http://www.google.com/base/feeds/items';
/**
* The default URI for POST methods
*
* @var string
*/
protected $_defaultFeedUri = self::GBASE_ITEM_FEED_URI;
/**
* The id of an item
*
* @var string
*/
protected $_id = null;
/**
* @param string $value
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
*/
public function setId($value)
{
$this->_id = $value;
return $this;
}
/*
* @return string id
*/
public function getId()
{
return $this->_id;
}
/**
* Returns the query URL generated by this query instance.
*
* @return string The query URL for this instance.
*/
public function getQueryUrl()
{
$uri = $this->_defaultFeedUri;
if ($this->getId() !== null) {
$uri .= '/' . $this->getId();
} else {
$uri .= $this->getQueryString();
}
return $uri;
}
}
| {
"content_hash": "d1f91d32a02edd1d9062a3b6d10dde51",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 87,
"avg_line_length": 20.975609756097562,
"alnum_prop": 0.5627906976744186,
"repo_name": "vrunoa/examen-fadgut",
"id": "5112e0a63edf2a42d7ac89b03cb15d26a65c0a33",
"size": "2486",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "solucion/library/Zend/Gdata/Gbase/ItemQuery.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "12033871"
},
{
"name": "Ruby",
"bytes": "94"
}
],
"symlink_target": ""
} |
<!--
Copyright © 2015 Cask Data, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
<div ng-controller="HydratorDetailLogController as LogsCtrl">
<my-log-viewer data-params="LogsCtrl.logsParams"></my-log-viewer>
</div>
| {
"content_hash": "352ca23fcfa85dec58c72d0124edcbd6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 37.94736842105263,
"alnum_prop": 0.7558945908460472,
"repo_name": "chtyim/cdap",
"id": "0f95f107bea54ae3b2792eb2d2e1b64dfd28e54e",
"size": "722",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "cdap-ui/app/features/hydrator/templates/detail/tabs/log.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "13173"
},
{
"name": "CSS",
"bytes": "219754"
},
{
"name": "HTML",
"bytes": "455678"
},
{
"name": "Java",
"bytes": "15847298"
},
{
"name": "JavaScript",
"bytes": "1180404"
},
{
"name": "Python",
"bytes": "102235"
},
{
"name": "Ruby",
"bytes": "3178"
},
{
"name": "Scala",
"bytes": "30340"
},
{
"name": "Shell",
"bytes": "195815"
}
],
"symlink_target": ""
} |
package com.actram.solace.interpreter.error;
/**
* An error representing a {@link String} conversion fail caused by the
* interpreted value being out of range.
*
* @author Peter André Johansen
*/
public class OutOfRangeError implements InterpreterError {
} | {
"content_hash": "4288fb3fc82915097d0d711dcf3c2cf9",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 71,
"avg_line_length": 26.2,
"alnum_prop": 0.7633587786259542,
"repo_name": "peterjohansen/gus",
"id": "0f395838375ed9de25011ccb1098fc0ffbcd8de2",
"size": "263",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/main/java/com/actram/solace/interpreter/error/OutOfRangeError.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "30515"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Common attributes -->
<attr name="bootstrapBrand" format="enum">
<enum name="primary" value="0"/>
<enum name="success" value="1"/>
<enum name="info" value="2"/>
<enum name="warning" value="3"/>
<enum name="danger" value="4"/>
<enum name="regular" value="5"/>
<enum name="secondary" value="6"/>
</attr>
<attr name="buttonMode" format="enum">
<enum name="regular" value="0"/>
<enum name="toggle" value="1"/>
<enum name="checkbox" value="2"/>
<enum name="radio" value="3"/>
</attr>
<attr name="bootstrapSize" format="enum">
<enum name="xs" value="0"/>
<enum name="sm" value="1"/>
<enum name="md" value="2"/>
<enum name="lg" value="3"/>
<enum name="xl" value="4"/>
</attr>
<attr name="bootstrapHeading" format="enum">
<enum name="h1" value="0"/>
<enum name="h2" value="1"/>
<enum name="h3" value="2"/>
<enum name="h4" value="3"/>
<enum name="h5" value="4"/>
<enum name="h6" value="5"/>
</attr>
<attr name="bootstrapExpandDirection" format="enum">
<enum name="up" value="0"/>
<enum name="down" value="1"/>
</attr>
<attr name="showOutline" format="boolean"/>
<attr name="roundedCorners" format="boolean"/>
<attr name="hasBorder" format="boolean"/>
<attr name="checkedButton" format="reference"/>
<attr name="checked" format="boolean"/>
<attr name="dropdownResource" format="reference"/>
<attr name="itemHeight" format="dimension"/>
<attr name="strongText" format="string"/>
<attr name="messageText" format="string"/>
<attr name="badgeText" format="string"/>
<attr name="dismissible" format="boolean"/>
<!-- View attributes -->
<declare-styleable name="AwesomeTextView">
<attr name="bootstrapText" format="string"/>
<attr name="bootstrapBrand"/>
<attr name="fontAwesomeIcon"/>
<attr name="typicon"/>
</declare-styleable>
<declare-styleable name="BootstrapLabel">
<attr name="bootstrapHeading"/>
<attr name="roundedCorners"/>
</declare-styleable>
<declare-styleable name="BootstrapButton">
<attr name="buttonMode"/>
<attr name="showOutline"/>
<attr name="roundedCorners"/>
<attr name="bootstrapBrand"/>
<attr name="bootstrapSize"/>
<attr name="checked"/>
<attr name="badgeText"/>
</declare-styleable>
<declare-styleable name="BootstrapButtonGroup">
<attr name="buttonMode"/>
<attr name="showOutline"/>
<attr name="roundedCorners"/>
<attr name="bootstrapBrand"/>
<attr name="bootstrapSize"/>
<attr name="checkedButton"/>
</declare-styleable>
<declare-styleable name="BootstrapProgressBar">
<attr name="striped" format="boolean"/>
<attr name="animated" format="boolean"/>
<attr name="progress" format="integer"/>
<attr name="roundedCorners"/>
<attr name="bootstrapBrand"/>
<attr name="bootstrapSize"/>
</declare-styleable>
<declare-styleable name="BootstrapCircleThumbnail">
<attr name="bootstrapBrand"/>
<attr name="hasBorder"/>
<attr name="bootstrapSize"/>
</declare-styleable>
<declare-styleable name="BootstrapThumbnail">
<attr name="bootstrapBrand"/>
<attr name="roundedCorners"/>
<attr name="hasBorder"/>
<attr name="bootstrapSize"/>
</declare-styleable>
<declare-styleable name="BootstrapEditText">
<attr name="roundedCorners"/>
<attr name="bootstrapBrand"/>
<attr name="bootstrapSize"/>
</declare-styleable>
<declare-styleable name="BootstrapDropDown">
<attr name="bootstrapExpandDirection"/>
<attr name="dropdownResource"/>
<attr name="showOutline"/>
<attr name="roundedCorners"/>
<attr name="bootstrapBrand"/>
<attr name="bootstrapSize"/>
<attr name="itemHeight"/>
</declare-styleable>
<declare-styleable name="BootstrapWell">
<attr name="bootstrapSize"/>
</declare-styleable>
<declare-styleable name="BootstrapAlert">
<attr name="bootstrapBrand"/>
<attr name="strongText"/>
<attr name="messageText"/>
<attr name="dismissible"/>
</declare-styleable>
<declare-styleable name="BootstrapBadge">
<attr name="badgeText"/>
<attr name="bootstrapSize"/>
</declare-styleable>
</resources>
| {
"content_hash": "5b7d04d3bbd9deb002328c57388f6a02",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 56,
"avg_line_length": 31.958620689655174,
"alnum_prop": 0.5897712559343979,
"repo_name": "haitao111313/Android-Bootstrap",
"id": "59f56d538907693dadf406db17af8baf3f483241",
"size": "4634",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "AndroidBootstrap/src/main/res/values/attrs.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "412550"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:300,400,400i,700&display=fallback" rel="stylesheet">
<style>
body,
input {
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, sans-serif
}
code,
kbd,
pre {
font-family: "Roboto Mono", "Courier New", Courier, monospace
}
</style>
<link rel="stylesheet" href="../_static/stylesheets/application.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-palette.css"/>
<link rel="stylesheet" href="../_static/stylesheets/application-fixes.css"/>
<link rel="stylesheet" href="../_static/fonts/material-icons.css"/>
<meta name="theme-color" content="#3f51b5">
<script src="../_static/javascripts/modernizr.js"></script>
<title>statsmodels.regression.recursive_ls.RecursiveLSResults.states — statsmodels</title>
<link rel="icon" type="image/png" sizes="32x32" href="../_static/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../_static/icons/favicon-16x16.png">
<link rel="manifest" href="../_static/icons/site.webmanifest">
<link rel="mask-icon" href="../_static/icons/safari-pinned-tab.svg" color="#919191">
<meta name="msapplication-TileColor" content="#2b5797">
<meta name="msapplication-config" content="../_static/icons/browserconfig.xml">
<link rel="stylesheet" href="../_static/stylesheets/examples.css">
<link rel="stylesheet" href="../_static/stylesheets/deprecation.css">
<link rel="stylesheet" href="../_static/material.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.regression.recursive_ls.RecursiveLSResults.tvalues" href="statsmodels.regression.recursive_ls.RecursiveLSResults.tvalues.html" />
<link rel="prev" title="statsmodels.regression.recursive_ls.RecursiveLSResults.ssr" href="statsmodels.regression.recursive_ls.RecursiveLSResults.ssr.html" />
</head>
<body dir=ltr
data-md-color-primary=indigo data-md-color-accent=blue>
<svg class="md-svg">
<defs data-children-count="0">
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="__github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search">
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
<a href="#generated/statsmodels.regression.recursive_ls.RecursiveLSResults.states" tabindex="1" class="md-skip"> Skip to content </a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex navheader">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="../index.html" title="statsmodels"
class="md-header-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" height="26"
alt="statsmodels logo">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">statsmodels v0.12.1</span>
<span class="md-header-nav__topic"> statsmodels.regression.recursive_ls.RecursiveLSResults.states </span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" action="../search.html" method="GET" name="search">
<input type="text" class="md-search__input" name="q" placeholder="Search"
autocapitalize="off" autocomplete="off" spellcheck="false"
data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="__search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">

</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
</div>
<script src="../_static/javascripts/version_dropdown.js"></script>
<script>
var json_loc = "../_static/versions.json",
target_loc = "../../",
text = "Versions";
$( document ).ready( add_version_dropdown(json_loc, target_loc, text));
</script>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item"><a href="../user-guide.html" class="md-tabs__link">User Guide</a></li>
<li class="md-tabs__item"><a href="../regression.html" class="md-tabs__link">Linear Regression</a></li>
<li class="md-tabs__item"><a href="statsmodels.regression.recursive_ls.RecursiveLSResults.html" class="md-tabs__link">statsmodels.regression.recursive_ls.RecursiveLSResults</a></li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="__drawer">
<a href="../index.html" title="statsmodels" class="md-nav__button md-logo">
<img src="../_static/statsmodels-logo-v2-bw.svg" alt=" logo" width="48" height="48">
</a>
<a href="../index.html"
title="statsmodels">statsmodels v0.12.1</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/statsmodels/statsmodels" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24" width="28" height="28">
<use xlink:href="#__github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
statsmodels
</div>
</a>
</div>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../install.html" class="md-nav__link">Installing statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted.html" class="md-nav__link">Getting started</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html" class="md-nav__link">User Guide</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../user-guide.html#background" class="md-nav__link">Background</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#regression-and-linear-models" class="md-nav__link">Regression and Linear Models</a>
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="../regression.html" class="md-nav__link">Linear Regression</a>
</li>
<li class="md-nav__item">
<a href="../glm.html" class="md-nav__link">Generalized Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../gee.html" class="md-nav__link">Generalized Estimating Equations</a>
</li>
<li class="md-nav__item">
<a href="../gam.html" class="md-nav__link">Generalized Additive Models (GAM)</a>
</li>
<li class="md-nav__item">
<a href="../rlm.html" class="md-nav__link">Robust Linear Models</a>
</li>
<li class="md-nav__item">
<a href="../mixed_linear.html" class="md-nav__link">Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../discretemod.html" class="md-nav__link">Regression with Discrete Dependent Variable</a>
</li>
<li class="md-nav__item">
<a href="../mixed_glm.html" class="md-nav__link">Generalized Linear Mixed Effects Models</a>
</li>
<li class="md-nav__item">
<a href="../anova.html" class="md-nav__link">ANOVA</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#time-series-analysis" class="md-nav__link">Time Series Analysis</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#other-models" class="md-nav__link">Other Models</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#statistics-and-tools" class="md-nav__link">Statistics and Tools</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#data-sets" class="md-nav__link">Data Sets</a>
</li>
<li class="md-nav__item">
<a href="../user-guide.html#sandbox" class="md-nav__link">Sandbox</a>
</li></ul>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" class="md-nav__link">Examples</a>
</li>
<li class="md-nav__item">
<a href="../api.html" class="md-nav__link">API Reference</a>
</li>
<li class="md-nav__item">
<a href="../about.html" class="md-nav__link">About statsmodels</a>
</li>
<li class="md-nav__item">
<a href="../dev/index.html" class="md-nav__link">Developer Page</a>
</li>
<li class="md-nav__item">
<a href="../release/index.html" class="md-nav__link">Release Notes</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<ul class="md-nav__list" data-md-scrollfix="">
<li class="md-nav__item"><a class="md-nav__extra_link" href="../_sources/generated/statsmodels.regression.recursive_ls.RecursiveLSResults.states.rst.txt">Show Source</a> </li>
<li id="searchbox" class="md-nav__item"></li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset" role="main">
<h1 id="generated-statsmodels-regression-recursive-ls-recursivelsresults-states--page-root">statsmodels.regression.recursive_ls.RecursiveLSResults.states<a class="headerlink" href="#generated-statsmodels-regression-recursive-ls-recursivelsresults-states--page-root" title="Permalink to this headline">¶</a></h1>
<dl class="py method">
<dt id="statsmodels.regression.recursive_ls.RecursiveLSResults.states">
<em class="property">property </em><code class="sig-prename descclassname">RecursiveLSResults.</code><code class="sig-name descname">states</code><a class="headerlink" href="#statsmodels.regression.recursive_ls.RecursiveLSResults.states" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</article>
</div>
</div>
</main>
</div>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="statsmodels.regression.recursive_ls.RecursiveLSResults.ssr.html" title="statsmodels.regression.recursive_ls.RecursiveLSResults.ssr"
class="md-flex md-footer-nav__link md-footer-nav__link--prev"
rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span
class="md-footer-nav__direction"> Previous </span> statsmodels.regression.recursive_ls.RecursiveLSResults.ssr </span>
</div>
</a>
<a href="statsmodels.regression.recursive_ls.RecursiveLSResults.tvalues.html" title="statsmodels.regression.recursive_ls.RecursiveLSResults.tvalues"
class="md-flex md-footer-nav__link md-footer-nav__link--next"
rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title"><span
class="md-flex__ellipsis"> <span
class="md-footer-nav__direction"> Next </span> statsmodels.regression.recursive_ls.RecursiveLSResults.tvalues </span>
</div>
<div class="md-flex__cell md-flex__cell--shrink"><i
class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
© Copyright 2009-2019, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
</div>
Last updated on
Oct 29, 2020.
<br/>
Created using
<a href="http://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
and
<a href="https://github.com/bashtage/sphinx-material/">Material for
Sphinx</a>
</div>
</div>
</div>
</footer>
<script src="../_static/javascripts/application.js"></script>
<script>app.initialize({version: "1.0.4", url: {base: ".."}})</script>
</body>
</html> | {
"content_hash": "11b256b7b2b32de2d62cfd60537716ab",
"timestamp": "",
"source": "github",
"line_count": 490,
"max_line_length": 999,
"avg_line_length": 37.47142857142857,
"alnum_prop": 0.5974620118729916,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "18cd8366a2a67725af249768e141d7253e0e4797",
"size": "18365",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.12.1/generated/statsmodels.regression.recursive_ls.RecursiveLSResults.states.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
/**
* Proxy connectivity data object if using on box behind a proxy.
*/
export interface ProxyData {
hostname: string;
port: string|number;
}
| {
"content_hash": "fc55865a52ce2543c704ec3ba652c16d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 65,
"avg_line_length": 21.142857142857142,
"alnum_prop": 0.7094594594594594,
"repo_name": "crisboarna/fb-messenger-bot-api",
"id": "16d4649f9b09b2244830f1a56170d898a98ed4a7",
"size": "148",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/interfaces/Connectivity.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "TypeScript",
"bytes": "212116"
}
],
"symlink_target": ""
} |
require 'clockwork'
require "sidekiq"
require 'yaml'
RAILS_ENV = ENV['RAILS_ENV']
if RAILS_ENV.nil?
fail ArgumentError, "clockwork must be started with RAILS_ENV"
end
bitsy_config_yml = File.join(File.dirname(__FILE__), "bitsy.yml")
CONFIG = YAML.load_file(bitsy_config_yml)[RAILS_ENV]
Sidekiq.configure_server do |config|
config.redis = { url: CONFIG['redis_url'] }
end
Sidekiq.configure_client do |config|
config.redis = { url: CONFIG['redis_url'] }
end
module Clockwork
handler do |job|
Sidekiq::Client.push('class' => job, 'args' => [])
end
every(10.minutes, 'Bitsy::TransactionsSyncJob')
every(15.minutes, 'Bitsy::ForwardJob')
every(5.seconds, 'Bitsy::CheckPaymentsJob')
end
| {
"content_hash": "1a31c91fc729ecdf0bbc4d62ddc866ca",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 65,
"avg_line_length": 24.344827586206897,
"alnum_prop": 0.7039660056657224,
"repo_name": "dheeraj510/bitsy",
"id": "adef22a1194201f57add1616a08dc96931628369",
"size": "706",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/generators/bitsy/config/templates/clock.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1366"
},
{
"name": "HTML",
"bytes": "5124"
},
{
"name": "JavaScript",
"bytes": "1198"
},
{
"name": "Ruby",
"bytes": "102358"
}
],
"symlink_target": ""
} |
package applicant.ml.naivebayes
import applicant.nlp.LuceneTokenizer
import applicant.etl.ApplicantData
import org.apache.spark.mllib.feature.{HashingTF, IDFModel}
import org.apache.spark.mllib.linalg.{Vectors, Vector, SparseVector}
object NaiveBayesFeatureGenerator {
val htf = new HashingTF(10000)
val tokenizer = new LuceneTokenizer("english")
/**
* Will return a vector of bucket size counts for the tokens from
* the full body of the resume
*
* @param applicant The data for the current applicant
* @return A Vector of feature counts
*/
def getFeatureVec(tokens: Seq[String]): Vector = {
return htf.transform(tokens)
}
/**
* Will return a vector of bucket size counts for the tokens from
* the full body of the resume that are adjusted by an IDFModel
*
* @param applicant The data for the current applicant
* @return A Vector of feature counts
*/
def getAdjustedFeatureVec(tokens: Seq[String], model: IDFModel): Vector = {
return model.transform(getFeatureVec(tokens))
}
}
| {
"content_hash": "f39250614305d6820aac16a87ea7c43a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 77,
"avg_line_length": 31.636363636363637,
"alnum_prop": 0.7298850574712644,
"repo_name": "dataworks/internship-2016",
"id": "7b14b55308b053bafb3ab3ad04b750a04ce7ca0b",
"size": "1044",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "etl/src/scala/applicant/ml/naivebayes/NaiveBayesFeatureGenerator.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "21718"
},
{
"name": "HTML",
"bytes": "40308"
},
{
"name": "JavaScript",
"bytes": "72758"
},
{
"name": "Scala",
"bytes": "184207"
},
{
"name": "Shell",
"bytes": "10374"
}
],
"symlink_target": ""
} |
package testclient
import (
"fmt"
"sync"
"github.com/emicklei/go-restful/swagger"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/typed/discovery"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/version"
"k8s.io/kubernetes/pkg/watch"
)
// NewSimpleFake returns a client that will respond with the provided objects
func NewSimpleFake(objects ...runtime.Object) *Fake {
o := NewObjects(api.Scheme, api.Codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
fakeClient := &Fake{}
fakeClient.AddReactor("*", "*", ObjectReaction(o, registered.RESTMapper()))
fakeClient.AddWatchReactor("*", DefaultWatchReactor(watch.NewFake(), nil))
return fakeClient
}
// Fake implements client.Interface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the method you want to test easier.
type Fake struct {
sync.RWMutex
actions []Action // these may be castable to other types, but "Action" is the minimum
// ReactionChain is the list of reactors that will be attempted for every request in the order they are tried
ReactionChain []Reactor
// WatchReactionChain is the list of watch reactors that will be attempted for every request in the order they are tried
WatchReactionChain []WatchReactor
// ProxyReactionChain is the list of proxy reactors that will be attempted for every request in the order they are tried
ProxyReactionChain []ProxyReactor
Resources map[string]*unversioned.APIResourceList
}
// Reactor is an interface to allow the composition of reaction functions.
type Reactor interface {
// Handles indicates whether or not this Reactor deals with a given action
Handles(action Action) bool
// React handles the action and returns results. It may choose to delegate by indicated handled=false
React(action Action) (handled bool, ret runtime.Object, err error)
}
// WatchReactor is an interface to allow the composition of watch functions.
type WatchReactor interface {
// Handles indicates whether or not this Reactor deals with a given action
Handles(action Action) bool
// React handles a watch action and returns results. It may choose to delegate by indicated handled=false
React(action Action) (handled bool, ret watch.Interface, err error)
}
// ProxyReactor is an interface to allow the composition of proxy get functions.
type ProxyReactor interface {
// Handles indicates whether or not this Reactor deals with a given action
Handles(action Action) bool
// React handles a watch action and returns results. It may choose to delegate by indicated handled=false
React(action Action) (handled bool, ret restclient.ResponseWrapper, err error)
}
// ReactionFunc is a function that returns an object or error for a given Action. If "handled" is false,
// then the test client will continue ignore the results and continue to the next ReactionFunc
type ReactionFunc func(action Action) (handled bool, ret runtime.Object, err error)
// WatchReactionFunc is a function that returns a watch interface. If "handled" is false,
// then the test client will continue ignore the results and continue to the next ReactionFunc
type WatchReactionFunc func(action Action) (handled bool, ret watch.Interface, err error)
// ProxyReactionFunc is a function that returns a ResponseWrapper interface for a given Action. If "handled" is false,
// then the test client will continue ignore the results and continue to the next ProxyReactionFunc
type ProxyReactionFunc func(action Action) (handled bool, ret restclient.ResponseWrapper, err error)
// AddReactor appends a reactor to the end of the chain
func (c *Fake) AddReactor(verb, resource string, reaction ReactionFunc) {
c.ReactionChain = append(c.ReactionChain, &SimpleReactor{verb, resource, reaction})
}
// PrependReactor adds a reactor to the beginning of the chain
func (c *Fake) PrependReactor(verb, resource string, reaction ReactionFunc) {
c.ReactionChain = append([]Reactor{&SimpleReactor{verb, resource, reaction}}, c.ReactionChain...)
}
// AddWatchReactor appends a reactor to the end of the chain
func (c *Fake) AddWatchReactor(resource string, reaction WatchReactionFunc) {
c.WatchReactionChain = append(c.WatchReactionChain, &SimpleWatchReactor{resource, reaction})
}
// PrependWatchReactor adds a reactor to the beginning of the chain
func (c *Fake) PrependWatchReactor(resource string, reaction WatchReactionFunc) {
c.WatchReactionChain = append([]WatchReactor{&SimpleWatchReactor{resource, reaction}}, c.WatchReactionChain...)
}
// AddProxyReactor appends a reactor to the end of the chain
func (c *Fake) AddProxyReactor(resource string, reaction ProxyReactionFunc) {
c.ProxyReactionChain = append(c.ProxyReactionChain, &SimpleProxyReactor{resource, reaction})
}
// PrependProxyReactor adds a reactor to the beginning of the chain
func (c *Fake) PrependProxyReactor(resource string, reaction ProxyReactionFunc) {
c.ProxyReactionChain = append([]ProxyReactor{&SimpleProxyReactor{resource, reaction}}, c.ProxyReactionChain...)
}
// Invokes records the provided Action and then invokes the ReactFn (if provided).
// defaultReturnObj is expected to be of the same type a normal call would return.
func (c *Fake) Invokes(action Action, defaultReturnObj runtime.Object) (runtime.Object, error) {
c.Lock()
defer c.Unlock()
c.actions = append(c.actions, action)
for _, reactor := range c.ReactionChain {
if !reactor.Handles(action) {
continue
}
handled, ret, err := reactor.React(action)
if !handled {
continue
}
return ret, err
}
return defaultReturnObj, nil
}
// InvokesWatch records the provided Action and then invokes the ReactFn (if provided).
func (c *Fake) InvokesWatch(action Action) (watch.Interface, error) {
c.Lock()
defer c.Unlock()
c.actions = append(c.actions, action)
for _, reactor := range c.WatchReactionChain {
if !reactor.Handles(action) {
continue
}
handled, ret, err := reactor.React(action)
if !handled {
continue
}
return ret, err
}
return nil, fmt.Errorf("unhandled watch: %#v", action)
}
// InvokesProxy records the provided Action and then invokes the ReactFn (if provided).
func (c *Fake) InvokesProxy(action Action) restclient.ResponseWrapper {
c.Lock()
defer c.Unlock()
c.actions = append(c.actions, action)
for _, reactor := range c.ProxyReactionChain {
if !reactor.Handles(action) {
continue
}
handled, ret, err := reactor.React(action)
if !handled || err != nil {
continue
}
return ret
}
return nil
}
// ClearActions clears the history of actions called on the fake client
func (c *Fake) ClearActions() {
c.Lock()
c.Unlock()
c.actions = make([]Action, 0)
}
// Actions returns a chronologically ordered slice fake actions called on the fake client
func (c *Fake) Actions() []Action {
c.RLock()
defer c.RUnlock()
fa := make([]Action, len(c.actions))
copy(fa, c.actions)
return fa
}
func (c *Fake) LimitRanges(namespace string) client.LimitRangeInterface {
return &FakeLimitRanges{Fake: c, Namespace: namespace}
}
func (c *Fake) ResourceQuotas(namespace string) client.ResourceQuotaInterface {
return &FakeResourceQuotas{Fake: c, Namespace: namespace}
}
func (c *Fake) ReplicationControllers(namespace string) client.ReplicationControllerInterface {
return &FakeReplicationControllers{Fake: c, Namespace: namespace}
}
func (c *Fake) Nodes() client.NodeInterface {
return &FakeNodes{Fake: c}
}
func (c *Fake) PodSecurityPolicies() client.PodSecurityPolicyInterface {
return &FakePodSecurityPolicy{Fake: c}
}
func (c *Fake) SecurityContextConstraints() client.SecurityContextConstraintInterface {
return &FakeSecurityContextConstraints{Fake: c}
}
func (c *Fake) Events(namespace string) client.EventInterface {
return &FakeEvents{Fake: c, Namespace: namespace}
}
func (c *Fake) Endpoints(namespace string) client.EndpointsInterface {
return &FakeEndpoints{Fake: c, Namespace: namespace}
}
func (c *Fake) PersistentVolumes() client.PersistentVolumeInterface {
return &FakePersistentVolumes{Fake: c}
}
func (c *Fake) PersistentVolumeClaims(namespace string) client.PersistentVolumeClaimInterface {
return &FakePersistentVolumeClaims{Fake: c, Namespace: namespace}
}
func (c *Fake) Pods(namespace string) client.PodInterface {
return &FakePods{Fake: c, Namespace: namespace}
}
func (c *Fake) PodTemplates(namespace string) client.PodTemplateInterface {
return &FakePodTemplates{Fake: c, Namespace: namespace}
}
func (c *Fake) Services(namespace string) client.ServiceInterface {
return &FakeServices{Fake: c, Namespace: namespace}
}
func (c *Fake) ServiceAccounts(namespace string) client.ServiceAccountsInterface {
return &FakeServiceAccounts{Fake: c, Namespace: namespace}
}
func (c *Fake) Secrets(namespace string) client.SecretsInterface {
return &FakeSecrets{Fake: c, Namespace: namespace}
}
func (c *Fake) Namespaces() client.NamespaceInterface {
return &FakeNamespaces{Fake: c}
}
func (c *Fake) Autoscaling() client.AutoscalingInterface {
return &FakeAutoscaling{c}
}
func (c *Fake) Batch() client.BatchInterface {
return &FakeBatch{c}
}
func (c *Fake) Extensions() client.ExtensionsInterface {
return &FakeExperimental{c}
}
func (c *Fake) Discovery() discovery.DiscoveryInterface {
return &FakeDiscovery{c}
}
func (c *Fake) ComponentStatuses() client.ComponentStatusInterface {
return &FakeComponentStatuses{Fake: c}
}
func (c *Fake) ConfigMaps(namespace string) client.ConfigMapsInterface {
return &FakeConfigMaps{Fake: c, Namespace: namespace}
}
// SwaggerSchema returns an empty swagger.ApiDeclaration for testing
func (c *Fake) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) {
action := ActionImpl{}
action.Verb = "get"
if version == v1.SchemeGroupVersion {
action.Resource = "/swaggerapi/api/" + version.Version
} else {
action.Resource = "/swaggerapi/apis/" + version.Group + "/" + version.Version
}
c.Invokes(action, nil)
return &swagger.ApiDeclaration{}, nil
}
// NewSimpleFakeAutoscaling returns a client that will respond with the provided objects
func NewSimpleFakeAutoscaling(objects ...runtime.Object) *FakeAutoscaling {
return &FakeAutoscaling{Fake: NewSimpleFake(objects...)}
}
type FakeAutoscaling struct {
*Fake
}
func (c *FakeAutoscaling) HorizontalPodAutoscalers(namespace string) client.HorizontalPodAutoscalerInterface {
return &FakeHorizontalPodAutoscalersV1{Fake: c, Namespace: namespace}
}
// NewSimpleFakeBatch returns a client that will respond with the provided objects
func NewSimpleFakeBatch(objects ...runtime.Object) *FakeBatch {
return &FakeBatch{Fake: NewSimpleFake(objects...)}
}
type FakeBatch struct {
*Fake
}
func (c *FakeBatch) Jobs(namespace string) client.JobInterface {
return &FakeJobsV1{Fake: c, Namespace: namespace}
}
// NewSimpleFakeExp returns a client that will respond with the provided objects
func NewSimpleFakeExp(objects ...runtime.Object) *FakeExperimental {
return &FakeExperimental{Fake: NewSimpleFake(objects...)}
}
type FakeExperimental struct {
*Fake
}
func (c *FakeExperimental) DaemonSets(namespace string) client.DaemonSetInterface {
return &FakeDaemonSets{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) HorizontalPodAutoscalers(namespace string) client.HorizontalPodAutoscalerInterface {
return &FakeHorizontalPodAutoscalers{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) Deployments(namespace string) client.DeploymentInterface {
return &FakeDeployments{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) Scales(namespace string) client.ScaleInterface {
return &FakeScales{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) Jobs(namespace string) client.JobInterface {
return &FakeJobs{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) Ingress(namespace string) client.IngressInterface {
return &FakeIngress{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) ThirdPartyResources(namespace string) client.ThirdPartyResourceInterface {
return &FakeThirdPartyResources{Fake: c, Namespace: namespace}
}
func (c *FakeExperimental) ReplicaSets(namespace string) client.ReplicaSetInterface {
return &FakeReplicaSets{Fake: c, Namespace: namespace}
}
type FakeDiscovery struct {
*Fake
}
func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*unversioned.APIResourceList, error) {
action := ActionImpl{
Verb: "get",
Resource: "resource",
}
c.Invokes(action, nil)
return c.Resources[groupVersion], nil
}
func (c *FakeDiscovery) ServerResources() (map[string]*unversioned.APIResourceList, error) {
action := ActionImpl{
Verb: "get",
Resource: "resource",
}
c.Invokes(action, nil)
return c.Resources, nil
}
func (c *FakeDiscovery) ServerGroups() (*unversioned.APIGroupList, error) {
return nil, nil
}
func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
action := ActionImpl{}
action.Verb = "get"
action.Resource = "version"
c.Invokes(action, nil)
versionInfo := version.Get()
return &versionInfo, nil
}
| {
"content_hash": "613235fdfe0d4a889f82bbd39e9cb5cd",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 121,
"avg_line_length": 32.520782396088016,
"alnum_prop": 0.7637771596120593,
"repo_name": "spinolacastro/origin",
"id": "5f4485b45fa8c8806d77b46de4e485b1ab395f3b",
"size": "13890",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "Godeps/_workspace/src/k8s.io/kubernetes/pkg/client/unversioned/testclient/testclient.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "58459"
},
{
"name": "DIGITAL Command Language",
"bytes": "117"
},
{
"name": "Go",
"bytes": "19290500"
},
{
"name": "Groff",
"bytes": "2046"
},
{
"name": "HTML",
"bytes": "127433"
},
{
"name": "JavaScript",
"bytes": "294523"
},
{
"name": "Makefile",
"bytes": "3298"
},
{
"name": "Python",
"bytes": "12108"
},
{
"name": "Ruby",
"bytes": "121"
},
{
"name": "Shell",
"bytes": "363852"
}
],
"symlink_target": ""
} |
package com.blackstone.goldenquran.models.models;
/**
* Created by Abdullah on 5/31/2017.
*/
public class ChangePageEvent {
private int pageNumber;
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public int getPageNumber() {
return pageNumber;
}
public ChangePageEvent(int pageNumber) {
this.pageNumber = pageNumber;
}
}
| {
"content_hash": "6628ed496446f74a261a481e0ce99fac",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 49,
"avg_line_length": 17.82608695652174,
"alnum_prop": 0.6609756097560976,
"repo_name": "salemoh/GoldenQuranAndroid",
"id": "9bc605b444e237bbc5ebb2d0f8ee0fe55e288365",
"size": "410",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/blackstone/goldenquran/models/models/ChangePageEvent.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "392801"
}
],
"symlink_target": ""
} |
package scouter.client.xlog.dialog;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import scouter.client.Images;
import scouter.client.model.XLogData;
import scouter.client.sorter.ColumnLabelSorter;
import scouter.util.DateUtil;
import scouter.util.FormatUtil;
import scouter.util.LongKeyLinkedMap;
import au.com.bytecode.opencsv.CSVWriter;
public abstract class XLogSummaryAbstractDialog {
Display display;
Shell dialog;
protected LongKeyLinkedMap<XLogData> dataMap;
protected Label rangeLabel;
long stime, etime;
protected TableViewer viewer;
TableColumnLayout tableColumnLayout;
private Clipboard clipboard;
public XLogSummaryAbstractDialog(Display display, LongKeyLinkedMap<XLogData> dataMap) {
this.display = display;
this.dataMap = dataMap;
}
public void setRange(long stime, long etime) {
this.stime = stime;
this.etime = etime;
}
public void show() {
dialog = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
dialog.setText(getTitle());
createDialogArea();
clipboard = new Clipboard(null);
dialog.pack();
dialog.open();
}
abstract public String getTitle();
private void copyToClipboard(TableItem[] items) {
if (viewer != null) {
int colCnt = viewer.getTable().getColumnCount();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < colCnt; i++) {
TableColumn column = viewer.getTable().getColumn(i);
sb.append(column.getText());
if (i == colCnt - 1) {
sb.append("\n");
} else {
sb.append("\t");
}
}
if (items != null && items.length > 0) {
for (TableItem item : items) {
for (int i = 0; i < colCnt; i++) {
sb.append(item.getText(i));
if (i == colCnt - 1) {
sb.append("\n");
} else {
sb.append("\t");
}
}
}
clipboard.setContents(new Object[] {sb.toString()}, new Transfer[] {TextTransfer.getInstance()});
MessageDialog.openInformation(dialog, "Copy", "Copied to clipboard");
}
}
}
protected void createDialogArea() {
dialog.setLayout(new GridLayout(1, true));
Composite upperComp = new Composite(dialog, SWT.NONE);
upperComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
upperComp.setLayout(new GridLayout(2, true));
rangeLabel = new Label(upperComp, SWT.NONE);
rangeLabel.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
Composite btnComp = new Composite(upperComp, SWT.NONE);
btnComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false));
btnComp.setLayout(new RowLayout());
Button copyBtn = new Button(btnComp, SWT.PUSH);
copyBtn.setText("Copy All");
copyBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
copyToClipboard(viewer.getTable().getItems());
}
});
Button exportBtn = new Button(btnComp, SWT.PUSH);
exportBtn.setText("CSV");
exportBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(display.getActiveShell(), SWT.SAVE);
dialog.setOverwrite(true);
String filename = "[" + DateUtil.format(stime, "yyyyMMdd_HHmmss") + "-"
+ DateUtil.format(etime, "HHmmss") + "]" +getTitle().replaceAll(" ", "_") + ".csv";
dialog.setFileName(filename);
dialog.setFilterExtensions(new String[] { "*.csv", "*.*" });
dialog.setFilterNames(new String[] { "CSV File(*.csv)", "All Files" });
String fileSelected = dialog.open();
if (fileSelected != null) {
CSVWriter cw = null;
try {
cw = new CSVWriter(new FileWriter(fileSelected));
int colCnt = viewer.getTable().getColumnCount();
List<String> list = new ArrayList<String>();
for (int i = 0; i < colCnt; i++) {
TableColumn column = viewer.getTable().getColumn(i);
list.add(column.getText());
}
cw.writeNext(list.toArray(new String[list.size()]));
cw.flush();
TableItem[] items = viewer.getTable().getItems();
if (items != null && items.length > 0) {
for (TableItem item : items) {
list.clear();
for (int i = 0; i < colCnt; i++) {
list.add(item.getText(i));
}
cw.writeNext(list.toArray(new String[list.size()]));
cw.flush();
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
if (cw != null) {
cw.close();
}
} catch (Throwable th) {}
}
}
}
});
Composite tableComp = new Composite(dialog, SWT.NONE);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 800;
gd.heightHint = 400;
tableComp.setLayoutData(gd);
tableColumnLayout = new TableColumnLayout();
tableComp.setLayout(tableColumnLayout);
viewer = new TableViewer(tableComp, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
createColumns();
final Table table = viewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(true);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setComparator(new ColumnLabelSorter(viewer));
table.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if(e.stateMask == SWT.CTRL || e.stateMask == SWT.COMMAND){
switch(e.keyCode) {
case 'c':
case 'C':
TableItem[] items = table.getSelection();
if (items == null || items.length < 1) {
return;
}
copyToClipboard(items);
break;
case 'a':
case 'A':
table.selectAll();
break;
}
}
}
});
createTableContextMenu();
calcAsync();
}
private void createTableContextMenu() {
MenuManager manager = new MenuManager();
viewer.getControl().setMenu(manager.createContextMenu(viewer.getControl()));
manager.add(new Action("&Copy", ImageDescriptor.createFromImage(Images.copy)) {
public void run() {
TableItem[] items = viewer.getTable().getSelection();
if (items == null || items.length < 1) {
return;
}
copyToClipboard(items);
}
});
}
protected abstract void calcAsync();
protected abstract void createMainColumn();
private void createColumns() {
createMainColumn();
for (SummaryColumnEnum column : SummaryColumnEnum.values()) {
TableViewerColumn c = createTableViewerColumn(column.getTitle(), column.getWidth(), column.getAlignment(), column.isNumber());
ColumnLabelProvider labelProvider = null;
switch (column) {
case COUNT:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).count, "#,##0");
}
return null;
}
};
break;
case ERROR:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).error, "#,##0");
}
return null;
}
};
break;
case TOTAL_ELAPSED:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).sumTime, "#,##0");
}
return null;
}
};
break;
case AVG_ELAPSED:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).sumTime / (double) ((SummaryObject) element).count, "#,##0");
}
return null;
}
};
break;
case TOTAL_CPU:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).cpu, "#,##0");
}
return null;
}
};
break;
case AVG_CPU:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).cpu / (double) ((SummaryObject) element).count, "#,##0");
}
return null;
}
};
break;
case TOTAL_MEMORY:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).memory, "#,##0");
}
return null;
}
};
break;
case AVG_MEMORY:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).memory / (double) ((SummaryObject) element).count, "#,##0");
}
return null;
}
};
break;
case TOTAL_SQLTIME:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).sqltime, "#,##0");
}
return null;
}
};
break;
case AVG_SQLTIME:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).sqltime / (double) ((SummaryObject) element).count, "#,##0");
}
return null;
}
};
break;
case TOTAL_APICALLTIME:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).apicalltime, "#,##0");
}
return null;
}
};
break;
case AVG_APICALLTIME:
labelProvider = new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof SummaryObject) {
return FormatUtil.print(((SummaryObject) element).apicalltime / (double) ((SummaryObject) element).count, "#,##0");
}
return null;
}
};
break;
}
if (labelProvider != null) {
c.setLabelProvider(labelProvider);
}
}
}
protected TableViewerColumn createTableViewerColumn(String title, int width, int alignment, final boolean isNumber) {
final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
final TableColumn column = viewerColumn.getColumn();
column.setText(title);
column.setAlignment(alignment);
column.setMoveable(true);
tableColumnLayout.setColumnData(column, new ColumnPixelData(width, true));
column.setData("isNumber", isNumber);
column.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ColumnLabelSorter sorter = (ColumnLabelSorter) viewer.getComparator();
TableColumn selectedColumn = (TableColumn) e.widget;
sorter.setColumn(selectedColumn);
}
});
return viewerColumn;
}
enum SummaryColumnEnum {
COUNT("Count", 100, SWT.RIGHT, true, true, true),
ERROR("Error", 80, SWT.RIGHT, true, true, true),
TOTAL_ELAPSED("Total Elapsed(ms)", 150, SWT.RIGHT, true, true, true),
AVG_ELAPSED("Avg Elapsed(ms)", 150, SWT.RIGHT, true, true, true),
TOTAL_CPU("Total Cpu(ms)", 100, SWT.RIGHT, true, true, true),
AVG_CPU("Avg Cpu(ms)", 100, SWT.RIGHT, true, true, true),
TOTAL_MEMORY("Total Mem(KBytes)", 150, SWT.RIGHT, true, true, true),
AVG_MEMORY("Avg Mem(KBytes)", 150, SWT.RIGHT, true, true, true),
TOTAL_SQLTIME("Total SQL Time(ms)", 150, SWT.RIGHT, true, true, true),
AVG_SQLTIME("Avg SQL Time(ms)", 150, SWT.RIGHT, true, true, true),
TOTAL_APICALLTIME("Total APICall Time(ms)", 150, SWT.RIGHT, true, true, true),
AVG_APICALLTIME("Avg APICall Time(ms)", 150, SWT.RIGHT, true, true, true);
private final String title;
private final int weight;
private final int alignment;
private final boolean resizable;
private final boolean moveable;
private final boolean isNumber;
private SummaryColumnEnum(String text, int width, int alignment, boolean resizable, boolean moveable, boolean isNumber) {
this.title = text;
this.weight = width;
this.alignment = alignment;
this.resizable = resizable;
this.moveable = moveable;
this.isNumber = isNumber;
}
public String getTitle(){
return title;
}
public int getAlignment(){
return alignment;
}
public boolean isResizable(){
return resizable;
}
public boolean isMoveable(){
return moveable;
}
public int getWidth() {
return weight;
}
public boolean isNumber() {
return this.isNumber;
}
}
protected abstract static class SummaryObject {
int count;
long sumTime;
int error;
long maxTime;
long cpu;
long memory;
long sqltime;
long apicalltime;
}
}
| {
"content_hash": "5b99eee592b912a4e52e77ca2817fae5",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 129,
"avg_line_length": 32.02242152466368,
"alnum_prop": 0.667273491107688,
"repo_name": "yuyupapa/OpenSource",
"id": "1573947409914597082a6c15c6491e141bba906e",
"size": "14959",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "scouter.client/src/scouter/client/xlog/dialog/XLogSummaryAbstractDialog.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "71892"
},
{
"name": "CSS",
"bytes": "26064"
},
{
"name": "Groff",
"bytes": "8383"
},
{
"name": "HTML",
"bytes": "3089620"
},
{
"name": "Java",
"bytes": "29561111"
},
{
"name": "JavaScript",
"bytes": "128607"
},
{
"name": "NSIS",
"bytes": "41068"
},
{
"name": "Scala",
"bytes": "722545"
},
{
"name": "Shell",
"bytes": "90291"
},
{
"name": "XSLT",
"bytes": "105761"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FileHashTask - - Phing User Guide</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
<link rel="home" href="index.html" title="Phing User Guide" />
<link rel="up" href="app.optionaltasks.html" title="Optional tasks" />
<link rel="prev" href="apcs08s01.html" title="Example" />
<link rel="next" href="apcs09s01.html" title="Example" />
<meta name="Section-title" content="FileHashTask" /><script type="text/javascript">
//The id for tree cookie
var treeCookieId = "treeview-43379";
var language = "en";
var w = new Object();
//Localization
txt_filesfound = 'Results';
txt_enter_at_least_1_char = "You must enter at least one character.";
txt_browser_not_supported = "JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.";
txt_please_wait = "Please wait. Search in progress...";
txt_results_for = "Results for: ";
</script><link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="common/css/positioning.css" />
<link rel="stylesheet" type="text/css" href="common/jquery/theme-redmond/jquery-ui-1.8.2.custom.css" />
<link rel="stylesheet" type="text/css" href="common/jquery/treeview/jquery.treeview.css" /><style type="text/css">
#noscript{
font-weight:bold;
background-color: #55AA55;
font-weight: bold;
height: 25spx;
z-index: 3000;
top:0px;
width:100%;
position: relative;
border-bottom: solid 5px black;
text-align:center;
color: white;
}
input {
margin-bottom: 5px;
margin-top: 2px;
}
.folder {
display: block;
height: 22px;
padding-left: 20px;
background: transparent url(common/jquery/treeview/images/folder.gif) 0 0px no-repeat;
}
span.contentsTab {
padding-left: 20px;
background: url(common/images/toc-icon.png) no-repeat 0 center;
}
span.searchTab {
padding-left: 20px;
background: url(common/images/search-icon.png) no-repeat 0 center;
}
/* Overide jquery treeview's defaults for ul. */
.treeview ul {
background-color: transparent;
margin-top: 4px;
}
#webhelp-currentid {
background-color: #D8D8D8 !important;
}
.treeview .hover { color: black; }
.filetree li span a { text-decoration: none; font-size: 12px; color: #517291; }
/* Override jquery-ui's default css customizations. These are supposed to take precedence over those.*/
.ui-widget-content {
border: 0px;
background: none;
color: none;
}
.ui-widget-header {
color: #e9e8e9;
border-left: 1px solid #e5e5e5;
border-right: 1px solid #e5e5e5;
border-bottom: 1px solid #bbc4c5;
border-top: 4px solid #e5e5e5;
border: medium none;
background: #F4F4F4; /* old browsers */
background: -moz-linear-gradient(top, #F4F4F4 0%, #E6E4E5 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F4F4F4), color-stop(100%,#E6E4E5)); /* webkit */
font-weight: none;
}
.ui-widget-header a { color: none; }
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
border: none; background: none; font-weight: none; color: none; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: black; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: none; background: none; font-weight: none; color: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: none; background: none; font-weight: none; color: none; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {
color: black; text-decoration: none;
background: #C6C6C6; /* old browsers */
background: -moz-linear-gradient(top, #C6C6C6 0%, #D8D8D8 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C6C6C6), color-stop(100%,#D8D8D8)); /* webkit */
-webkit-border-radius:15px; -moz-border-radius:10px;
border: 1px solid #f1f1f1;
}
.ui-corner-all { border-radius: 0 0 0 0; }
.ui-tabs { padding: .2em;}
.ui-tabs .ui-tabs-nav li { top: 0px; margin: -2px 0 1px; text-transform: uppercase; font-size: 10.5px;}
.ui-tabs .ui-tabs-nav li a { padding: .25em 2em .25em 1em; margin: .5em; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
/**
* Basic Layout Theme
*
* This theme uses the default layout class-names for all classes
* Add any 'custom class-names', from options: paneClass, resizerClass, togglerClass
*/
.ui-layout-pane { /* all 'panes' */
background: #FFF;
border: 1px solid #BBB;
padding: 05x;
overflow: auto;
}
.ui-layout-resizer { /* all 'resizer-bars' */
background: #DDD;
top:100px
}
.ui-layout-toggler { /* all 'toggler-buttons' */
background: #AAA;
}
</style>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="../common/css/ie.css"/>
<![endif]--><script type="text/javascript" src="common/browserDetect.js">
<!----></script><script type="text/javascript" src="common/jquery/jquery-1.7.2.min.js">
<!----></script><script type="text/javascript" src="common/jquery/jquery.ui.all.js">
<!----></script><script type="text/javascript" src="common/jquery/jquery.cookie.js">
<!----></script><script type="text/javascript" src="common/jquery/treeview/jquery.treeview.min.js">
<!----></script><script type="text/javascript" src="common/jquery/layout/jquery.layout.js">
<!----></script><script type="text/javascript" src="search/l10n.js">
<!----></script><script type="text/javascript" src="search/htmlFileInfoList.js">
<!----></script><script type="text/javascript" src="search/nwSearchFnt.js">
<!----></script><script type="text/javascript" src="search/stemmers/en_stemmer.js">
<!--//make this scalable to other languages as well.--></script><script type="text/javascript" src="search/index-1.js">
<!----></script><script type="text/javascript" src="search/index-2.js">
<!----></script><script type="text/javascript" src="search/index-3.js">
<!----></script></head>
<body>
<noscript>
<div id="noscript">JavaScript is disabled on your browser. Please enable JavaScript to enjoy all the features of this site.</div>
</noscript>
<div id="header"><a href="index.html"><img style="margin-right: 2px; height: 59px; padding-right: 25px; padding-top: 8px" align="right" src="common/images/logo.png" alt="DocBook Documentation" /></a><h1>Phing User Guide<br />Optional tasks
</h1>
<div id="navheader">
<!---->
<table class="navLinks">
<tr>
<td><a id="showHideButton" href="#" onclick="myLayout.toggle('west')" class="pointLeft" tabindex="5" title="Hide TOC tree">Sidebar
</a></td>
<td><a accesskey="p" class="navLinkPrevious" tabindex="5" href="apcs08s01.html">Prev</a>
|
<a accesskey="u" class="navLinkUp" tabindex="5" href="app.optionaltasks.html">Up</a>
|
<a accesskey="n" class="navLinkNext" tabindex="5" href="apcs09s01.html">Next</a></td>
</tr>
</table>
</div>
</div>
<div id="content">
<!---->
<div class="sect1">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a id="FileHashTask"></a>FileHashTask
</h2>
</div>
</div>
</div>
<div class="toc">
<dl class="toc">
<dt><span class="sect2"><a href="apcs09s01.html">Example</a></span></dt>
</dl>
</div>
<p>Calculates either MD5 or SHA1 hash value of a file and stores the value as a hex
string in a property.
</p>
<div class="table"><a id="d5e5680"></a><p class="title"><strong>Table 72. Attributes</strong></p>
<div class="table-contents">
<table summary="Attributes" border="1">
<colgroup>
<col class="name" />
<col class="type" />
<col class="description" />
<col class="default" />
<col class="required" />
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
<th>Required</th>
</tr>
</thead>
<tbody>
<tr>
<td><code class="literal">file</code></td>
<td><code class="literal">String</code></td>
<td>Filename</td>
<td>n/a</td>
<td>Yes</td>
</tr>
<tr>
<td><code class="literal">hashtype</code></td>
<td><code class="literal">Integer</code></td>
<td>Specifies what hash algorithm to use. 0=MD5, 1=SHA1</td>
<td>0</td>
<td>No</td>
</tr>
<tr>
<td><code class="literal">propertyname</code></td>
<td><code class="literal">String</code></td>
<td>Name of property where the hash value is stored</td>
<td>filehashvalue</td>
<td>No</td>
</tr>
</tbody>
</table>
</div>
</div><br class="table-break" />
</div><script type="text/javascript" src="common/main.js">
<!----></script><script type="text/javascript" src="common/splitterInit.js">
<!----></script><div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="apcs08s01.html">Prev</a>
</td>
<td width="20%" align="center"><a accesskey="u" href="app.optionaltasks.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="apcs09s01.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top"> </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> </td>
</tr>
</table>
</div>
</div>
<div id="sidebar">
<div id="leftnavigation" style="padding-top:3px;">
<div id="tabs">
<ul>
<li><a href="#treeDiv" style="outline:0;" tabindex="1"><span class="contentsTab">Contents</span></a></li>
<li><a href="#searchDiv" style="outline:0;" tabindex="1" onclick="doSearch()"><span class="searchTab">Search</span></a></li>
</ul>
<div id="treeDiv"><img src="common/images/loading.gif" alt="loading table of contents..." id="tocLoading" style="display:block;" /><div id="ulTreeDiv" style="display:none">
<ul id="tree" class="filetree">
<li><span class="file"><a href="pr01.html" tabindex="1">Preface</a></span></li>
<li><span class="file"><a href="ch.about.html" tabindex="1">About this book</a></span><ul>
<li><span class="file"><a href="ch01s01.html" tabindex="1">Authors</a></span></li>
<li><span class="file"><a href="ch01s02.html" tabindex="1">Copyright</a></span></li>
<li><span class="file"><a href="ch01s03.html" tabindex="1">License</a></span></li>
<li><span class="file"><a href="ch01s04.html" tabindex="1">DocBook</a></span><ul>
<li><span class="file"><a href="ch01s04s01.html" tabindex="1">Building the documentation</a></span></li>
<li><span class="file"><a href="ch01s04s02.html" tabindex="1">Template for new tasks</a></span></li>
<li><span class="file"><a href="ch01s04s03.html" tabindex="1">Customization of the look & feel of the rendered outputs</a></span></li>
<li><span class="file"><a href="sec.docbookelements.html" tabindex="1">DocBook v5 elements used in the manual and their
meaning</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="ch.introduction.html" tabindex="1">Introduction</a></span><ul>
<li><span class="file"><a href="ch02s01.html" tabindex="1">What Phing Is</a></span></li>
<li><span class="file"><a href="ch02s02.html" tabindex="1">Phing & Binarycloud: History</a></span></li>
<li><span class="file"><a href="ch02s03.html" tabindex="1">How Phing Works</a></span></li>
<li><span class="file"><a href="ch02s04.html" tabindex="1">Cool, so how can I help?</a></span><ul>
<li><span class="file"><a href="ch02s04s01.html" tabindex="1"> Participating in the development </a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="ch.settingup.html" tabindex="1">Setting-up Phing</a></span><ul>
<li><span class="file"><a href="ch03s01.html" tabindex="1"> System Requirements </a></span><ul>
<li><span class="file"><a href="ch03s01s01.html" tabindex="1"> Operating Systems </a></span></li>
<li><span class="file"><a href="ch03s01s02.html" tabindex="1"> Software Dependencies </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch03s02.html" tabindex="1"> Obtaining Phing </a></span><ul>
<li><span class="file"><a href="ch03s02s01.html" tabindex="1"> Distribution Files </a></span></li>
<li><span class="file"><a href="ch03s02s02.html" tabindex="1">Getting the latest source from Phing Git repository</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch03s03.html" tabindex="1"> PEAR Install </a></span></li>
<li><span class="file"><a href="ch03s04.html" tabindex="1"> Non-PEAR Install </a></span><ul>
<li><span class="file"><a href="ch03s04s01.html" tabindex="1"> Unix </a></span></li>
<li><span class="file"><a href="ch03s04s02.html" tabindex="1"> Windows </a></span></li>
<li><span class="file"><a href="ch03s04s03.html" tabindex="1">Advanced</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch03s05.html" tabindex="1"> Calling Phing </a></span><ul>
<li><span class="file"><a href="ch03s05s01.html" tabindex="1"> Command Line </a></span></li>
<li><span class="file"><a href="ch03s05s02.html" tabindex="1">Supported command line arguments</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="ch.gettingstarted.html" tabindex="1">Getting started</a></span><ul>
<li><span class="file"><a href="ch04s01.html" tabindex="1"> XML And Phing </a></span></li>
<li><span class="file"><a href="ch04s02.html" tabindex="1"> Writing A Simple Buildfile </a></span><ul>
<li><span class="file"><a href="ch04s02s01.html" tabindex="1"> Project Element </a></span></li>
<li><span class="file"><a href="ch04s02s02.html" tabindex="1"> Target Element </a></span><ul>
<li><span class="file"><a href="ch04s02s02s01.html" tabindex="1">Target attributes</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch04s02s03.html" tabindex="1"> Task Elements </a></span></li>
<li><span class="file"><a href="ch04s02s04.html" tabindex="1"> Property Element </a></span><ul>
<li><span class="file"><a href="ch04s02s04s01.html" tabindex="1">Built-in Properties</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="ch04s03.html" tabindex="1"> More Complex Buildfile </a></span><ul>
<li><span class="file"><a href="ch04s03s01.html" tabindex="1">Handling source dependencies</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch04s04.html" tabindex="1"> Relax NG Grammar </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch.projcomponents.html" tabindex="1">Project components</a></span><ul>
<li><span class="file"><a href="ch05s01.html" tabindex="1"> Projects </a></span></li>
<li><span class="file"><a href="ch05s02.html" tabindex="1"> Version </a></span></li>
<li><span class="file"><a href="ch05s03.html" tabindex="1"> Project Components in General </a></span></li>
<li><span class="file"><a href="ch05s04.html" tabindex="1"> Targets </a></span></li>
<li><span class="file"><a href="ch05s05.html" tabindex="1"> Tasks </a></span></li>
<li><span class="file"><a href="sec.types.html" tabindex="1"> Types </a></span><ul>
<li><span class="file"><a href="ch05s06s01.html" tabindex="1"> Basics </a></span></li>
<li><span class="file"><a href="ch05s06s02.html" tabindex="1"> Referencing Types </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch05s07.html" tabindex="1"> Basic Types </a></span><ul>
<li><span class="file"><a href="ch05s07s01.html" tabindex="1">
FileSet
</a></span></li>
<li><span class="file"><a href="ch05s07s02.html" tabindex="1">
FileList
</a></span></li>
<li><span class="file"><a href="ch05s07s03.html" tabindex="1">
FilterChains and Filters </a></span></li>
<li><span class="file"><a href="ch05s07s04.html" tabindex="1"> File Mappers </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch05s08.html" tabindex="1"> Conditions </a></span><ul>
<li><span class="file"><a href="ch05s08s01.html" tabindex="1">not</a></span></li>
<li><span class="file"><a href="ch05s08s02.html" tabindex="1">and</a></span></li>
<li><span class="file"><a href="ch05s08s03.html" tabindex="1">or</a></span></li>
<li><span class="file"><a href="ch05s08s04.html" tabindex="1">os</a></span></li>
<li><span class="file"><a href="ch05s08s05.html" tabindex="1">equals</a></span></li>
<li><span class="file"><a href="ch05s08s06.html" tabindex="1">isset</a></span></li>
<li><span class="file"><a href="ch05s08s07.html" tabindex="1">contains</a></span></li>
<li><span class="file"><a href="ch05s08s08.html" tabindex="1">istrue</a></span></li>
<li><span class="file"><a href="ch05s08s09.html" tabindex="1">isfalse</a></span></li>
<li><span class="file"><a href="ch05s08s10.html" tabindex="1">referenceexists</a></span></li>
<li><span class="file"><a href="ch05s08s11.html" tabindex="1">available</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="ch.extending.html" tabindex="1">Extending Phing</a></span><ul>
<li><span class="file"><a href="ch06s01.html" tabindex="1"> Extension Possibilities </a></span><ul>
<li><span class="file"><a href="sect.ext.tasks.html" tabindex="1"> Tasks </a></span></li>
<li><span class="file"><a href="sect.ext.types.html" tabindex="1"> Types </a></span></li>
<li><span class="file"><a href="sect.ext.mappers.html" tabindex="1"> Mappers </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch06s02.html" tabindex="1"> Source Layout </a></span><ul>
<li><span class="file"><a href="ch06s02s01.html" tabindex="1"> Files And Directories </a></span></li>
<li><span class="file"><a href="ch06s02s02.html" tabindex="1"> File Naming Conventions </a></span></li>
<li><span class="file"><a href="ch06s02s03.html" tabindex="1"> Coding Standards </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch06s03.html" tabindex="1"> System Initialization </a></span><ul>
<li><span class="file"><a href="ch06s03s01.html" tabindex="1"> Wrapper Scripts </a></span></li>
<li><span class="file"><a href="ch06s03s02.html" tabindex="1"> The Main Application (phing.php) </a></span></li>
<li><span class="file"><a href="ch06s03s03.html" tabindex="1"> The Phing Class </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch06s04.html" tabindex="1"> System Services </a></span><ul>
<li><span class="file"><a href="ch06s04s01.html" tabindex="1"> The Exception system </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch06s05.html" tabindex="1"> Build Lifecycle </a></span><ul>
<li><span class="file"><a href="ch06s05s01.html" tabindex="1"> How Phing Parses Buildfiles </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch06s06.html" tabindex="1"> Writing Tasks </a></span><ul>
<li><span class="file"><a href="ch06s06s01.html" tabindex="1"> Creating A Task </a></span></li>
<li><span class="file"><a href="ch06s06s02.html" tabindex="1"> Using the Task </a></span></li>
<li><span class="file"><a href="ch06s06s03.html" tabindex="1">Source Discussion </a></span></li>
<li><span class="file"><a href="ch06s06s04.html" tabindex="1">Task Structure </a></span></li>
<li><span class="file"><a href="ch06s06s05.html" tabindex="1">Includes </a></span></li>
<li><span class="file"><a href="ch06s06s06.html" tabindex="1"> Class Declaration </a></span></li>
<li><span class="file"><a href="ch06s06s07.html" tabindex="1"> Class Properties </a></span></li>
<li><span class="file"><a href="ch06s06s08.html" tabindex="1"> The Constructor </a></span></li>
<li><span class="file"><a href="ch06s06s09.html" tabindex="1"> Setter Methods </a></span></li>
<li><span class="file"><a href="ch06s06s10.html" tabindex="1"> Creator Methods </a></span></li>
<li><span class="file"><a href="ch06s06s11.html" tabindex="1">
init() Method </a></span></li>
<li><span class="file"><a href="ch06s06s12.html" tabindex="1">
main() Method </a></span></li>
<li><span class="file"><a href="ch06s06s13.html" tabindex="1"> Arbitrary Methods </a></span></li>
</ul>
</li>
<li><span class="file"><a href="ch06s07.html" tabindex="1"> Writing Types </a></span><ul>
<li><span class="file"><a href="ch06s07s01.html" tabindex="1">Creating a DataType</a></span></li>
<li><span class="file"><a href="ch06s07s02.html" tabindex="1"> Using the DataType </a></span></li>
<li><span class="file"><a href="ch06s07s03.html" tabindex="1"> Source Discussion </a></span><ul>
<li><span class="file"><a href="ch06s07s03s01.html" tabindex="1">Getters & Setters</a></span></li>
<li><span class="file"><a href="ch06s07s03s02.html" tabindex="1">The getRef() Method</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="ch06s08.html" tabindex="1"> Writing Mappers </a></span><ul>
<li><span class="file"><a href="ch06s08s01.html" tabindex="1"> Creating a Mapper </a></span></li>
<li><span class="file"><a href="ch06s08s02.html" tabindex="1"> Using the Mapper </a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.factsheet.html" tabindex="1">Fact Sheet</a></span><ul>
<li><span class="file"><a href="sec.builtinprops.html" tabindex="1">Built-In Properties</a></span></li>
<li><span class="file"><a href="sec.commandlineargs.html" tabindex="1"> Command Line Arguments </a></span></li>
<li><span class="file"><a href="apas03.html" tabindex="1"> Distribution File Layout </a></span></li>
<li><span class="file"><a href="sec.exitcodes.html" tabindex="1">Program Exit Codes</a></span></li>
<li><span class="file"><a href="sec.lgpl.html" tabindex="1">The LGPL License</a></span></li>
<li><span class="file"><a href="sec.gfdl.html" tabindex="1">The GFDL License</a></span></li>
</ul>
</li>
<li><span class="file"><a href="app.coretasks.html" tabindex="1">Core tasks</a></span><ul>
<li><span class="file"><a href="AdhocTaskdefTask.html" tabindex="1">AdhocTaskdefTask </a></span><ul>
<li><span class="file"><a href="apbs01s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="AdhocTypedefTask.html" tabindex="1">AdhocTypedefTask </a></span><ul>
<li><span class="file"><a href="apbs02s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="AppendTask.html" tabindex="1">AppendTask </a></span><ul>
<li><span class="file"><a href="apbs03s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs03s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ApplyTask.html" tabindex="1">ApplyTask </a></span><ul>
<li><span class="file"><a href="apbs04s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs04s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="AvailableTask.html" tabindex="1">AvailableTask </a></span><ul>
<li><span class="file"><a href="apbs05s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ChmodTask.html" tabindex="1">ChmodTask </a></span><ul>
<li><span class="file"><a href="apbs06s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs06s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ChownTask.html" tabindex="1">ChownTask </a></span><ul>
<li><span class="file"><a href="apbs07s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs07s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ConditionTask.html" tabindex="1">ConditionTask </a></span><ul>
<li><span class="file"><a href="apbs08s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs08s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CopyTask.html" tabindex="1">CopyTask </a></span><ul>
<li><span class="file"><a href="apbs09s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs09s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CvsTask.html" tabindex="1">CvsTask </a></span><ul>
<li><span class="file"><a href="apbs10s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CvsPassTask.html" tabindex="1">CvsPassTask </a></span><ul>
<li><span class="file"><a href="apbs11s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="DeleteTask.html" tabindex="1"> DeleteTask </a></span><ul>
<li><span class="file"><a href="apbs12s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs12s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="EchoTask.html" tabindex="1">EchoTask </a></span><ul>
<li><span class="file"><a href="apbs13s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs13s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ExecTask.html" tabindex="1">ExecTask </a></span><ul>
<li><span class="file"><a href="apbs14s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs14s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="FailTask.html" tabindex="1">FailTask </a></span><ul>
<li><span class="file"><a href="apbs15s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ForeachTask.html" tabindex="1">ForeachTask </a></span><ul>
<li><span class="file"><a href="apbs16s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs16s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="IfTask.html" tabindex="1">IfTask </a></span><ul>
<li><span class="file"><a href="apbs17s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ImportTask.html" tabindex="1">ImportTask </a></span><ul>
<li><span class="file"><a href="apbs18s01.html" tabindex="1">Target Overriding</a></span></li>
<li><span class="file"><a href="apbs18s02.html" tabindex="1">Special Properties</a></span></li>
<li><span class="file"><a href="apbs18s03.html" tabindex="1">Resolving Files Against the Imported File</a></span></li>
<li><span class="file"><a href="apbs18s04.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="IncludePathTask.html" tabindex="1">IncludePathTask </a></span><ul>
<li><span class="file"><a href="apbs19s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="InputTask.html" tabindex="1">InputTask </a></span><ul>
<li><span class="file"><a href="apbs20s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LoadFileTask.html" tabindex="1">LoadFileTask </a></span><ul>
<li><span class="file"><a href="apbs21s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs21s02.html" tabindex="1">Supported Nested Tags:</a></span></li>
</ul>
</li>
<li><span class="file"><a href="MkdirTask.html" tabindex="1">MkdirTask </a></span><ul>
<li><span class="file"><a href="apbs22s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="MoveTask.html" tabindex="1">MoveTask </a></span><ul>
<li><span class="file"><a href="apbs23s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs23s02.html" tabindex="1">Attributes and Nested Elements</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhingTask.html" tabindex="1">PhingTask </a></span><ul>
<li><span class="file"><a href="apbs24s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs24s02.html" tabindex="1">Supported Nested Tags</a></span></li>
<li><span class="file"><a href="apbs24s03.html" tabindex="1">Base directory of the new project</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhingCallTask.html" tabindex="1">PhingCallTask </a></span><ul>
<li><span class="file"><a href="apbs25s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs25s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpEvalTask.html" tabindex="1">PhpEvalTask </a></span><ul>
<li><span class="file"><a href="apbs26s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs26s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PropertyTask.html" tabindex="1">PropertyTask </a></span><ul>
<li><span class="file"><a href="apbs27s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs27s02.html" tabindex="1">Supported Nested Tags:</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PropertyPromptTask.html" tabindex="1">PropertyPromptTask </a></span><ul>
<li><span class="file"><a href="apbs28s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ReflexiveTask.html" tabindex="1">ReflexiveTask </a></span><ul>
<li><span class="file"><a href="apbs29s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs29s02.html" tabindex="1">Supported Nested Tags:</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ResolvePathTask.html" tabindex="1">ResolvePathTask </a></span><ul>
<li><span class="file"><a href="apbs30s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="TaskdefTask.html" tabindex="1">TaskdefTask </a></span><ul>
<li><span class="file"><a href="apbs31s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs31s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="TouchTask.html" tabindex="1">TouchTask </a></span><ul>
<li><span class="file"><a href="apbs32s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs32s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="TryCatchTask.html" tabindex="1">TryCatchTask</a></span><ul>
<li><span class="file"><a href="apbs33s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="TstampTask.html" tabindex="1">TstampTask </a></span><ul>
<li><span class="file"><a href="apbs34s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs34s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="TypedefTask.html" tabindex="1">TypedefTask </a></span><ul>
<li><span class="file"><a href="apbs35s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs35s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="UpToDateTask.html" tabindex="1">UpToDateTask </a></span><ul>
<li><span class="file"><a href="apbs36s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs36s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="WaitForTask.html" tabindex="1">WaitForTask</a></span><ul>
<li><span class="file"><a href="apbs37s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs37s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="XsltTask.html" tabindex="1">XsltTask </a></span><ul>
<li><span class="file"><a href="apbs38s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apbs38s02.html" tabindex="1">Supported Nested Elements</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.optionaltasks.html" tabindex="1">Optional tasks</a></span><ul>
<li><span class="file"><a href="ApiGenTask.html" tabindex="1">ApiGenTask</a></span><ul>
<li><span class="file"><a href="apcs01s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CoverageMergerTask.html" tabindex="1">CoverageMergerTask</a></span><ul>
<li><span class="file"><a href="apcs02s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs02s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CoverageReportTask.html" tabindex="1">CoverageReportTask</a></span><ul>
<li><span class="file"><a href="apcs03s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs03s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CoverageSetupTask.html" tabindex="1">CoverageSetupTask</a></span><ul>
<li><span class="file"><a href="apcs04s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs04s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="CoverageThresholdTask.html" tabindex="1">CoverageThresholdTask</a></span><ul>
<li><span class="file"><a href="apcs05s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs05s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="DbDeployTask.html" tabindex="1">DbDeployTask</a></span><ul>
<li><span class="file"><a href="apcs06s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="DocBloxTask.html" tabindex="1">DocBloxTask</a></span><ul>
<li><span class="file"><a href="apcs07s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs07s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ExportPropertiesTask.html" tabindex="1">ExportPropertiesTask</a></span><ul>
<li><span class="file"><a href="apcs08s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li id="webhelp-currentid"><span class="file"><a href="FileHashTask.html" tabindex="1">FileHashTask</a></span><ul>
<li><span class="file"><a href="apcs09s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="FileSizeTask.html" tabindex="1">FileSizeTask</a></span><ul>
<li><span class="file"><a href="apcs10s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="FileSyncTask.html" tabindex="1">FileSyncTask</a></span><ul>
<li><span class="file"><a href="apcs11s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="FtpDeployTask.html" tabindex="1">FtpDeployTask</a></span><ul>
<li><span class="file"><a href="apcs12s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs12s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitInitTask.html" tabindex="1">GitInitTask</a></span><ul>
<li><span class="file"><a href="apcs13s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitCloneTask.html" tabindex="1">GitCloneTask</a></span><ul>
<li><span class="file"><a href="apcs14s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitGcTask.html" tabindex="1">GitGcTask</a></span><ul>
<li><span class="file"><a href="apcs15s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitBranchTask.html" tabindex="1">GitBranchTask</a></span><ul>
<li><span class="file"><a href="apcs16s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitFetchTask.html" tabindex="1">GitFetchTask</a></span><ul>
<li><span class="file"><a href="apcs17s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitCheckoutTask.html" tabindex="1">GitCheckoutTask</a></span><ul>
<li><span class="file"><a href="apcs18s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitCommitTask.html" tabindex="1">GitCommitTask</a></span><ul>
<li><span class="file"><a href="apcs19s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitMergeTask.html" tabindex="1">GitMergeTask</a></span><ul>
<li><span class="file"><a href="apcs20s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitPullTask.html" tabindex="1">GitPullTask</a></span><ul>
<li><span class="file"><a href="apcs21s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitPushTask.html" tabindex="1">GitPushTask</a></span><ul>
<li><span class="file"><a href="apcs22s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitTagTask.html" tabindex="1">GitTagTask</a></span><ul>
<li><span class="file"><a href="apcs23s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GitLogTask.html" tabindex="1">GitLogTask</a></span><ul>
<li><span class="file"><a href="apcs24s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GrowlNotifyTask.html" tabindex="1">GrowlNotifyTask</a></span><ul>
<li><span class="file"><a href="apcs25s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="HttpGetTask.html" tabindex="1">HttpGetTask</a></span><ul>
<li><span class="file"><a href="apcs26s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="HttpRequestTask.html" tabindex="1">HttpRequestTask</a></span><ul>
<li><span class="file"><a href="apcs27s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs27s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="IoncubeEncoderTask.html" tabindex="1">IoncubeEncoderTask</a></span><ul>
<li><span class="file"><a href="apcs28s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs28s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="IoncubeLicenseTask.html" tabindex="1">IoncubeLicenseTask</a></span><ul>
<li><span class="file"><a href="apcs29s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs29s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="JslLintTask.html" tabindex="1">JslLintTask</a></span><ul>
<li><span class="file"><a href="apcs30s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs30s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="JsMinTask.html" tabindex="1">JsMinTask</a></span><ul>
<li><span class="file"><a href="apcs31s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs31s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LiquibaseChangeLogTask.html" tabindex="1">LiquibaseChangeLogTask</a></span><ul>
<li><span class="file"><a href="apcs32s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LiquibaseDbDocTask.html" tabindex="1">LiquibaseDbDocTask</a></span><ul>
<li><span class="file"><a href="apcs33s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LiquibaseDiffTask.html" tabindex="1">LiquibaseDiffTask</a></span><ul>
<li><span class="file"><a href="apcs34s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LiquibaseRollbackTask.html" tabindex="1">LiquibaseRollbackTask</a></span><ul>
<li><span class="file"><a href="apcs35s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LiquibaseTagTask.html" tabindex="1">LiquibaseTagTask</a></span><ul>
<li><span class="file"><a href="apcs36s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LiquibaseUpdateTask.html" tabindex="1">LiquibaseUpdateTask</a></span><ul>
<li><span class="file"><a href="apcs37s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="MailTask.html" tabindex="1">MailTask</a></span><ul>
<li><span class="file"><a href="apcs38s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs38s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ParallelTask.html" tabindex="1">ParallelTask</a></span><ul>
<li><span class="file"><a href="apcs39s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PatchTask.html" tabindex="1">PatchTask</a></span><ul>
<li><span class="file"><a href="apcs40s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PDOSQLExecTask.html" tabindex="1">PDOSQLExecTask</a></span><ul>
<li><span class="file"><a href="apcs41s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs41s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PearPackageTask.html" tabindex="1">PearPackageTask</a></span><ul>
<li><span class="file"><a href="apcs42s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs42s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PearPackage2Task.html" tabindex="1">PearPackage2Task</a></span><ul>
<li><span class="file"><a href="apcs43s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs43s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PharPackageTask.html" tabindex="1">PharPackageTask</a></span><ul>
<li><span class="file"><a href="apcs44s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs44s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhkPackageTask.html" tabindex="1">PhkPackageTask</a></span><ul>
<li><span class="file"><a href="apcs45s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs45s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpCodeSnifferTask.html" tabindex="1">PhpCodeSnifferTask</a></span><ul>
<li><span class="file"><a href="apcs46s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apcs46s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PHPCPDTask.html" tabindex="1">PHPCPDTask</a></span><ul>
<li><span class="file"><a href="apcs47s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apcs47s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PHPLocTask.html" tabindex="1">PHPLocTask</a></span><ul>
<li><span class="file"><a href="apcs48s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apcs48s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PHPMDTask.html" tabindex="1">PHPMDTask</a></span><ul>
<li><span class="file"><a href="apcs49s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs49s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpDependTask.html" tabindex="1">PhpDependTask</a></span><ul>
<li><span class="file"><a href="apcs50s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs50s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpDocumentorTask.html" tabindex="1">PhpDocumentorTask</a></span><ul>
<li><span class="file"><a href="apcs51s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs51s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpDocumentor2Task.html" tabindex="1">DocBloxTask</a></span><ul>
<li><span class="file"><a href="apcs52s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs52s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpDocumentorExternalTask.html" tabindex="1">PhpDocumentorExternalTask</a></span><ul>
<li><span class="file"><a href="apcs53s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PhpLintTask.html" tabindex="1">PhpLintTask</a></span><ul>
<li><span class="file"><a href="apcs54s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs54s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PHPUnitTask.html" tabindex="1">PHPUnitTask</a></span><ul>
<li><span class="file"><a href="apcs55s01.html" tabindex="1">Supported Nested Tags</a></span></li>
<li><span class="file"><a href="apcs55s02.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs55s03.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PHPUnitReport.html" tabindex="1">PHPUnitReport</a></span><ul>
<li><span class="file"><a href="apcs56s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="rSTTask.html" tabindex="1">rSTTask</a></span><ul>
<li><span class="file"><a href="apcs57s01.html" tabindex="1">Features</a></span></li>
<li><span class="file"><a href="apcs57s02.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apcs57s03.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="S3PutTask.html" tabindex="1">S3PutTask</a></span><ul>
<li><span class="file"><a href="apcs58s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs58s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="S3GetTask.html" tabindex="1">S3GetTask</a></span><ul>
<li><span class="file"><a href="apcs59s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ScpTask.html" tabindex="1">ScpTask</a></span><ul>
<li><span class="file"><a href="apcs60s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs60s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SshTask.html" tabindex="1">SshTask</a></span><ul>
<li><span class="file"><a href="apcs61s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs61s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SimpleTestTask.html" tabindex="1">SimpleTestTask</a></span><ul>
<li><span class="file"><a href="apcs62s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs62s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnCheckoutTask.html" tabindex="1">SvnCheckoutTask</a></span><ul>
<li><span class="file"><a href="apcs63s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnCommitTask.html" tabindex="1">SvnCommitTask</a></span><ul>
<li><span class="file"><a href="apcs64s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnCopyTask.html" tabindex="1">SvnCopyTask</a></span><ul>
<li><span class="file"><a href="apcs65s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnExportTask.html" tabindex="1">SvnExportTask</a></span><ul>
<li><span class="file"><a href="apcs66s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnInfoTask.html" tabindex="1">SvnInfoTask</a></span><ul>
<li><span class="file"><a href="apcs67s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnLastRevisionTask.html" tabindex="1">SvnLastRevisionTask</a></span><ul>
<li><span class="file"><a href="apcs68s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnListTask.html" tabindex="1">SvnListTask</a></span><ul>
<li><span class="file"><a href="apcs69s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnLogTask.html" tabindex="1">SvnLogTask</a></span><ul>
<li><span class="file"><a href="apcs70s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnUpdateTask.html" tabindex="1">SvnUpdateTask</a></span><ul>
<li><span class="file"><a href="apcs71s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SvnSwitchTask.html" tabindex="1">SvnSwitchTask</a></span><ul>
<li><span class="file"><a href="apcs72s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SymfonyConsoleTask.html" tabindex="1">SymfonyConsoleTask</a></span><ul>
<li><span class="file"><a href="apcs73s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apcs73s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="SymlinkTask.html" tabindex="1">SymlinkTask</a></span><ul>
<li><span class="file"><a href="apcs74s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs74s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="TarTask.html" tabindex="1">TarTask</a></span><ul>
<li><span class="file"><a href="apcs75s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs75s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="UntarTask.html" tabindex="1">UntarTask</a></span><ul>
<li><span class="file"><a href="apcs76s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs76s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="UnzipTask.html" tabindex="1">UnzipTask</a></span><ul>
<li><span class="file"><a href="apcs77s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs77s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="VersionTask.html" tabindex="1">VersionTask</a></span><ul>
<li><span class="file"><a href="apcs78s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="WikiPublishTask.html" tabindex="1">WikiPublishTask</a></span><ul>
<li><span class="file"><a href="apcs79s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="XmlLintTask.html" tabindex="1">XmlLintTask</a></span><ul>
<li><span class="file"><a href="apcs80s01.html" tabindex="1">Examples</a></span></li>
<li><span class="file"><a href="apcs80s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="XmlPropertyTask.html" tabindex="1">XmlPropertyTask</a></span><ul>
<li><span class="file"><a href="apcs81s01.html" tabindex="1">Example</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ZendCodeAnalyzerTask.html" tabindex="1">ZendCodeAnalyzerTask</a></span><ul>
<li><span class="file"><a href="apcs82s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs82s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ZendGuardEncodeTask.html" tabindex="1">ZendGuardEncodeTask</a></span><ul>
<li><span class="file"><a href="apcs83s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs83s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ZendGuardLicenseTask.html" tabindex="1">ZendGuardLicenseTask</a></span><ul>
<li><span class="file"><a href="apcs84s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ZipTask.html" tabindex="1">ZipTask</a></span><ul>
<li><span class="file"><a href="apcs85s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="apcs85s02.html" tabindex="1">Supported Nested Tags</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.coretypes.html" tabindex="1">Core Types</a></span><ul>
<li><span class="file"><a href="Excludes.html" tabindex="1">Excludes</a></span><ul>
<li><span class="file"><a href="apds01s01.html" tabindex="1">Nested tags</a></span></li>
<li><span class="file"><a href="apds01s02.html" tabindex="1">Usage Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="FileList.html" tabindex="1">FileList</a></span><ul>
<li><span class="file"><a href="apds02s01.html" tabindex="1">Usage Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="FileSet.html" tabindex="1">FileSet</a></span><ul>
<li><span class="file"><a href="apds03s01.html" tabindex="1">Using wildcards</a></span></li>
<li><span class="file"><a href="apds03s02.html" tabindex="1">Usage Examples</a></span></li>
<li><span class="file"><a href="apds03s03.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PatternSet.html" tabindex="1">PatternSet </a></span><ul>
<li><span class="file"><a href="apds04s01.html" tabindex="1">Usage Example</a></span></li>
<li><span class="file"><a href="apds04s02.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="path.html" tabindex="1">Path / Classpath</a></span><ul>
<li><span class="file"><a href="apds05s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.corefilters.html" tabindex="1">Core filters</a></span><ul>
<li><span class="file"><a href="PhingFilterReader.html" tabindex="1">PhingFilterReader</a></span><ul>
<li><span class="file"><a href="apes01s01.html" tabindex="1">Nested tags</a></span></li>
<li><span class="file"><a href="apes01s02.html" tabindex="1">Advanced</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ExpandProperties.html" tabindex="1">ExpandProperties</a></span></li>
<li><span class="file"><a href="HeadFilter.html" tabindex="1">HeadFilter</a></span></li>
<li><span class="file"><a href="IconvFilter.html" tabindex="1">IconvFilter</a></span></li>
<li><span class="file"><a href="LineContains.html" tabindex="1">Line Contains </a></span><ul>
<li><span class="file"><a href="apes05s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="LineContainsRegexp.html" tabindex="1">LineContainsRegexp</a></span><ul>
<li><span class="file"><a href="apes06s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="PrefixLines.html" tabindex="1">PrefixLines</a></span></li>
<li><span class="file"><a href="ReplaceTokens.html" tabindex="1">ReplaceTokens</a></span><ul>
<li><span class="file"><a href="apes08s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ReplaceTokensWithFile.html" tabindex="1">ReplaceTokensWithFile</a></span><ul>
<li><span class="file"><a href="apes09s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="ReplaceRegexp.html" tabindex="1">ReplaceRegexp</a></span><ul>
<li><span class="file"><a href="apes10s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="StripLineBreaks.html" tabindex="1">StripLineBreaks</a></span></li>
<li><span class="file"><a href="StripLineComments.html" tabindex="1">StripLineComments</a></span><ul>
<li><span class="file"><a href="apes12s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="StripPhpComments.html" tabindex="1">StripPhpComments</a></span></li>
<li><span class="file"><a href="StripWhitespace.html" tabindex="1">StripWhitespace</a></span></li>
<li><span class="file"><a href="TabToSpaces.html" tabindex="1">TabToSpaces</a></span></li>
<li><span class="file"><a href="TailFilter.html" tabindex="1">TailFilter</a></span></li>
<li><span class="file"><a href="TidyFilter.html" tabindex="1">TidyFilter</a></span><ul>
<li><span class="file"><a href="apes17s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
<li><span class="file"><a href="XincludeFilter.html" tabindex="1">XincludeFilter</a></span></li>
<li><span class="file"><a href="XsltFilter.html" tabindex="1">XsltFilter</a></span><ul>
<li><span class="file"><a href="apes19s01.html" tabindex="1">Nested tags</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.coremappers.html" tabindex="1">Core mappers</a></span><ul>
<li><span class="file"><a href="apfs01.html" tabindex="1">Common Attributes</a></span></li>
<li><span class="file"><a href="FlattenMapper.html" tabindex="1">FlattenMapper </a></span><ul>
<li><span class="file"><a href="apfs02s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="GlobMapper.html" tabindex="1">GlobMapper </a></span><ul>
<li><span class="file"><a href="apfs03s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="IdentityMapper.html" tabindex="1">IdentityMapper </a></span></li>
<li><span class="file"><a href="MergeMapper.html" tabindex="1">MergeMapper </a></span><ul>
<li><span class="file"><a href="apfs05s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
<li><span class="file"><a href="RegexpMapper.html" tabindex="1">RegexpMapper </a></span><ul>
<li><span class="file"><a href="apfs06s01.html" tabindex="1">Examples</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.selectors.html" tabindex="1">Core selectors</a></span><ul>
<li><span class="file"><a href="Contains.html" tabindex="1">Contains </a></span></li>
<li><span class="file"><a href="Date.html" tabindex="1">Date</a></span></li>
<li><span class="file"><a href="Depend.html" tabindex="1">Depend</a></span></li>
<li><span class="file"><a href="Depth.html" tabindex="1">Depth</a></span></li>
<li><span class="file"><a href="Filename.html" tabindex="1">Filename </a></span></li>
<li><span class="file"><a href="Present.html" tabindex="1">Present</a></span></li>
<li><span class="file"><a href="Containsregexp.html" tabindex="1">Containsregexp</a></span></li>
<li><span class="file"><a href="Size.html" tabindex="1">Size</a></span></li>
<li><span class="file"><a href="Type.html" tabindex="1">Type </a></span></li>
<li><span class="file"><a href="And.html" tabindex="1">And </a></span></li>
<li><span class="file"><a href="Majority.html" tabindex="1">Majority</a></span></li>
<li><span class="file"><a href="None.html" tabindex="1">None </a></span></li>
<li><span class="file"><a href="Not.html" tabindex="1">Not</a></span></li>
<li><span class="file"><a href="Or.html" tabindex="1">Or</a></span></li>
<li><span class="file"><a href="Selector.html" tabindex="1">Selector </a></span></li>
</ul>
</li>
<li><span class="file"><a href="app.projcomponents.html" tabindex="1">Project Components</a></span><ul>
<li><span class="file"><a href="Project.html" tabindex="1">Phing Projects</a></span><ul>
<li><span class="file"><a href="aphs01s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="aphs01s02.html" tabindex="1">Attributes</a></span></li>
</ul>
</li>
<li><span class="file"><a href="Target.html" tabindex="1">Targets</a></span><ul>
<li><span class="file"><a href="aphs02s01.html" tabindex="1">Example</a></span></li>
<li><span class="file"><a href="aphs02s02.html" tabindex="1">Attributes</a></span></li>
</ul>
</li>
</ul>
</li>
<li><span class="file"><a href="app.fileformats.html" tabindex="1">File Formats</a></span><ul>
<li><span class="file"><a href="BuildFileFormat.html" tabindex="1">Build File Format</a></span></li>
<li><span class="file"><a href="PropertyFileFormat.html" tabindex="1">Property File Format</a></span></li>
</ul>
</li>
<li><span class="file"><a href="app.bibliography.html" tabindex="1">Bibliography</a></span><ul>
<li><span class="file"><a href="app.bibliography.html#InternationalStandards" tabindex="1">International Standards</a></span></li>
<li><span class="file"><a href="app.bibliography.html#Licenses" tabindex="1">Licenses</a></span></li>
<li><span class="file"><a href="app.bibliography.html#os-projects" tabindex="1">Open Source Projects</a></span></li>
<li><span class="file"><a href="app.bibliography.html#Manuals" tabindex="1">Manuals</a></span></li>
<li><span class="file"><a href="app.bibliography.html#OtherResources" tabindex="1">Other Resources</a></span></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="searchDiv">
<div id="search">
<form onsubmit="Verifie(searchForm);return false" name="searchForm" class="searchForm">
<div><input id="textToSearch" name="textToSearch" type="search" placeholder="Search" class="searchText" tabindex="1" /> <input onclick="Verifie(searchForm)" type="button" class="searchButton" value="Go" id="doSearch" tabindex="1" /></div>
</form>
</div>
<div id="searchResults">
<center></center>
</div>
<p class="searchHighlight"><a href="#" onclick="toggleHighlight()">Search Highlighter (On/Off)</a></p>
</div>
</div>
</div>
</div>
</body>
</html> | {
"content_hash": "dae39013311e59fae676b0d56b6e0d97",
"timestamp": "",
"source": "github",
"line_count": 1186,
"max_line_length": 269,
"avg_line_length": 78.57841483979765,
"alnum_prop": 0.4364014850741464,
"repo_name": "LECAN/Projet_Transversal",
"id": "f300195d54ecbe5a23d66bdecb1d216283bce0d2",
"size": "93200",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "vendor/phing/phing/docs/docbook5/en/output/webhelp/FileHashTask.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "165022"
},
{
"name": "JavaScript",
"bytes": "58327"
},
{
"name": "PHP",
"bytes": "54670"
}
],
"symlink_target": ""
} |
#include <pangolin/video/drivers/join.h>
namespace pangolin
{
VideoJoiner::VideoJoiner(const std::vector<VideoInterface*>& src)
: src(src), size_bytes(0)
{
// Add individual streams
for(size_t s=0; s< src.size(); ++s)
{
VideoInterface& vid = *src[s];
for(size_t i=0; i < vid.Streams().size(); ++i)
{
const StreamInfo si = vid.Streams()[i];
const VideoPixelFormat fmt = si.PixFormat();
const Image<unsigned char> img_offset = si.StreamImage((unsigned char*)size_bytes);
streams.push_back(StreamInfo(fmt, img_offset));
}
size_bytes += src[s]->SizeBytes();
}
}
VideoJoiner::~VideoJoiner()
{
}
size_t VideoJoiner::SizeBytes() const
{
return size_bytes;
}
const std::vector<StreamInfo>& VideoJoiner::Streams() const
{
return streams;
}
void VideoJoiner::Start()
{
for(size_t s=0; s< src.size(); ++s) {
src[s]->Start();
}
}
void VideoJoiner::Stop()
{
for(size_t s=0; s< src.size(); ++s) {
src[s]->Stop();
}
}
bool VideoJoiner::GrabNext( unsigned char* image, bool wait )
{
bool grabbed_any = false;
size_t offset = 0;
for(size_t s=0; s< src.size(); ++s)
{
VideoInterface& vid = *src[s];
grabbed_any |= vid.GrabNext(image+offset,wait);
offset += vid.SizeBytes();
}
return grabbed_any;
}
bool VideoJoiner::GrabNewest( unsigned char* image, bool wait )
{
return GrabNext(image, wait);
}
std::vector<VideoInterface*>& VideoJoiner::InputStreams()
{
return src;
}
}
| {
"content_hash": "c28f2e37557cb51fc013a2f06c38e342",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 95,
"avg_line_length": 20.4025974025974,
"alnum_prop": 0.5913430935709739,
"repo_name": "pinglin/Pangolin",
"id": "76ac9eed9197a7e6c01ebf6a28897bf86b283fce",
"size": "2792",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/video/drivers/join.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "146278"
},
{
"name": "C++",
"bytes": "1127066"
},
{
"name": "CMake",
"bytes": "61551"
},
{
"name": "Objective-C",
"bytes": "1807"
},
{
"name": "Objective-C++",
"bytes": "23517"
}
],
"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 (version 1.7.0_80) on Wed Oct 12 20:49:58 CEST 2016 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class org.apache.flume.sink.kafka.KafkaSink (Apache Flume 1.7.0 API)</title>
<meta name="date" content="2016-10-12">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.flume.sink.kafka.KafkaSink (Apache Flume 1.7.0 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<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/flume/sink/kafka/KafkaSink.html" title="class in org.apache.flume.sink.kafka">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/flume/sink/kafka/class-use/KafkaSink.html" target="_top">Frames</a></li>
<li><a href="KafkaSink.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.flume.sink.kafka.KafkaSink" class="title">Uses of Class<br>org.apache.flume.sink.kafka.KafkaSink</h2>
</div>
<div class="classUseContainer">No usage of org.apache.flume.sink.kafka.KafkaSink</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/flume/sink/kafka/KafkaSink.html" title="class in org.apache.flume.sink.kafka">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/flume/sink/kafka/class-use/KafkaSink.html" target="_top">Frames</a></li>
<li><a href="KafkaSink.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 © 2009-2016 <a href="http://www.apache.org">Apache Software Foundation</a>. All Rights Reserved.</small></p>
</body>
</html>
| {
"content_hash": "c7882f3bbe4e9a96a9f3363ec1b5c01e",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 151,
"avg_line_length": 38.01709401709402,
"alnum_prop": 0.6094874100719424,
"repo_name": "wangchuande/apache-flume-1.7.0",
"id": "8d7d7793f5d8b60596ea7ee404e8586ee93b6764",
"size": "4448",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "docs/apidocs/org/apache/flume/sink/kafka/class-use/KafkaSink.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "936"
},
{
"name": "PowerShell",
"bytes": "14176"
},
{
"name": "Shell",
"bytes": "12491"
}
],
"symlink_target": ""
} |
package liquibase.statement.core;
import liquibase.statement.*;
import java.util.*;
public class AddColumnStatement extends AbstractSqlStatement {
private String catalogName;
private String schemaName;
private String tableName;
private String columnName;
private String columnType;
private Object defaultValue;
private String defaultValueConstraintName;
private String remarks;
private String addAfterColumn;
private String addBeforeColumn;
private Integer addAtPosition;
private Boolean computed;
private Set<ColumnConstraint> constraints = new HashSet<>();
private List<AddColumnStatement> columns = new ArrayList<>();
public AddColumnStatement(String catalogName, String schemaName, String tableName, String columnName, String columnType, Object defaultValue, ColumnConstraint... constraints) {
this.catalogName = catalogName;
this.schemaName = schemaName;
this.tableName = tableName;
this.columnName = columnName;
this.columnType = columnType;
this.defaultValue = defaultValue;
if (constraints != null) {
this.constraints.addAll(Arrays.asList(constraints));
}
}
public AddColumnStatement(String catalogName, String schemaName, String tableName, String columnName, String columnType, Object defaultValue, String remarks,ColumnConstraint... constraints) {
this(catalogName,schemaName,tableName,columnName,columnType,defaultValue,constraints);
this.remarks = remarks;
}
public AddColumnStatement(List<AddColumnStatement> columns) {
this.columns.addAll(columns);
}
public AddColumnStatement(AddColumnStatement... columns) {
this(Arrays.asList(columns));
}
public boolean isMultiple() {
return !columns.isEmpty();
}
public List<AddColumnStatement> getColumns() {
return columns;
}
public String getCatalogName() {
return catalogName;
}
public String getSchemaName() {
return schemaName;
}
public String getTableName() {
return tableName;
}
public String getColumnName() {
return columnName;
}
public String getColumnType() {
return columnType;
}
public String getRemarks() {
return remarks;
}
public Set<ColumnConstraint> getConstraints() {
return constraints;
}
public boolean isAutoIncrement() {
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof AutoIncrementConstraint) {
return true;
}
}
return false;
}
public AutoIncrementConstraint getAutoIncrementConstraint() {
AutoIncrementConstraint autoIncrementConstraint = null;
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof AutoIncrementConstraint) {
autoIncrementConstraint = (AutoIncrementConstraint) constraint;
break;
}
}
return autoIncrementConstraint;
}
public boolean isPrimaryKey() {
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof PrimaryKeyConstraint) {
return true;
}
}
return false;
}
public boolean isNullable() {
if (isPrimaryKey()) {
return false;
}
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof NotNullConstraint) {
return false;
}
}
return true;
}
public boolean shouldValidateNullable() {
if (isPrimaryKey()) {
return false;
}
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof NotNullConstraint) {
if (!((NotNullConstraint) constraint).shouldValidateNullable()) {
return false;
}
}
}
return true;
}
public boolean shouldValidateUnique() {
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof UniqueConstraint) {
if (!((UniqueConstraint) constraint).shouldValidateUnique()) {
return false;
}
}
}
return true;
}
public boolean shouldValidatePrimaryKey() {
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof PrimaryKeyConstraint) {
if (!((PrimaryKeyConstraint) constraint).shouldValidatePrimaryKey()) {
return false;
}
}
}
return true;
}
public boolean isUnique() {
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof UniqueConstraint) {
return true;
}
}
return false;
}
public String getUniqueStatementName() {
for (ColumnConstraint constraint : getConstraints()) {
if (constraint instanceof UniqueConstraint) {
return ((UniqueConstraint) constraint).getConstraintName();
}
}
return null;
}
public Object getDefaultValue() {
return defaultValue;
}
public String getAddAfterColumn() {
return addAfterColumn;
}
public void setAddAfterColumn(String addAfterColumn) {
this.addAfterColumn = addAfterColumn;
}
public String getAddBeforeColumn() {
return addBeforeColumn;
}
public void setAddBeforeColumn(String addBeforeColumn) {
this.addBeforeColumn = addBeforeColumn;
}
public Integer getAddAtPosition() {
return addAtPosition;
}
public void setAddAtPosition(Integer addAtPosition) {
this.addAtPosition = addAtPosition;
}
public String getDefaultValueConstraintName() {
return defaultValueConstraintName;
}
public void setDefaultValueConstraintName(String defaultValueConstraintName) {
this.defaultValueConstraintName = defaultValueConstraintName;
}
public Boolean getComputed() {
return computed;
}
public void setComputed(Boolean computed) {
this.computed = computed;
}
}
| {
"content_hash": "40019902109dc8cb63cf6171811d9946",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 195,
"avg_line_length": 28.16740088105727,
"alnum_prop": 0.6248045042227088,
"repo_name": "liquibase/liquibase",
"id": "d15daa373ae6daf5b101b9f977ab9632df73aa67",
"size": "6394",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "liquibase-core/src/main/java/liquibase/statement/core/AddColumnStatement.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1565"
},
{
"name": "CSS",
"bytes": "1202"
},
{
"name": "Groovy",
"bytes": "1286555"
},
{
"name": "HTML",
"bytes": "2113"
},
{
"name": "Inno Setup",
"bytes": "2522"
},
{
"name": "Java",
"bytes": "5714665"
},
{
"name": "PLpgSQL",
"bytes": "682"
},
{
"name": "SQLPL",
"bytes": "2790"
},
{
"name": "Shell",
"bytes": "10956"
},
{
"name": "TSQL",
"bytes": "34128"
},
{
"name": "XSLT",
"bytes": "1101"
}
],
"symlink_target": ""
} |
package me.denley.notary.sample;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.DataItem;
import com.google.android.gms.wearable.DataItemBuffer;
import com.google.android.gms.wearable.Node;
import com.google.android.gms.wearable.Wearable;
import java.util.List;
import me.denley.courier.Courier;
import me.denley.courier.LocalNode;
import me.denley.courier.RemoteNodes;
import me.denley.notary.DirectoryObserver;
import me.denley.notary.File;
import me.denley.notary.FileListAdapter;
import me.denley.notary.FileTransaction;
import me.denley.notary.Notary;
import me.denley.notary.PendingFile;
import me.denley.notary.SyncableFileFilter;
import me.denley.notary.SyncedFile;
public class MainActivity extends ActionBarActivity implements SyncableFileFilter {
private DirectoryObserver observer;
@LocalNode Node localNode;
@RemoteNodes List<Node> remoteNodes;
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Courier.startReceiving(this);
final java.io.File directory = new java.io.File(FileTransaction.getDefaultDirectory(this));
directory.mkdir();
if(!directory.isDirectory()) {
throw new RuntimeException("Unable to load sample directory");
}
RecyclerView list = new RecyclerView(this);
setContentView(list);
list.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
MainActivityAdapter adapter = new MainActivityAdapter();
list.setAdapter(adapter);
observer = new DirectoryObserver(this, adapter, directory.getAbsolutePath(), null, this, File.SORT_ALPHABETICAL_DIRECTORIES_FIRST, null);
//purge();
}
private void purge() {
new Thread(){
public void run(){
final GoogleApiClient apiClient = new GoogleApiClient.Builder(MainActivity.this)
.addApi(Wearable.API).build();
final ConnectionResult result = apiClient.blockingConnect();
if(result.isSuccess()) {
final DataItemBuffer buffer = Wearable.DataApi.getDataItems(apiClient).await();
for(DataItem item:buffer) {
Wearable.DataApi.deleteDataItems(apiClient, item.getUri());
}
buffer.release();
} else {
throw new IllegalStateException("Unable to connect to wearable API");
}
}
}.start();
}
@Override protected void onDestroy() {
super.onDestroy();
observer.stopObserving();
}
@Override public boolean display(File file) {
return !file.isDirectory;
}
@Override public boolean autoSync(File file) {
return false;
}
private class MainActivityAdapter extends FileListAdapter {
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
return new ViewHolder(getLayoutInflater().inflate(R.layout.list_item_file, viewGroup, false));
}
@Override public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
final TextView text = (TextView) viewHolder.itemView.findViewById(android.R.id.text1);
final ImageView icon = (ImageView) viewHolder.itemView.findViewById(android.R.id.icon);
final File file = getFile(position);
text.setText(file.getName());
if(file instanceof SyncedFile) {
icon.setImageResource(R.drawable.ic_action_success);
} else if(file instanceof PendingFile) {
final PendingFile pendingFile = (PendingFile)file;
switch(pendingFile.transaction.getStatus()) {
case FileTransaction.STATUS_IN_PROGRESS:
icon.setImageResource(R.drawable.ic_action_sync);
break;
case FileTransaction.STATUS_COMPLETE:
icon.setImageResource(R.drawable.ic_action_success);
break;
case FileTransaction.STATUS_FAILED_UNKNOWN:
case FileTransaction.STATUS_FAILED_FILE_NOT_FOUND:
icon.setImageResource(R.drawable.ic_action_sync_problem);
break;
case FileTransaction.STATUS_FAILED_BAD_DESTINATION:
text.append("\nBad Destination");
break;
case FileTransaction.STATUS_FAILED_FILE_ALREADY_EXISTS:
text.append("\nAlready Exists");
break;
case FileTransaction.STATUS_FAILED_NO_READ_PERMISSION:
text.append("\nCan't Read");
break;
case FileTransaction.STATUS_FAILED_NO_DELETE_PERMISSION:
text.append("\nCan't Delete");
break;
case FileTransaction.STATUS_CANCELED:
if(file.isDirectory) {
icon.setImageResource(R.drawable.ic_action_folder);
} else {
icon.setImageResource(R.drawable.ic_action_file);
}
break;
}
} else {
if(file.isDirectory) {
icon.setImageResource(R.drawable.ic_action_folder);
} else {
icon.setImageResource(R.drawable.ic_action_file);
}
}
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
if(file.isDirectory) {
// do nothing
} else if(file instanceof PendingFile) {
// TODO cancel transaction
} else if(file instanceof SyncedFile) {
final String fileName = new java.io.File(file.path).getName();
final String remotePath = FileTransaction.DEFAULT_DIRECTORY+"/"+fileName;
Notary.requestFileDelete(
MainActivity.this,
remotePath, remoteNodes.get(0).getId(),
FileTransaction.DEFAULT_DIRECTORY, localNode.getId());
} else {
Notary.requestFileTransfer(MainActivity.this,
file.path, localNode.getId(),
FileTransaction.DEFAULT_DIRECTORY, remoteNodes.get(0).getId(),
false);
}
}
});
}
}
private class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(View itemView) {
super(itemView);
}
}
}
| {
"content_hash": "382caab16d00d113affdd48dd7a384bc",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 145,
"avg_line_length": 40.59016393442623,
"alnum_prop": 0.5887183629509962,
"repo_name": "denley/Notary",
"id": "fd492d760d9ac29256cff8fa5a0f94fe09f7a892",
"size": "7428",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sample-mobile/src/main/java/me/denley/notary/sample/MainActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "64709"
}
],
"symlink_target": ""
} |
function plotTimeseries(timeseries){
// Flot Line Charts - Multiple Axes - With Data
$(function(timeseries) {
function euroFormatter(v, axis) {
return v.toFixed(axis.tickDecimals) + "€";
}
function doPlot(position) {
$.plot($("#flot-multiple-axes-chart"), [{
data: timeseries,
label: "Twitte Activity"
}], {
xaxes: [{
mode: 'time'
}],
yaxes: [{
min: 0
}, {
// align if we are to the right
alignTicksWithAxis: position == "right" ? 1 : null,
position: position,
tickFormatter: euroFormatter
}],
legend: {
position: 'sw'
},
grid: {
hoverable: true //IMPORTANT! this is needed for tooltip to work
},
tooltip: true,
tooltipOpts: {
content: "%s for %x was %y",
xDateFormat: "%y-%0m-%0d",
onHover: function(flotItem, $tooltipEl) {
// console.log(flotItem, $tooltipEl);
}
}
});
}
doPlot("right");
$("button").click(function() {
doPlot($(this).text());
});
});
}
| {
"content_hash": "776ac7d2a97bd52224e969434c555dc7",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 25.28846153846154,
"alnum_prop": 0.4326996197718631,
"repo_name": "raminetinati/SouthamptonMSVisualisation",
"id": "2d29d5014f78909c0a3f2fdea81519544c80a837",
"size": "1367",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "js/plugins/flot/flot-data.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "116702"
},
{
"name": "HTML",
"bytes": "212325"
},
{
"name": "JavaScript",
"bytes": "747114"
}
],
"symlink_target": ""
} |
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch mengembalikan isi dari URL dan daftar URL yang ditemukan
// di halaman tersebut.
Fetch(url string) (body string, urls []string, err error)
}
// Crawl menggunakan fetcher untuk secara rekursif mengambil semua halaman
// dimulai dari url, sampai kedalaman maksimum `depth`.
func Crawl(url string, depth int, fetcher Fetcher) {
// TODO: Fetch URLs in parallel.
// TODO: Don't fetch the same URL twice.
// This implementation doesn't do either:
if depth <= 0 {
return
}
body, urls, err := fetcher.Fetch(url)
if err != nil {
fmt.Println(err)
return
}
fmt.Printf("found: %s %q\n", url, body)
for _, u := range urls {
Crawl(u, depth-1, fetcher)
}
return
}
func main() {
Crawl("https://golang.org/", 4, fetcher)
}
// fakeFetcher adalah Fetcher yang mengembalikan hasil dari tampungan.
type fakeFetcher map[string]*fakeResult
type fakeResult struct {
body string
urls []string
}
func (f fakeFetcher) Fetch(url string) (string, []string, error) {
if res, ok := f[url]; ok {
return res.body, res.urls, nil
}
return "", nil, fmt.Errorf("not found: %s", url)
}
// fetcher adalah pengembangan dari fakeFetcher.
var fetcher = fakeFetcher{
"https://golang.org/": &fakeResult{
"The Go Programming Language",
[]string{
"https://golang.org/pkg/",
"https://golang.org/cmd/",
},
},
"https://golang.org/pkg/": &fakeResult{
"Packages",
[]string{
"https://golang.org/",
"https://golang.org/cmd/",
"https://golang.org/pkg/fmt/",
"https://golang.org/pkg/os/",
},
},
"https://golang.org/pkg/fmt/": &fakeResult{
"Package fmt",
[]string{
"https://golang.org/",
"https://golang.org/pkg/",
},
},
"https://golang.org/pkg/os/": &fakeResult{
"Package os",
[]string{
"https://golang.org/",
"https://golang.org/pkg/",
},
},
}
| {
"content_hash": "d58b8040ac995ee7b00a69067f4ad8fd",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 74,
"avg_line_length": 21.83529411764706,
"alnum_prop": 0.6476293103448276,
"repo_name": "shuLhan/go-tour-id",
"id": "d342aa1f583ba4f1a3389f454da0ea3e5d586b54",
"size": "1872",
"binary": false,
"copies": "2",
"ref": "refs/heads/go-tour-id",
"path": "content/concurrency/exercise-web-crawler.go",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "9679"
},
{
"name": "Go",
"bytes": "56811"
},
{
"name": "HTML",
"bytes": "5374"
},
{
"name": "JavaScript",
"bytes": "27277"
},
{
"name": "Makefile",
"bytes": "65"
}
],
"symlink_target": ""
} |
<?php
class Kwc_Newsletter_Detail_StatisticsController extends Kwf_Controller_Action_Auto_Grid
{
protected $_buttons = array();
protected $_position = 'pos';
protected function _initColumns()
{
parent::_initColumns();
$this->_columns->add(new Kwf_Grid_Column('pos'));
$this->_columns->add(new Kwf_Grid_Column('link', trlKwf('Link'), 600));
$this->_columns->add(new Kwf_Grid_Column('title', trlKwf('Title'), 200));
$this->_columns->add(new Kwf_Grid_Column('count', trlKwf('Count'), 50))
->setCssClass('kwf-renderer-decimal');
$this->_columns->add(new Kwf_Grid_Column('percent', trlKwf('[%]'), 50));
}
protected function _getNewsletterId()
{
return substr(strrchr($this->_getParam('componentId'), '_'), 1);
}
protected function _getNewsletterMailComponentId()
{
return $this->_getParam('componentId') . '_mail';
}
protected function _fetchData()
{
$db = Kwf_Registry::get('db');
$pos = 1;
$ret = array();
$newsletterId = $this->_getNewsletterId();
$total = $db->fetchOne("SELECT count_sent FROM kwc_newsletter WHERE id=$newsletterId");
if (!$total) { return array(); }
$newsletterComponent = Kwf_Component_Data_Root::getInstance()->getComponentByDbId(
$this->_getNewsletterMailComponentId(),
array('ignoreVisible' => true)
);
$trackViews = Kwc_Abstract::getSetting($newsletterComponent->componentClass, 'trackViews');
if ($trackViews) {
$count = $newsletterComponent->getComponent()->getTotalViews();
if ($count) {
$ret[] = array(
'pos' => $pos++,
'link' => trlKwf('view rate') . ' (' . trlKwf('percentage of users which opened the html newsletter') . ')',
'title' => '',
'count' => $count,
'percent' => number_format(($count / $total)*100, 2) . '%'
);
}
}
$count = $newsletterComponent->getComponent()->getTotalClicks();
$ret[] = array(
'pos' => $pos++,
'link' => trlKwf('click rate') . ' (' . trlKwf('percentage of users which clicked at least one link in newsletter') . ')',
'title' => '',
'count' => $count,
'percent' => number_format(($count / $total)*100, 2) . '%'
);
$ret[] = array(
'pos' => $pos++,
'link' => ' ',
'title' => '',
'count' => '',
'percent' => '',
);
$sql = "
SELECT r.value, r.type, r.title, count(*) c
FROM kwc_mail_redirect_statistics s, kwc_mail_redirect r
WHERE s.redirect_id=r.id AND mail_component_id=?
GROUP BY redirect_id
ORDER BY c DESC
";
foreach ($db->fetchAll($sql, $newsletterComponent->componentId) as $row) {
if ($row['type'] == 'showcomponent') {
$c = Kwf_Component_Data_Root::getInstance()->getComponentById($row['value']);
if ($c) {
$link =
'http://' . Kwf_Registry::get('config')->server->domain .
$c->getUrl() .
' (' . substr(strrchr($row['value'], '-'), 1) . ')';
} else {
$link = $row['value'];
}
} else {
$link = $row['value'];
}
$row['value'] = $link;
$ret[] = array(
'pos' => $pos++,
'link' => $link,
'title' => $row['title'],
'count' => $row['c'],
'percent' => number_format(($row['c'] / $total)*100, 2) . '%'
);
}
return $ret;
}
}
| {
"content_hash": "ba3c8fa168667400488f723f6cb7e082",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 134,
"avg_line_length": 37.17142857142857,
"alnum_prop": 0.4719446579554189,
"repo_name": "Sogl/koala-framework",
"id": "0a36f1451ace2d787cf53fa83d6e2a8aa2e052a9",
"size": "3903",
"binary": false,
"copies": "3",
"ref": "refs/heads/3.7",
"path": "Kwc/Newsletter/Detail/StatisticsController.php",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "112255"
},
{
"name": "JavaScript",
"bytes": "1236147"
},
{
"name": "PHP",
"bytes": "6503891"
}
],
"symlink_target": ""
} |
from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^niwi-admin/', include(admin.site.urls)),
)
from django.views.generic import RedirectView
from niwi.web.views.main import Sitemap, Robots
urlpatterns += patterns('',
url(r'^', include('niwi.web.urls', namespace="web")),
url(r'^photo/', include('niwi.photo.urls', namespace='photo')),
#url(r'^filepaste/', include('niwi_apps.filepaste.urls', namespace='filepaste')),
url(r'^robots.txt$', Robots.as_view(), name='robots'),
url(r'^sitemap.xml$', Sitemap.as_view(), name='sitemap'),
)
# Static files
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
def mediafiles_urlpatterns():
"""
Method for serve media files with runserver.
"""
_media_url = settings.MEDIA_URL
if _media_url.startswith('/'):
_media_url = _media_url[1:]
from django.views.static import serve
return patterns('',
(r'^%s(?P<path>.*)$' % _media_url, serve,
{'document_root': settings.MEDIA_ROOT})
)
urlpatterns += staticfiles_urlpatterns()
urlpatterns += mediafiles_urlpatterns()
| {
"content_hash": "c2e277a32781728995035d40320055cd",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 85,
"avg_line_length": 29.609756097560975,
"alnum_prop": 0.6729818780889621,
"repo_name": "niwinz/niwi-web",
"id": "10ef6efcf544a56e68005ab2e6356eb9b62403eb",
"size": "1239",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/niwi/urls.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "29305"
},
{
"name": "Python",
"bytes": "177942"
},
{
"name": "Shell",
"bytes": "343"
}
],
"symlink_target": ""
} |
package 'duply' do
action :install
end
| {
"content_hash": "be78d8610295eba5ff132564c19cde7f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 18,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.7317073170731707,
"repo_name": "datacoda/chef-duply",
"id": "0f3d8d3b27b7932849f32b3e843e65de87c76091",
"size": "683",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "recipes/package.rb",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "3824"
},
{
"name": "Ruby",
"bytes": "23746"
}
],
"symlink_target": ""
} |
//
// TeacherViewController.m
// CoreData.HW
//
// Created by Artem Belkov on 31/08/15.
// Copyright © 2015 Artem Belkov. All rights reserved.
//
#import "TeacherViewController.h"
#import "Course.h"
#import "Teacher.h"
#import "University.h"
#import "DataManager.h"
@interface TeacherViewController ()
@end
@implementation TeacherViewController
- (NSManagedObjectContext *)managedObjectContext {
if (!_managedObjectContext) {
_managedObjectContext = [[DataManager sharedManager] managedObjectContext];
}
return _managedObjectContext;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Set title
self.navigationItem.title = [self.teacher fullName];
// Set general info
self.universityLabel.text = self.teacher.university.name;
self.photoView.image = [UIImage imageNamed:self.teacher.photo];
// Set rank info
self.rankLabel.text = [[self.teacher.rank substringToIndex:3] uppercaseString];
if ([self.teacher.rank isEqual: @"Legendary"]) {
self.rankView.image = [UIImage imageNamed:@"scoreViewPurpleReversed"];
} else if ([self.teacher.rank isEqual: @"Senior"]) {
self.rankView.image = [UIImage imageNamed:@"scoreViewGreenReversed"];
} else if ([self.teacher.rank isEqual: @"Middle"]) {
self.rankView.image = [UIImage imageNamed:@"scoreViewYellowReversed"];
} else {
self.rankView.image = [UIImage imageNamed:@"scoreViewRedReversed"];
}
// Set tint color
UIColor *blueColor = [UIColor colorWithRed: 179.f / 255.f
green: 220.f / 255.f
blue: 255.f / 255.f
alpha: 1.f ];
[[self.navigationController navigationBar] setTintColor:blueColor];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeOrientation:)
name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
[self updateOrientation];
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)updateOrientation {
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
if (UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation)) {
self.addressLabel.text = @"";
self.fullNameLabel.text = self.teacher.firstName;
} else {
self.addressLabel.text = [self.teacher fullAddress];
self.fullNameLabel.text = [self.teacher fullName];
}
}
- (void)didChangeOrientation:(NSNotification *)notification {
[self updateOrientation];
}
#pragma mark - Table View
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
Course *course = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = course.name;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", (int)[course.teachers count]];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [[self.fetchedResultsController sections] count];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
id <NSFetchedResultsSectionInfo> sectionInfo = [self.fetchedResultsController sections][section];
return [sectionInfo numberOfObjects];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
cell.textLabel.textColor = [UIColor colorWithRed: 179.f / 255.f
green: 220.f / 255.f
blue: 255.f / 255.f
alpha: 1.f ];
cell.detailTextLabel.textColor = [UIColor whiteColor];
cell.backgroundColor = [UIColor colorWithRed: 38.f / 255.f
green: 68.f / 255.f
blue: 111.f / 255.f
alpha: 1.f ];
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
Course *course = [self.fetchedResultsController objectAtIndexPath:indexPath];
[self.teacher removeCoursesObject:course];
NSError *error = nil;
if (![context save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView endUpdates];
}
}
#pragma mark - Fetched results controller
- (NSFetchedResultsController *)fetchedResultsController
{
if (_fetchedResultsController != nil) {
return _fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *description = [NSEntityDescription entityForName:@"Course" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:description];
// Sort courses with name
NSSortDescriptor *nameDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
[fetchRequest setSortDescriptors:@[nameDescriptor]];
// Check student in courses
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"teachers contains %@", self.teacher];
[fetchRequest setPredicate:predicate];
// Edit the section name key path and cache name if appropriate.
// nil for section name key path means "no sections".
NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc]
initWithFetchRequest:fetchRequest
managedObjectContext:self.managedObjectContext
sectionNameKeyPath:nil cacheName:nil];
aFetchedResultsController.delegate = self;
self.fetchedResultsController = aFetchedResultsController;
NSError *error = nil;
if (![self.fetchedResultsController performFetch:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return _fetchedResultsController;
}
- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
{
[self.coursesTableView beginUpdates];
}
- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
switch(type) {
case NSFetchedResultsChangeInsert:
[self.coursesTableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
break;
case NSFetchedResultsChangeDelete:
[self.coursesTableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
break;
default:
return;
}
}
- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
newIndexPath:(NSIndexPath *)newIndexPath
{
UITableView *tableView = self.coursesTableView;
switch(type) {
case NSFetchedResultsChangeInsert:
[tableView insertRowsAtIndexPaths:@[newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
break;
case NSFetchedResultsChangeDelete:
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
break;
case NSFetchedResultsChangeUpdate:
[self configureCell:[tableView cellForRowAtIndexPath:indexPath] atIndexPath:indexPath];
break;
case NSFetchedResultsChangeMove:
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
[tableView insertRowsAtIndexPaths:@[newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
break;
}
}
- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
{
[self.coursesTableView endUpdates];
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
| {
"content_hash": "f09ff5d39416f17956d6f87513688d12",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 190,
"avg_line_length": 37.667857142857144,
"alnum_prop": 0.6643595335166398,
"repo_name": "bestK1ngArthur/iOSDevCourse",
"id": "9ceebc67485821d02d7a2d2c2e12f23b31350e38",
"size": "10548",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CoreData/CoreData.HW/TeacherViewController.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "1335650"
}
],
"symlink_target": ""
} |
package jade.content.schema;
import jade.content.abs.*;
import jade.content.onto.*;
import jade.util.leap.Iterator;
/**
* This class represent the schema of aggregate entities in
* an ontology.
* @author Federico Bergenti - Universita` di Parma
*/
public class AggregateSchema extends TermSchema {
public static final String BASE_NAME = "Aggregate";
private static AggregateSchema baseSchema = new AggregateSchema();
private TermSchema elementsSchema;
/**
* Construct a schema that vinculates an entity to be a generic
* aggregate
*/
private AggregateSchema() {
super(BASE_NAME);
}
/**
* Creates an <code>AggregateSchema</code> with a given type-name.
*
* @param typeName The name of this <code>AggregateSchema</code>.
*/
public AggregateSchema(String typeName) {
super(typeName);
}
/**
* Creates an <code>AggregateSchema</code> with a given type-name.
*
* @param typeName The name of this <code>AggregateSchema</code>.
*/
public AggregateSchema(String typeName, TermSchema elementsSchema) {
super(typeName);
this.elementsSchema = elementsSchema;
}
/**
* Retrieve the generic base schema for all aggregates.
*
* @return the generic base schema for all aggregates.
*/
public static ObjectSchema getBaseSchema() {
return baseSchema;
}
/**
* Creates an Abstract descriptor to hold an aggregate of
* the proper type.
*/
public AbsObject newInstance() throws OntologyException {
return new AbsAggregate(getTypeName());
}
public TermSchema getElementsSchema() {
if (elementsSchema != null) {
return elementsSchema;
}
else {
return (TermSchema) TermSchema.getBaseSchema();
}
}
/**
Check whether a given abstract descriptor complies with this
schema.
@param abs The abstract descriptor to be checked
@throws OntologyException If the abstract descriptor does not
complies with this schema
*/
public void validate(AbsObject abs, Ontology onto) throws OntologyException {
// Check the type of the abstract descriptor
if (abs.getAbsType() != AbsObject.ABS_AGGREGATE) {
throw new OntologyException(abs+" is not an AbsAggregate");
}
// Validate the elements in the aggregate against their schemas.
// Note that there is no need to check that these schemas are
// compliant with TermSchema.getBaseSchema() because the
// AbsAggregate class already forces that.
AbsAggregate agg = (AbsAggregate) abs;
Iterator it = agg.iterator();
while (it.hasNext()) {
AbsTerm el = (AbsTerm) it.next();
ObjectSchema s = onto.getSchema(el.getTypeName());
s.validate(el, onto);
}
}
/**
Return true if
- s is the base schema for the XXXSchema class this schema is
an instance of (e.g. s is ConceptSchema.getBaseSchema() and this
schema is an instance of ConceptSchema)
- s is the base schema for a super-class of the XXXSchema class
this schema is an instance of (e.g. s is TermSchema.getBaseSchema()
and this schema is an instance of ConceptSchema)
*/
protected boolean descendsFrom(ObjectSchema s) {
if (s != null) {
if (s.equals(getBaseSchema())) {
return true;
}
return super.descendsFrom(s);
}
else {
return false;
}
}
/**
The difference between types of aggregates (such as SET and
SEQUENCE) is quite fuzy. Therefore we don't throw a validation
exception if a SET is found where a SEQUENCE is expected and VV.
*/
public boolean equals(Object o) {
if (o != null) {
return (o instanceof AggregateSchema);
}
else {
return false;
}
}
// Propagate the assignability check to the aggregate elements schemas
public boolean isAssignableFrom(ObjectSchema s) {
if (s != null &&
s instanceof AggregateSchema &&
s.getTypeName().equals(getTypeName())) {
return getElementsSchema().isAssignableFrom(((AggregateSchema)s).getElementsSchema());
}
return false;
}
}
| {
"content_hash": "01918aff140d8a5bb4bad60ad7cef3e7",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 89,
"avg_line_length": 28.587412587412587,
"alnum_prop": 0.6731898238747553,
"repo_name": "shookees/SmartFood_old",
"id": "384dda3d6de5c3c3bd45e06814906a37e55795e1",
"size": "5164",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "lib/JADE/src/jade/content/schema/AggregateSchema.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CLIPS",
"bytes": "8093"
},
{
"name": "CSS",
"bytes": "20703"
},
{
"name": "Java",
"bytes": "7455756"
},
{
"name": "Shell",
"bytes": "2707"
}
],
"symlink_target": ""
} |
$(function(){
// Bind normal buttons
Ladda.bind( '.btn-ladda', { timeout: 2000 } );
// Bind progress buttons and simulate loading progress
Ladda.bind( '.btn-ladda-progress', {
callback: function( instance ) {
var progress = 0;
var interval = setInterval( function() {
progress = Math.min( progress + Math.random() * 0.1, 1 );
instance.setProgress( progress );
if( progress === 1 ) {
instance.stop();
clearInterval( interval );
}
}, 200 );
}
});
});
| {
"content_hash": "c5644ba3cf5431aaea4379caaaa8f328",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 61,
"avg_line_length": 24.9,
"alnum_prop": 0.6004016064257028,
"repo_name": "johnotaalo/EQA",
"id": "315b12e005ab3381a0343d27e3e7063b72c5766d",
"size": "498",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "assets/dashboard/js/views/loading-buttons.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ApacheConf",
"bytes": "1532"
},
{
"name": "CSS",
"bytes": "889186"
},
{
"name": "HTML",
"bytes": "40552"
},
{
"name": "JavaScript",
"bytes": "720296"
},
{
"name": "PHP",
"bytes": "1955956"
}
],
"symlink_target": ""
} |
<?php
namespace App\Components\GitHub;
use App\Events\GitHub\FileContentFetched;
use GitHub;
use Illuminate\Console\Command;
class FetchGitHubFileContent extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $signature = 'dashboard:github';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fetch GitHub file content.';
public function handle()
{
$fileNames = explode(',', env('GITHUB_FILES'));
$fileContent = collect($fileNames)
->combine($fileNames)
->map(function ($fileName) {
return GitHub::repo()->contents()->show('fuguevit', 'tasks', "{$fileName}.md", 'master');
})
->map(function ($fileInfo) {
return file_get_contents($fileInfo['download_url']);
})
->map(function ($markdownContent) {
return markdownToHtml($markdownContent);
})
->toArray();
event(new FileContentFetched($fileContent));
}
}
| {
"content_hash": "158514a023cc06f5e251042dd5aaf432",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 105,
"avg_line_length": 25.068181818181817,
"alnum_prop": 0.5611967361740707,
"repo_name": "fuguevit/dashboard",
"id": "d54d142871576573553a82f7fdb12abde337ed04",
"size": "1103",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Components/GitHub/FetchGitHubFileContent.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "553"
},
{
"name": "HTML",
"bytes": "2163"
},
{
"name": "JavaScript",
"bytes": "2571"
},
{
"name": "PHP",
"bytes": "92208"
},
{
"name": "Vue",
"bytes": "14756"
}
],
"symlink_target": ""
} |
using NUnit.Framework.Internal;
namespace NUnit.Framework.Constraints
{
/// <summary>
/// StringConstraint is the abstract base for constraints
/// that operate on strings. It supports the IgnoreCase
/// modifier for string operations.
/// </summary>
public abstract class StringConstraint : Constraint
{
/// <summary>
/// The expected value
/// </summary>
#pragma warning disable IDE1006
// ReSharper disable once InconsistentNaming
// Disregarding naming convention for back-compat
protected string expected;
#pragma warning restore IDE1006
/// <summary>
/// Indicates whether tests should be case-insensitive
/// </summary>
#pragma warning disable IDE1006
// ReSharper disable once InconsistentNaming
// Disregarding naming convention for back-compat
protected bool caseInsensitive;
#pragma warning restore IDE1006
/// <summary>
/// Description of this constraint
/// </summary>
#pragma warning disable IDE1006
// ReSharper disable once InconsistentNaming
// Disregarding naming convention for back-compat
protected string descriptionText;
#pragma warning restore IDE1006
/// <summary>
/// The Description of what this constraint tests, for
/// use in messages and in the ConstraintResult.
/// </summary>
public override string Description
{
get
{
string desc = $"{descriptionText} {MsgUtils.FormatValue(expected)}";
if (caseInsensitive)
desc += ", ignoring case";
return desc;
}
}
/// <summary>
/// Constructs a StringConstraint without an expected value
/// </summary>
protected StringConstraint() { }
/// <summary>
/// Constructs a StringConstraint given an expected value
/// </summary>
/// <param name="expected">The expected value</param>
protected StringConstraint(string expected)
: base(expected)
{
this.expected = expected;
}
/// <summary>
/// Modify the constraint to ignore case in matching.
/// </summary>
public virtual StringConstraint IgnoreCase
{
get { caseInsensitive = true; return this; }
}
/// <summary>
/// Test whether the constraint is satisfied by a given value
/// </summary>
/// <param name="actual">The value to be tested</param>
/// <returns>True for success, false for failure</returns>
public override ConstraintResult ApplyTo<TActual>(TActual actual)
{
var stringValue = ConstraintUtils.RequireActual<string>(actual, nameof(actual), allowNull: true);
return new ConstraintResult(this, actual, Matches(stringValue));
}
/// <summary>
/// Test whether the constraint is satisfied by a given string
/// </summary>
/// <param name="actual">The string to be tested</param>
/// <returns>True for success, false for failure</returns>
protected abstract bool Matches(string actual);
}
}
| {
"content_hash": "f135a89390181685277df6279216ee0d",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 109,
"avg_line_length": 34.03125,
"alnum_prop": 0.6026936026936027,
"repo_name": "nunit/nunit",
"id": "ba89b3277a49f5c9b88bc28fdd138b59cfea0a2d",
"size": "3359",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/NUnitFramework/framework/Constraints/StringConstraint.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "48"
},
{
"name": "C#",
"bytes": "3788586"
},
{
"name": "F#",
"bytes": "1295"
},
{
"name": "PowerShell",
"bytes": "319"
},
{
"name": "Shell",
"bytes": "258"
}
],
"symlink_target": ""
} |
title: GetMatricesFromBundle
category: moduledocs
module:
category: Bundle
package: SCIRun
tags: module
---
# {{ page.title }}
## Category
**{{ page.module.category }}**
## Description
### Summary
This module retrieves a **matrix** object from a bundle.
**Detailed Description**
This module retrieves a **matrix** object from a bundle by specifying the name under which the obect is stored in the bundle. The module has three output ports that each can be programmed to retrieve a specific **matrix** object.
There are two ways of specifying the name of the **matrix** object. Firstly one can enter the name of the object in the entry box on top of the menu, secondly one can execute the module, in which case a list of all objects of the **matrix** is generated. By selecting the one that one wants on the output port the obect can be retrieved from the bundle.
The first bundle output port generates a copy of the input bundle and can be used to attach a second module that retrieves data from the bundle.
{% capture url %}{% include url.md %}{% endcapture %}
{{ url }}
| {
"content_hash": "953725d57c83c2a1d615b2c9419541ce",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 353,
"avg_line_length": 35.096774193548384,
"alnum_prop": 0.7426470588235294,
"repo_name": "collint8/SCIRun",
"id": "b71fc43aa322bf1663f122b738afa226b2cbb481",
"size": "1092",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/_includes/modules/GetMatricesFromBundle.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "13240423"
},
{
"name": "C++",
"bytes": "29987282"
},
{
"name": "CMake",
"bytes": "780445"
},
{
"name": "CSS",
"bytes": "5578"
},
{
"name": "Cuda",
"bytes": "131738"
},
{
"name": "DIGITAL Command Language",
"bytes": "8092"
},
{
"name": "Fortran",
"bytes": "1326303"
},
{
"name": "GLSL",
"bytes": "58737"
},
{
"name": "HTML",
"bytes": "29427"
},
{
"name": "JavaScript",
"bytes": "36777"
},
{
"name": "M4",
"bytes": "85976"
},
{
"name": "Makefile",
"bytes": "637928"
},
{
"name": "Mercury",
"bytes": "347"
},
{
"name": "Objective-C",
"bytes": "109973"
},
{
"name": "Perl",
"bytes": "7210"
},
{
"name": "Perl 6",
"bytes": "2651"
},
{
"name": "Python",
"bytes": "429910"
},
{
"name": "Roff",
"bytes": "2817"
},
{
"name": "Shell",
"bytes": "1228236"
},
{
"name": "XSLT",
"bytes": "14273"
}
],
"symlink_target": ""
} |
package com.graphhopper;
import com.bedatadriven.jackson.datatype.jts.JtsModule;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.graphhopper.config.CHProfile;
import com.graphhopper.config.LMProfile;
import com.graphhopper.config.Profile;
import com.graphhopper.reader.dem.*;
import com.graphhopper.reader.osm.OSMReader;
import com.graphhopper.reader.osm.conditional.DateRangeParser;
import com.graphhopper.routing.*;
import com.graphhopper.routing.ch.CHPreparationHandler;
import com.graphhopper.routing.ch.PrepareContractionHierarchies;
import com.graphhopper.routing.ev.*;
import com.graphhopper.routing.lm.LMConfig;
import com.graphhopper.routing.lm.LMPreparationHandler;
import com.graphhopper.routing.lm.LandmarkStorage;
import com.graphhopper.routing.lm.PrepareLandmarks;
import com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks;
import com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks.PrepareJob;
import com.graphhopper.routing.util.*;
import com.graphhopper.routing.util.countryrules.CountryRuleFactory;
import com.graphhopper.routing.util.parsers.DefaultTagParserFactory;
import com.graphhopper.routing.util.parsers.TagParserFactory;
import com.graphhopper.routing.weighting.Weighting;
import com.graphhopper.routing.weighting.custom.CustomProfile;
import com.graphhopper.routing.weighting.custom.CustomWeighting;
import com.graphhopper.storage.*;
import com.graphhopper.storage.index.LocationIndex;
import com.graphhopper.storage.index.LocationIndexTree;
import com.graphhopper.util.*;
import com.graphhopper.util.Parameters.Landmark;
import com.graphhopper.util.Parameters.Routing;
import com.graphhopper.util.details.PathDetailsBuilderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.DateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.graphhopper.util.GHUtility.readCountries;
import static com.graphhopper.util.Helper.*;
import static com.graphhopper.util.Parameters.Algorithms.RoundTrip;
/**
* Easy to use access point to configure import and (offline) routing.
*
* @author Peter Karich
*/
public class GraphHopper {
private static final Logger logger = LoggerFactory.getLogger(GraphHopper.class);
private final Map<String, Profile> profilesByName = new LinkedHashMap<>();
private final String fileLockName = "gh.lock";
// utils
private final TranslationMap trMap = new TranslationMap().doImport();
boolean removeZipped = true;
// for country rules:
private CountryRuleFactory countryRuleFactory = null;
// for custom areas:
private String customAreasDirectory = "";
// for graph:
private GraphHopperStorage ghStorage;
private TagParserManager tagParserManager;
private int defaultSegmentSize = -1;
private String ghLocation = "";
private DAType dataAccessDefaultType = DAType.RAM_STORE;
private final LinkedHashMap<String, String> dataAccessConfig = new LinkedHashMap<>();
private boolean sortGraph = false;
private boolean elevation = false;
private LockFactory lockFactory = new NativeFSLockFactory();
private boolean allowWrites = true;
private boolean fullyLoaded = false;
private final OSMReaderConfig osmReaderConfig = new OSMReaderConfig();
// for routing
private final RouterConfig routerConfig = new RouterConfig();
// for index
private LocationIndex locationIndex;
private int preciseIndexResolution = 300;
private int maxRegionSearch = 4;
// for prepare
private int minNetworkSize = 200;
// preparation handlers
private final LMPreparationHandler lmPreparationHandler = new LMPreparationHandler();
private final CHPreparationHandler chPreparationHandler = new CHPreparationHandler();
private Map<String, RoutingCHGraph> chGraphs = Collections.emptyMap();
private Map<String, LandmarkStorage> landmarks = Collections.emptyMap();
// for data reader
private String osmFile;
private ElevationProvider eleProvider = ElevationProvider.NOOP;
private FlagEncoderFactory flagEncoderFactory = new DefaultFlagEncoderFactory();
private EncodedValueFactory encodedValueFactory = new DefaultEncodedValueFactory();
private TagParserFactory tagParserFactory = new DefaultTagParserFactory();
private PathDetailsBuilderFactory pathBuilderFactory = new PathDetailsBuilderFactory();
private String dateRangeParserString = "";
private String encodedValuesString = "";
private String flagEncodersString = "";
public GraphHopper setEncodedValuesString(String encodedValuesString) {
this.encodedValuesString = encodedValuesString;
return this;
}
public GraphHopper setFlagEncodersString(String flagEncodersString) {
this.flagEncodersString = flagEncodersString;
return this;
}
public TagParserManager getTagParserManager() {
if (tagParserManager == null)
throw new IllegalStateException("TagParserManager not yet built");
return tagParserManager;
}
public EncodingManager getEncodingManager() {
return getTagParserManager().getEncodingManager();
}
public ElevationProvider getElevationProvider() {
return eleProvider;
}
public GraphHopper setElevationProvider(ElevationProvider eleProvider) {
if (eleProvider == null || eleProvider == ElevationProvider.NOOP)
setElevation(false);
else
setElevation(true);
this.eleProvider = eleProvider;
return this;
}
public GraphHopper setPathDetailsBuilderFactory(PathDetailsBuilderFactory pathBuilderFactory) {
this.pathBuilderFactory = pathBuilderFactory;
return this;
}
public PathDetailsBuilderFactory getPathDetailsBuilderFactory() {
return pathBuilderFactory;
}
/**
* Precise location resolution index means also more space (disc/RAM) could be consumed and
* probably slower query times, which would be e.g. not suitable for Android. The resolution
* specifies the tile width (in meter).
*/
public GraphHopper setPreciseIndexResolution(int precision) {
ensureNotLoaded();
preciseIndexResolution = precision;
return this;
}
public GraphHopper setMinNetworkSize(int minNetworkSize) {
ensureNotLoaded();
this.minNetworkSize = minNetworkSize;
return this;
}
/**
* Only valid option for in-memory graph and if you e.g. want to disable store on flush for unit
* tests. Specify storeOnFlush to true if you want that existing data will be loaded FROM disc
* and all in-memory data will be flushed TO disc after flush is called e.g. while OSM import.
*
* @param storeOnFlush true by default
*/
public GraphHopper setStoreOnFlush(boolean storeOnFlush) {
ensureNotLoaded();
if (storeOnFlush)
dataAccessDefaultType = DAType.RAM_STORE;
else
dataAccessDefaultType = DAType.RAM;
return this;
}
/**
* Sets the routing profiles that shall be supported by this GraphHopper instance. The (and only the) given profiles
* can be used for routing without preparation and for CH/LM preparation.
* <p>
* Here is an example how to setup two CH profiles and one LM profile (via the Java API)
*
* <pre>
* {@code
* hopper.setProfiles(
* new Profile("my_car").setVehicle("car").setWeighting("shortest"),
* new Profile("your_bike").setVehicle("bike").setWeighting("fastest")
* );
* hopper.getCHPreparationHandler().setCHProfiles(
* new CHProfile("my_car"),
* new CHProfile("your_bike")
* );
* hopper.getLMPreparationHandler().setLMProfiles(
* new LMProfile("your_bike")
* );
* }
* </pre>
* <p>
* See also https://github.com/graphhopper/graphhopper/pull/1922.
*
* @see CHPreparationHandler#setCHProfiles
* @see LMPreparationHandler#setLMProfiles
*/
public GraphHopper setProfiles(Profile... profiles) {
return setProfiles(Arrays.asList(profiles));
}
public GraphHopper setProfiles(List<Profile> profiles) {
if (!profilesByName.isEmpty())
throw new IllegalArgumentException("Cannot initialize profiles multiple times");
if (tagParserManager != null)
throw new IllegalArgumentException("Cannot set profiles after TagParserManager was built");
for (Profile profile : profiles) {
Profile previous = this.profilesByName.put(profile.getName(), profile);
if (previous != null)
throw new IllegalArgumentException("Profile names must be unique. Duplicate name: '" + profile.getName() + "'");
}
return this;
}
public List<Profile> getProfiles() {
return new ArrayList<>(profilesByName.values());
}
/**
* Returns the profile for the given profile name, or null if it does not exist
*/
public Profile getProfile(String profileName) {
return profilesByName.get(profileName);
}
/**
* @return true if storing and fetching elevation data is enabled. Default is false
*/
public boolean hasElevation() {
return elevation;
}
/**
* Enable storing and fetching elevation data. Default is false
*/
public GraphHopper setElevation(boolean includeElevation) {
this.elevation = includeElevation;
return this;
}
public String getGraphHopperLocation() {
return ghLocation;
}
/**
* Sets the graphhopper folder.
*/
public GraphHopper setGraphHopperLocation(String ghLocation) {
ensureNotLoaded();
if (ghLocation == null)
throw new IllegalArgumentException("graphhopper location cannot be null");
this.ghLocation = ghLocation;
return this;
}
public String getOSMFile() {
return osmFile;
}
/**
* This file can be an osm xml (.osm), a compressed xml (.osm.zip or .osm.gz) or a protobuf file
* (.pbf).
*/
public GraphHopper setOSMFile(String osmFile) {
ensureNotLoaded();
if (isEmpty(osmFile))
throw new IllegalArgumentException("OSM file cannot be empty.");
this.osmFile = osmFile;
return this;
}
/**
* The underlying graph used in algorithms.
*
* @throws IllegalStateException if graph is not instantiated.
*/
public GraphHopperStorage getGraphHopperStorage() {
if (ghStorage == null)
throw new IllegalStateException("GraphHopper storage not initialized");
return ghStorage;
}
public void setGraphHopperStorage(GraphHopperStorage ghStorage) {
this.ghStorage = ghStorage;
setFullyLoaded();
}
/**
* @return a mapping between profile names and according CH preparations. The map will be empty before loading
* or import.
*/
public Map<String, RoutingCHGraph> getCHGraphs() {
return chGraphs;
}
/**
* @return a mapping between profile names and according landmark preparations. The map will be empty before loading
* or import.
*/
public Map<String, LandmarkStorage> getLandmarks() {
return landmarks;
}
/**
* The location index created from the graph.
*
* @throws IllegalStateException if index is not initialized
*/
public LocationIndex getLocationIndex() {
if (locationIndex == null)
throw new IllegalStateException("LocationIndex not initialized");
return locationIndex;
}
protected void setLocationIndex(LocationIndex locationIndex) {
this.locationIndex = locationIndex;
}
/**
* Sorts the graph which requires more RAM while import. See #12
*/
public GraphHopper setSortGraph(boolean sortGraph) {
ensureNotLoaded();
this.sortGraph = sortGraph;
return this;
}
public boolean isAllowWrites() {
return allowWrites;
}
/**
* Specifies if it is allowed for GraphHopper to write. E.g. for read only filesystems it is not
* possible to create a lock file and so we can avoid write locks.
*/
public GraphHopper setAllowWrites(boolean allowWrites) {
this.allowWrites = allowWrites;
return this;
}
public TranslationMap getTranslationMap() {
return trMap;
}
public GraphHopper setFlagEncoderFactory(FlagEncoderFactory factory) {
this.flagEncoderFactory = factory;
return this;
}
public EncodedValueFactory getEncodedValueFactory() {
return this.encodedValueFactory;
}
public GraphHopper setEncodedValueFactory(EncodedValueFactory factory) {
this.encodedValueFactory = factory;
return this;
}
public TagParserFactory getTagParserFactory() {
return this.tagParserFactory;
}
public GraphHopper setTagParserFactory(TagParserFactory factory) {
this.tagParserFactory = factory;
return this;
}
public GraphHopper setCustomAreasDirectory(String customAreasDirectory) {
this.customAreasDirectory = customAreasDirectory;
return this;
}
public String getCustomAreasDirectory() {
return this.customAreasDirectory;
}
/**
* Sets the factory used to create country rules. Use `null` to disable country rules
*/
public GraphHopper setCountryRuleFactory(CountryRuleFactory countryRuleFactory) {
this.countryRuleFactory = countryRuleFactory;
return this;
}
public CountryRuleFactory getCountryRuleFactory() {
return this.countryRuleFactory;
}
/**
* Reads the configuration from a {@link GraphHopperConfig} object which can be manually filled, or more typically
* is read from `config.yml`.
*/
public GraphHopper init(GraphHopperConfig ghConfig) {
ensureNotLoaded();
// disabling_allowed config options were removed for GH 3.0
if (ghConfig.has("routing.ch.disabling_allowed"))
throw new IllegalArgumentException("The 'routing.ch.disabling_allowed' configuration option is no longer supported");
if (ghConfig.has("routing.lm.disabling_allowed"))
throw new IllegalArgumentException("The 'routing.lm.disabling_allowed' configuration option is no longer supported");
if (ghConfig.has("osmreader.osm"))
throw new IllegalArgumentException("Instead of osmreader.osm use datareader.file, for other changes see CHANGELOG.md");
String tmpOsmFile = ghConfig.getString("datareader.file", "");
if (!isEmpty(tmpOsmFile))
osmFile = tmpOsmFile;
String graphHopperFolder = ghConfig.getString("graph.location", "");
if (isEmpty(graphHopperFolder) && isEmpty(ghLocation)) {
if (isEmpty(osmFile))
throw new IllegalArgumentException("If no graph.location is provided you need to specify an OSM file.");
graphHopperFolder = pruneFileEnd(osmFile) + "-gh";
}
ghLocation = graphHopperFolder;
countryRuleFactory = ghConfig.getBool("country_rules.enabled", false) ? new CountryRuleFactory() : null;
customAreasDirectory = ghConfig.getString("custom_areas.directory", customAreasDirectory);
defaultSegmentSize = ghConfig.getInt("graph.dataaccess.segment_size", defaultSegmentSize);
String daTypeString = ghConfig.getString("graph.dataaccess.default_type", ghConfig.getString("graph.dataaccess", "RAM_STORE"));
dataAccessDefaultType = DAType.fromString(daTypeString);
for (Map.Entry<String, Object> entry : ghConfig.asPMap().toMap().entrySet()) {
if (entry.getKey().startsWith("graph.dataaccess.type."))
dataAccessConfig.put(entry.getKey().substring("graph.dataaccess.type.".length()), entry.getValue().toString());
if (entry.getKey().startsWith("graph.dataaccess.mmap.preload."))
dataAccessConfig.put(entry.getKey().substring("graph.dataaccess.mmap.".length()), entry.getValue().toString());
}
sortGraph = ghConfig.getBool("graph.do_sort", sortGraph);
removeZipped = ghConfig.getBool("graph.remove_zipped", removeZipped);
if (!ghConfig.getString("spatial_rules.location", "").isEmpty())
throw new IllegalArgumentException("spatial_rules.location has been deprecated. Please use custom_areas.directory instead and read the documentation for custom areas.");
if (!ghConfig.getString("spatial_rules.borders_directory", "").isEmpty())
throw new IllegalArgumentException("spatial_rules.borders_directory has been deprecated. Please use custom_areas.directory instead and read the documentation for custom areas.");
// todo: maybe introduce custom_areas.max_bbox if this is needed later
if (!ghConfig.getString("spatial_rules.max_bbox", "").isEmpty())
throw new IllegalArgumentException("spatial_rules.max_bbox has been deprecated. There is no replacement, all custom areas will be considered.");
if (tagParserManager != null)
throw new IllegalStateException("Cannot call init twice. TagParserManager was already initialized.");
setProfiles(ghConfig.getProfiles());
String flagEncodersStr = ghConfig.getString("graph.flag_encoders", flagEncodersString);
String encodedValueStr = ghConfig.getString("graph.encoded_values", encodedValuesString);
String dateRangeParserStr = ghConfig.getString("datareader.date_range_parser_day", dateRangeParserString);
tagParserManager = buildTagParserManager(flagEncodersStr, encodedValueStr, dateRangeParserStr, profilesByName.values());
if (ghConfig.getString("graph.locktype", "native").equals("simple"))
lockFactory = new SimpleFSLockFactory();
else
lockFactory = new NativeFSLockFactory();
// elevation
osmReaderConfig.setSmoothElevation(ghConfig.getBool("graph.elevation.smoothing", osmReaderConfig.isSmoothElevation()));
osmReaderConfig.setLongEdgeSamplingDistance(ghConfig.getDouble("graph.elevation.long_edge_sampling_distance", osmReaderConfig.getLongEdgeSamplingDistance()));
osmReaderConfig.setElevationMaxWayPointDistance(ghConfig.getDouble("graph.elevation.way_point_max_distance", osmReaderConfig.getElevationMaxWayPointDistance()));
routerConfig.setElevationWayPointMaxDistance(ghConfig.getDouble("graph.elevation.way_point_max_distance", routerConfig.getElevationWayPointMaxDistance()));
ElevationProvider elevationProvider = createElevationProvider(ghConfig);
setElevationProvider(elevationProvider);
if (osmReaderConfig.getLongEdgeSamplingDistance() < Double.MAX_VALUE && !elevationProvider.canInterpolate())
logger.warn("Long edge sampling enabled, but bilinear interpolation disabled. See #1953");
// optimizable prepare
minNetworkSize = ghConfig.getInt("prepare.min_network_size", minNetworkSize);
// prepare CH&LM
chPreparationHandler.init(ghConfig);
lmPreparationHandler.init(ghConfig);
// osm import
osmReaderConfig.setParseWayNames(ghConfig.getBool("datareader.instructions", osmReaderConfig.isParseWayNames()));
osmReaderConfig.setPreferredLanguage(ghConfig.getString("datareader.preferred_language", osmReaderConfig.getPreferredLanguage()));
osmReaderConfig.setMaxWayPointDistance(ghConfig.getDouble(Routing.INIT_WAY_POINT_MAX_DISTANCE, osmReaderConfig.getMaxWayPointDistance()));
osmReaderConfig.setWorkerThreads(ghConfig.getInt("datareader.worker_threads", osmReaderConfig.getWorkerThreads()));
// index
preciseIndexResolution = ghConfig.getInt("index.high_resolution", preciseIndexResolution);
maxRegionSearch = ghConfig.getInt("index.max_region_search", maxRegionSearch);
// routing
routerConfig.setMaxVisitedNodes(ghConfig.getInt(Routing.INIT_MAX_VISITED_NODES, routerConfig.getMaxVisitedNodes()));
routerConfig.setMaxRoundTripRetries(ghConfig.getInt(RoundTrip.INIT_MAX_RETRIES, routerConfig.getMaxRoundTripRetries()));
routerConfig.setNonChMaxWaypointDistance(ghConfig.getInt(Parameters.NON_CH.MAX_NON_CH_POINT_DISTANCE, routerConfig.getNonChMaxWaypointDistance()));
routerConfig.setInstructionsEnabled(ghConfig.getBool(Routing.INIT_INSTRUCTIONS, routerConfig.isInstructionsEnabled()));
int activeLandmarkCount = ghConfig.getInt(Landmark.ACTIVE_COUNT_DEFAULT, Math.min(8, lmPreparationHandler.getLandmarks()));
if (activeLandmarkCount > lmPreparationHandler.getLandmarks())
throw new IllegalArgumentException("Default value for active landmarks " + activeLandmarkCount
+ " should be less or equal to landmark count of " + lmPreparationHandler.getLandmarks());
routerConfig.setActiveLandmarkCount(activeLandmarkCount);
return this;
}
private TagParserManager buildTagParserManager(String flagEncodersStr, String encodedValueStr, String dateRangeParserStr, Collection<Profile> profiles) {
TagParserManager.Builder emBuilder = new TagParserManager.Builder();
emBuilder.setDateRangeParser(DateRangeParser.createInstance(dateRangeParserStr));
Map<String, String> flagEncoderMap = new LinkedHashMap<>();
for (String encoderStr : flagEncodersStr.split(",")) {
String key = encoderStr.split("\\|")[0];
if (!key.isEmpty()) {
if (flagEncoderMap.containsKey(key))
throw new IllegalArgumentException("FlagEncoder " + key + " needs to be unique");
flagEncoderMap.put(key, encoderStr);
}
}
Map<String, String> implicitFlagEncoderMap = new LinkedHashMap<>();
for (Profile profile : profiles) {
emBuilder.add(Subnetwork.create(profile.getName()));
if (!flagEncoderMap.containsKey(profile.getVehicle())
// overwrite key in implicit map if turn cost support required
&& (!implicitFlagEncoderMap.containsKey(profile.getVehicle()) || profile.isTurnCosts()))
implicitFlagEncoderMap.put(profile.getVehicle(), profile.getVehicle() + (profile.isTurnCosts() ? "|turn_costs=true" : ""));
}
flagEncoderMap.putAll(implicitFlagEncoderMap);
flagEncoderMap.values().forEach(s -> emBuilder.addIfAbsent(flagEncoderFactory, s));
for (String tpStr : encodedValueStr.split(",")) {
if (!tpStr.isEmpty()) emBuilder.addIfAbsent(encodedValueFactory, tagParserFactory, tpStr);
}
return emBuilder.build();
}
private static ElevationProvider createElevationProvider(GraphHopperConfig ghConfig) {
String eleProviderStr = toLowerCase(ghConfig.getString("graph.elevation.provider", "noop"));
if (ghConfig.has("graph.elevation.calcmean"))
throw new IllegalArgumentException("graph.elevation.calcmean is deprecated, use graph.elevation.interpolate");
String cacheDirStr = ghConfig.getString("graph.elevation.cache_dir", "");
if (cacheDirStr.isEmpty() && ghConfig.has("graph.elevation.cachedir"))
throw new IllegalArgumentException("use graph.elevation.cache_dir not cachedir in configuration");
ElevationProvider elevationProvider = ElevationProvider.NOOP;
if (eleProviderStr.equalsIgnoreCase("srtm")) {
elevationProvider = new SRTMProvider(cacheDirStr);
} else if (eleProviderStr.equalsIgnoreCase("cgiar")) {
elevationProvider = new CGIARProvider(cacheDirStr);
} else if (eleProviderStr.equalsIgnoreCase("gmted")) {
elevationProvider = new GMTEDProvider(cacheDirStr);
} else if (eleProviderStr.equalsIgnoreCase("srtmgl1")) {
elevationProvider = new SRTMGL1Provider(cacheDirStr);
} else if (eleProviderStr.equalsIgnoreCase("multi")) {
elevationProvider = new MultiSourceElevationProvider(cacheDirStr);
} else if (eleProviderStr.equalsIgnoreCase("skadi")) {
elevationProvider = new SkadiProvider(cacheDirStr);
}
if (elevationProvider instanceof TileBasedElevationProvider) {
TileBasedElevationProvider provider = (TileBasedElevationProvider) elevationProvider;
String baseURL = ghConfig.getString("graph.elevation.base_url", "");
if (baseURL.isEmpty() && ghConfig.has("graph.elevation.baseurl"))
throw new IllegalArgumentException("use graph.elevation.base_url not baseurl in configuration");
DAType elevationDAType = DAType.fromString(ghConfig.getString("graph.elevation.dataaccess", "MMAP"));
boolean interpolate = ghConfig.has("graph.elevation.interpolate")
? "bilinear".equals(ghConfig.getString("graph.elevation.interpolate", "none"))
: ghConfig.getBool("graph.elevation.calc_mean", false);
boolean removeTempElevationFiles = ghConfig.getBool("graph.elevation.cgiar.clear", true);
removeTempElevationFiles = ghConfig.getBool("graph.elevation.clear", removeTempElevationFiles);
provider
.setAutoRemoveTemporaryFiles(removeTempElevationFiles)
.setInterpolate(interpolate)
.setDAType(elevationDAType);
if (!baseURL.isEmpty())
provider.setBaseURL(baseURL);
}
return elevationProvider;
}
private void printInfo() {
logger.info("version " + Constants.VERSION + "|" + Constants.BUILD_DATE + " (" + Constants.getVersions() + ")");
if (ghStorage != null)
logger.info("graph " + ghStorage.toString() + ", details:" + ghStorage.toDetailsString());
}
/**
* Imports provided data from disc and creates graph. Depending on the settings the resulting
* graph will be stored to disc so on a second call this method will only load the graph from
* disc which is usually a lot faster.
*/
public GraphHopper importOrLoad() {
if (!load()) {
printInfo();
process(false);
} else {
printInfo();
}
return this;
}
/**
* Imports and processes data, storing it to disk when complete.
*/
public void importAndClose() {
if (!load()) {
printInfo();
process(true);
} else {
printInfo();
logger.info("Graph already imported into " + ghLocation);
}
close();
}
/**
* Creates the graph from OSM data.
*/
private void process(boolean closeEarly) {
GHLock lock = null;
try {
if (ghStorage == null)
throw new IllegalStateException("GraphHopperStorage must be initialized before starting the import");
if (ghStorage.getDirectory().getDefaultType().isStoring()) {
lockFactory.setLockDir(new File(ghLocation));
lock = lockFactory.create(fileLockName, true);
if (!lock.tryLock())
throw new RuntimeException("To avoid multiple writers we need to obtain a write lock but it failed. In " + ghLocation, lock.getObtainFailedReason());
}
ensureWriteAccess();
importOSM();
cleanUp();
postImport();
postProcessing(closeEarly);
flush();
} finally {
if (lock != null)
lock.release();
}
}
protected void postImport() {
if (sortGraph) {
GraphHopperStorage newGraph = GHUtility.newStorage(ghStorage);
GHUtility.sortDFS(ghStorage, newGraph);
logger.info("graph sorted (" + getMemInfo() + ")");
ghStorage = newGraph;
}
if (hasElevation())
interpolateBridgesTunnelsAndFerries();
}
protected void importOSM() {
if (osmFile == null)
throw new IllegalStateException("Couldn't load from existing folder: " + ghLocation
+ " but also cannot use file for DataReader as it wasn't specified!");
List<CustomArea> customAreas = readCountries();
if (isEmpty(customAreasDirectory)) {
logger.info("No custom areas are used, custom_areas.directory not given");
} else {
logger.info("Creating custom area index, reading custom areas from: '" + customAreasDirectory + "'");
customAreas.addAll(readCustomAreas());
}
AreaIndex<CustomArea> areaIndex = new AreaIndex<>(customAreas);
logger.info("start creating graph from " + osmFile);
OSMReader reader = new OSMReader(ghStorage.getBaseGraph(), tagParserManager, osmReaderConfig).setFile(_getOSMFile()).
setAreaIndex(areaIndex).
setElevationProvider(eleProvider).
setCountryRuleFactory(countryRuleFactory);
logger.info("using " + ghStorage.toString() + ", memory:" + getMemInfo());
ghStorage.create(100);
try {
reader.readGraph();
} catch (IOException ex) {
throw new RuntimeException("Cannot read file " + getOSMFile(), ex);
}
DateFormat f = createFormatter();
ghStorage.getProperties().put("datareader.import.date", f.format(new Date()));
if (reader.getDataDate() != null)
ghStorage.getProperties().put("datareader.data.date", f.format(reader.getDataDate()));
}
private List<CustomArea> readCustomAreas() {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JtsModule());
final Path bordersDirectory = Paths.get(customAreasDirectory);
List<JsonFeatureCollection> jsonFeatureCollections = new ArrayList<>();
try (DirectoryStream<Path> stream = Files.newDirectoryStream(bordersDirectory, "*.{geojson,json}")) {
for (Path borderFile : stream) {
try (BufferedReader reader = Files.newBufferedReader(borderFile, StandardCharsets.UTF_8)) {
JsonFeatureCollection jsonFeatureCollection = objectMapper.readValue(reader, JsonFeatureCollection.class);
jsonFeatureCollections.add(jsonFeatureCollection);
}
}
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return jsonFeatureCollections.stream().flatMap(j -> j.getFeatures().stream())
.map(CustomArea::fromJsonFeature)
.collect(Collectors.toList());
}
/**
* Currently we use this for a few tests where the dataReaderFile is loaded from the classpath
*/
protected File _getOSMFile() {
return new File(osmFile);
}
/**
* Load from existing graph folder.
*/
public boolean load() {
if (isEmpty(ghLocation))
throw new IllegalStateException("GraphHopperLocation is not specified. Call setGraphHopperLocation or init before");
if (fullyLoaded)
throw new IllegalStateException("graph is already successfully loaded");
File tmpFileOrFolder = new File(ghLocation);
if (!tmpFileOrFolder.isDirectory() && tmpFileOrFolder.exists()) {
throw new IllegalArgumentException("GraphHopperLocation cannot be an existing file. Has to be either non-existing or a folder.");
} else {
File compressed = new File(ghLocation + ".ghz");
if (compressed.exists() && !compressed.isDirectory()) {
try {
new Unzipper().unzip(compressed.getAbsolutePath(), ghLocation, removeZipped);
} catch (IOException ex) {
throw new RuntimeException("Couldn't extract file " + compressed.getAbsolutePath()
+ " to " + ghLocation, ex);
}
}
}
if (!allowWrites && dataAccessDefaultType.isMMap())
dataAccessDefaultType = DAType.MMAP_RO;
if (tagParserManager == null)
// we did not call init(), so we build the tag parser manager based on the changes made to emBuilder
// and the current profiles.
// just like when calling init, users have to make sure they use the same setup for import and load
tagParserManager = buildTagParserManager(flagEncodersString, encodedValuesString, dateRangeParserString, profilesByName.values());
GHDirectory directory = new GHDirectory(ghLocation, dataAccessDefaultType);
directory.configure(dataAccessConfig);
ghStorage = new GraphBuilder(getEncodingManager())
.setDir(directory)
.set3D(hasElevation())
.withTurnCosts(tagParserManager.needsTurnCostsSupport())
.setSegmentSize(defaultSegmentSize)
.build();
checkProfilesConsistency();
if (!new File(ghLocation).exists())
return false;
GHLock lock = null;
try {
// create locks only if writes are allowed, if they are not allowed a lock cannot be created
// (e.g. on a read only filesystem locks would fail)
if (ghStorage.getDirectory().getDefaultType().isStoring() && isAllowWrites()) {
lockFactory.setLockDir(new File(ghLocation));
lock = lockFactory.create(fileLockName, false);
if (!lock.tryLock())
throw new RuntimeException("To avoid reading partial data we need to obtain the read lock but it failed. In " + ghLocation, lock.getObtainFailedReason());
}
if (!ghStorage.loadExisting())
return false;
String storedProfiles = ghStorage.getProperties().get("profiles");
String configuredProfiles = getProfilesString();
if (!storedProfiles.equals(configuredProfiles))
throw new IllegalStateException("Profiles do not match:"
+ "\nGraphhopper config: " + configuredProfiles
+ "\nGraph: " + storedProfiles
+ "\nChange configuration to match the graph or delete " + ghStorage.getDirectory().getLocation());
postProcessing(false);
directory.loadMMap();
setFullyLoaded();
return true;
} finally {
if (lock != null)
lock.release();
}
}
private String getProfilesString() {
return profilesByName.values().stream().map(p -> p.getName() + "|" + p.getVersion()).collect(Collectors.joining(","));
}
private void checkProfilesConsistency() {
if (profilesByName.isEmpty())
throw new IllegalArgumentException("There has to be at least one profile");
EncodingManager encodingManager = getEncodingManager();
for (Profile profile : profilesByName.values()) {
if (!encodingManager.hasEncoder(profile.getVehicle())) {
throw new IllegalArgumentException("Unknown vehicle '" + profile.getVehicle() + "' in profile: " + profile + ". Make sure all vehicles used in 'profiles' exist in 'graph.flag_encoders'");
}
FlagEncoder encoder = encodingManager.getEncoder(profile.getVehicle());
if (profile.isTurnCosts() && !encoder.supportsTurnCosts()) {
throw new IllegalArgumentException("The profile '" + profile.getName() + "' was configured with " +
"'turn_costs=true', but the corresponding vehicle '" + profile.getVehicle() + "' does not support turn costs." +
"\nYou need to add `|turn_costs=true` to the vehicle in `graph.flag_encoders`");
}
try {
createWeighting(profile, new PMap());
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Could not create weighting for profile: '" + profile.getName() + "'.\n" +
"Profile: " + profile + "\n" +
"Error: " + e.getMessage());
}
if (profile instanceof CustomProfile) {
CustomModel customModel = ((CustomProfile) profile).getCustomModel();
if (customModel == null)
throw new IllegalArgumentException("custom model for profile '" + profile.getName() + "' was empty");
if (!CustomWeighting.NAME.equals(profile.getWeighting()))
throw new IllegalArgumentException("profile '" + profile.getName() + "' has a custom model but " +
"weighting=" + profile.getWeighting() + " was defined");
}
}
Set<String> chProfileSet = new LinkedHashSet<>(chPreparationHandler.getCHProfiles().size());
for (CHProfile chProfile : chPreparationHandler.getCHProfiles()) {
boolean added = chProfileSet.add(chProfile.getProfile());
if (!added) {
throw new IllegalArgumentException("Duplicate CH reference to profile '" + chProfile.getProfile() + "'");
}
if (!profilesByName.containsKey(chProfile.getProfile())) {
throw new IllegalArgumentException("CH profile references unknown profile '" + chProfile.getProfile() + "'");
}
}
Map<String, LMProfile> lmProfileMap = new LinkedHashMap<>(lmPreparationHandler.getLMProfiles().size());
for (LMProfile lmProfile : lmPreparationHandler.getLMProfiles()) {
LMProfile previous = lmProfileMap.put(lmProfile.getProfile(), lmProfile);
if (previous != null) {
throw new IllegalArgumentException("Multiple LM profiles are using the same profile '" + lmProfile.getProfile() + "'");
}
if (!profilesByName.containsKey(lmProfile.getProfile())) {
throw new IllegalArgumentException("LM profile references unknown profile '" + lmProfile.getProfile() + "'");
}
if (lmProfile.usesOtherPreparation() && !profilesByName.containsKey(lmProfile.getPreparationProfile())) {
throw new IllegalArgumentException("LM profile references unknown preparation profile '" + lmProfile.getPreparationProfile() + "'");
}
}
for (LMProfile lmProfile : lmPreparationHandler.getLMProfiles()) {
if (lmProfile.usesOtherPreparation() && !lmProfileMap.containsKey(lmProfile.getPreparationProfile())) {
throw new IllegalArgumentException("Unknown LM preparation profile '" + lmProfile.getPreparationProfile() + "' in LM profile '" + lmProfile.getProfile() + "' cannot be used as preparation_profile");
}
if (lmProfile.usesOtherPreparation() && lmProfileMap.get(lmProfile.getPreparationProfile()).usesOtherPreparation()) {
throw new IllegalArgumentException("Cannot use '" + lmProfile.getPreparationProfile() + "' as preparation_profile for LM profile '" + lmProfile.getProfile() + "', because it uses another profile for preparation itself.");
}
}
}
public final CHPreparationHandler getCHPreparationHandler() {
return chPreparationHandler;
}
private List<CHConfig> createCHConfigs(List<CHProfile> chProfiles) {
List<CHConfig> chConfigs = new ArrayList<>();
for (CHProfile chProfile : chProfiles) {
Profile profile = profilesByName.get(chProfile.getProfile());
if (profile.isTurnCosts()) {
chConfigs.add(CHConfig.edgeBased(profile.getName(), createWeighting(profile, new PMap())));
} else {
chConfigs.add(CHConfig.nodeBased(profile.getName(), createWeighting(profile, new PMap())));
}
}
return chConfigs;
}
public final LMPreparationHandler getLMPreparationHandler() {
return lmPreparationHandler;
}
private List<LMConfig> createLMConfigs(List<LMProfile> lmProfiles) {
List<LMConfig> lmConfigs = new ArrayList<>();
for (LMProfile lmProfile : lmProfiles) {
if (lmProfile.usesOtherPreparation())
continue;
Profile profile = profilesByName.get(lmProfile.getProfile());
// Note that we have to make sure the weighting used for LM preparation does not include turn costs, because
// the LM preparation is running node-based and the landmark weights will be wrong if there are non-zero
// turn costs, see discussion in #1960
// Running the preparation without turn costs is also useful to allow e.g. changing the u_turn_costs per
// request (we have to use the minimum weight settings (= no turn costs) for the preparation)
Weighting weighting = createWeighting(profile, new PMap(), true);
lmConfigs.add(new LMConfig(profile.getName(), weighting));
}
return lmConfigs;
}
/**
* Runs both after the import and when loading an existing Graph
*
* @param closeEarly release resources as early as possible
*/
protected void postProcessing(boolean closeEarly) {
initLocationIndex();
importPublicTransit();
if (closeEarly) {
boolean includesCustomProfiles = profilesByName.values().stream().anyMatch(p -> p instanceof CustomProfile);
if (!includesCustomProfiles)
// when there are custom profiles we must not close way geometry or StringIndex, because
// they might be needed to evaluate the custom weightings for the following preparations
ghStorage.flushAndCloseGeometryAndNameStorage();
}
if (lmPreparationHandler.isEnabled())
loadOrPrepareLM(closeEarly);
if (closeEarly)
// we needed the location index for the LM preparation, but we don't need it for CH
locationIndex.close();
if (chPreparationHandler.isEnabled())
loadOrPrepareCH(closeEarly);
}
protected void importPublicTransit() {
}
void interpolateBridgesTunnelsAndFerries() {
if (ghStorage.getEncodingManager().hasEncodedValue(RoadEnvironment.KEY)) {
EnumEncodedValue<RoadEnvironment> roadEnvEnc = ghStorage.getEncodingManager().getEnumEncodedValue(RoadEnvironment.KEY, RoadEnvironment.class);
StopWatch sw = new StopWatch().start();
new EdgeElevationInterpolator(ghStorage.getBaseGraph(), roadEnvEnc, RoadEnvironment.TUNNEL).execute();
float tunnel = sw.stop().getSeconds();
sw = new StopWatch().start();
new EdgeElevationInterpolator(ghStorage.getBaseGraph(), roadEnvEnc, RoadEnvironment.BRIDGE).execute();
float bridge = sw.stop().getSeconds();
// The SkadiProvider contains bathymetric data. For ferries this can result in bigger elevation changes
// See #2098 for mor information
sw = new StopWatch().start();
new EdgeElevationInterpolator(ghStorage.getBaseGraph(), roadEnvEnc, RoadEnvironment.FERRY).execute();
logger.info("Bridge interpolation " + (int) bridge + "s, " + "tunnel interpolation " + (int) tunnel + "s, ferry interpolation " + (int) sw.stop().getSeconds() + "s");
}
}
public final Weighting createWeighting(Profile profile, PMap hints) {
return createWeighting(profile, hints, false);
}
public final Weighting createWeighting(Profile profile, PMap hints, boolean disableTurnCosts) {
return createWeightingFactory().createWeighting(profile, hints, disableTurnCosts);
}
protected WeightingFactory createWeightingFactory() {
return new DefaultWeightingFactory(ghStorage.getBaseGraph(), getEncodingManager());
}
public GHResponse route(GHRequest request) {
return createRouter().route(request);
}
private Router createRouter() {
if (ghStorage == null || !fullyLoaded)
throw new IllegalStateException("Do a successful call to load or importOrLoad before routing");
if (ghStorage.isClosed())
throw new IllegalStateException("You need to create a new GraphHopper instance as it is already closed");
if (locationIndex == null)
throw new IllegalStateException("Location index not initialized");
return doCreateRouter(ghStorage, locationIndex, profilesByName, pathBuilderFactory,
trMap, routerConfig, createWeightingFactory(), chGraphs, landmarks);
}
protected Router doCreateRouter(GraphHopperStorage ghStorage, LocationIndex locationIndex, Map<String, Profile> profilesByName,
PathDetailsBuilderFactory pathBuilderFactory, TranslationMap trMap, RouterConfig routerConfig,
WeightingFactory weightingFactory, Map<String, RoutingCHGraph> chGraphs, Map<String, LandmarkStorage> landmarks) {
return new Router(ghStorage.getBaseGraph(), ghStorage.getEncodingManager(), locationIndex, profilesByName, pathBuilderFactory,
trMap, routerConfig, weightingFactory, chGraphs, landmarks
);
}
protected LocationIndex createLocationIndex(Directory dir) {
LocationIndexTree tmpIndex = new LocationIndexTree(ghStorage, dir);
tmpIndex.setResolution(preciseIndexResolution);
tmpIndex.setMaxRegionSearch(maxRegionSearch);
if (!tmpIndex.loadExisting()) {
ensureWriteAccess();
tmpIndex.prepareIndex();
}
return tmpIndex;
}
/**
* Initializes the location index after the import is done.
*/
protected void initLocationIndex() {
if (locationIndex != null)
throw new IllegalStateException("Cannot initialize locationIndex twice!");
locationIndex = createLocationIndex(ghStorage.getDirectory());
}
private String getCHProfileVersion(String profile) {
return ghStorage.getProperties().get("graph.profiles.ch." + profile + ".version");
}
private void setCHProfileVersion(String profile, int version) {
ghStorage.getProperties().put("graph.profiles.ch." + profile + ".version", version);
}
private String getLMProfileVersion(String profile) {
return ghStorage.getProperties().get("graph.profiles.lm." + profile + ".version");
}
private void setLMProfileVersion(String profile, int version) {
ghStorage.getProperties().put("graph.profiles.lm." + profile + ".version", version);
}
protected void loadOrPrepareCH(boolean closeEarly) {
for (CHProfile profile : chPreparationHandler.getCHProfiles())
if (!getCHProfileVersion(profile.getProfile()).isEmpty()
&& !getCHProfileVersion(profile.getProfile()).equals("" + profilesByName.get(profile.getProfile()).getVersion()))
throw new IllegalArgumentException("CH preparation of " + profile.getProfile() + " already exists in storage and doesn't match configuration");
// we load ch graphs that already exist and prepare the other ones
List<CHConfig> chConfigs = createCHConfigs(chPreparationHandler.getCHProfiles());
Map<String, RoutingCHGraph> loaded = chPreparationHandler.load(ghStorage.getBaseGraph(), chConfigs);
List<CHConfig> configsToPrepare = chConfigs.stream().filter(c -> !loaded.containsKey(c.getName())).collect(Collectors.toList());
Map<String, PrepareContractionHierarchies.Result> prepared = prepareCH(closeEarly, configsToPrepare);
// we map all profile names for which there is CH support to the according CH graphs
chGraphs = new LinkedHashMap<>();
for (CHProfile profile : chPreparationHandler.getCHProfiles()) {
if (loaded.containsKey(profile.getProfile()) && prepared.containsKey(profile.getProfile()))
throw new IllegalStateException("CH graph should be either loaded or prepared, but not both: " + profile.getProfile());
else if (prepared.containsKey(profile.getProfile())) {
setCHProfileVersion(profile.getProfile(), profilesByName.get(profile.getProfile()).getVersion());
PrepareContractionHierarchies.Result res = prepared.get(profile.getProfile());
chGraphs.put(profile.getProfile(), RoutingCHGraphImpl.fromGraph(ghStorage, res.getCHStorage(), res.getCHConfig()));
} else if (loaded.containsKey(profile.getProfile())) {
chGraphs.put(profile.getProfile(), loaded.get(profile.getProfile()));
} else
throw new IllegalStateException("CH graph should be either loaded or prepared: " + profile.getProfile());
}
}
protected Map<String, PrepareContractionHierarchies.Result> prepareCH(boolean closeEarly, List<CHConfig> configsToPrepare) {
if (!configsToPrepare.isEmpty())
ensureWriteAccess();
ghStorage.freeze();
return chPreparationHandler.prepare(ghStorage, configsToPrepare, closeEarly);
}
/**
* For landmarks it is required to always call this method: either it creates the landmark data or it loads it.
*/
protected void loadOrPrepareLM(boolean closeEarly) {
for (LMProfile profile : lmPreparationHandler.getLMProfiles())
if (!getLMProfileVersion(profile.getProfile()).isEmpty()
&& !getLMProfileVersion(profile.getProfile()).equals("" + profilesByName.get(profile.getProfile()).getVersion()))
throw new IllegalArgumentException("LM preparation of " + profile.getProfile() + " already exists in storage and doesn't match configuration");
// we load landmark storages that already exist and prepare the other ones
List<LMConfig> lmConfigs = createLMConfigs(lmPreparationHandler.getLMProfiles());
List<LandmarkStorage> loaded = lmPreparationHandler.load(lmConfigs, ghStorage.getBaseGraph(), ghStorage.getEncodingManager());
List<LMConfig> loadedConfigs = loaded.stream().map(LandmarkStorage::getLMConfig).collect(Collectors.toList());
List<LMConfig> configsToPrepare = lmConfigs.stream().filter(c -> !loadedConfigs.contains(c)).collect(Collectors.toList());
List<PrepareLandmarks> prepared = prepareLM(closeEarly, configsToPrepare);
// we map all profile names for which there is LM support to the according LM storages
landmarks = new LinkedHashMap<>();
for (LMProfile lmp : lmPreparationHandler.getLMProfiles()) {
// cross-querying
String prepProfile = lmp.usesOtherPreparation() ? lmp.getPreparationProfile() : lmp.getProfile();
Optional<LandmarkStorage> loadedLMS = loaded.stream().filter(lms -> lms.getLMConfig().getName().equals(prepProfile)).findFirst();
Optional<PrepareLandmarks> preparedLMS = prepared.stream().filter(pl -> pl.getLandmarkStorage().getLMConfig().getName().equals(prepProfile)).findFirst();
if (loadedLMS.isPresent() && preparedLMS.isPresent())
throw new IllegalStateException("LM should be either loaded or prepared, but not both: " + prepProfile);
else if (preparedLMS.isPresent()) {
setLMProfileVersion(lmp.getProfile(), profilesByName.get(lmp.getProfile()).getVersion());
landmarks.put(lmp.getProfile(), preparedLMS.get().getLandmarkStorage());
} else
loadedLMS.ifPresent(landmarkStorage -> landmarks.put(lmp.getProfile(), landmarkStorage));
}
}
protected List<PrepareLandmarks> prepareLM(boolean closeEarly, List<LMConfig> configsToPrepare) {
if (!configsToPrepare.isEmpty())
ensureWriteAccess();
ghStorage.freeze();
return lmPreparationHandler.prepare(configsToPrepare, ghStorage, locationIndex, closeEarly);
}
/**
* Internal method to clean up the graph.
*/
protected void cleanUp() {
PrepareRoutingSubnetworks preparation = new PrepareRoutingSubnetworks(ghStorage.getBaseGraph(), buildSubnetworkRemovalJobs());
preparation.setMinNetworkSize(minNetworkSize);
preparation.doWork();
ghStorage.getProperties().put("profiles", getProfilesString());
logger.info("nodes: " + Helper.nf(ghStorage.getNodes()) + ", edges: " + Helper.nf(ghStorage.getEdges()));
}
private List<PrepareJob> buildSubnetworkRemovalJobs() {
List<PrepareJob> jobs = new ArrayList<>();
for (Profile profile : profilesByName.values()) {
// if turn costs are enabled use u-turn costs of zero as we only want to make sure the graph is fully connected assuming finite u-turn costs
Weighting weighting = createWeighting(profile, new PMap().putObject(Parameters.Routing.U_TURN_COSTS, 0));
jobs.add(new PrepareJob(tagParserManager.getBooleanEncodedValue(Subnetwork.key(profile.getName())), weighting));
}
return jobs;
}
protected void flush() {
logger.info("flushing graph " + ghStorage.toString() + ", details:" + ghStorage.toDetailsString() + ", "
+ getMemInfo() + ")");
ghStorage.flush();
logger.info("flushed graph " + getMemInfo() + ")");
setFullyLoaded();
}
/**
* Releases all associated resources like memory or files. But it does not remove them. To
* remove the files created in graphhopperLocation you have to call clean().
*/
public void close() {
if (ghStorage != null)
ghStorage.close();
chGraphs.values().forEach(RoutingCHGraph::close);
landmarks.values().forEach(LandmarkStorage::close);
if (locationIndex != null)
locationIndex.close();
try {
lockFactory.forceRemove(fileLockName, true);
} catch (Exception ex) {
// silently fail e.g. on Windows where we cannot remove an unreleased native lock
}
}
/**
* Removes the on-disc routing files. Call only after calling close or before importOrLoad or
* load
*/
public void clean() {
if (getGraphHopperLocation().isEmpty())
throw new IllegalStateException("Cannot clean GraphHopper without specified graphHopperLocation");
File folder = new File(getGraphHopperLocation());
removeDir(folder);
}
protected void ensureNotLoaded() {
if (fullyLoaded)
throw new IllegalStateException("No configuration changes are possible after loading the graph");
}
protected void ensureWriteAccess() {
if (!allowWrites)
throw new IllegalStateException("Writes are not allowed!");
}
private void setFullyLoaded() {
fullyLoaded = true;
}
public boolean getFullyLoaded() {
return fullyLoaded;
}
public RouterConfig getRouterConfig() {
return routerConfig;
}
public OSMReaderConfig getReaderConfig() {
return osmReaderConfig;
}
} | {
"content_hash": "aeaad0f7b172af8d8ddbb4e3d7f360bc",
"timestamp": "",
"source": "github",
"line_count": 1198,
"max_line_length": 237,
"avg_line_length": 46.36644407345576,
"alnum_prop": 0.6684789457576467,
"repo_name": "fbonzon/graphhopper",
"id": "7400554ce7841dfd14ef07e98059a6bacfdea145",
"size": "56351",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/com/graphhopper/GraphHopper.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "34072"
},
{
"name": "HTML",
"bytes": "14786"
},
{
"name": "Java",
"bytes": "5500294"
},
{
"name": "JavaScript",
"bytes": "254229"
},
{
"name": "Shell",
"bytes": "9846"
}
],
"symlink_target": ""
} |
<?php
add_theme_support( 'menus' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'custom-header' );
add_theme_support( 'widgets' );
function register_theme_menus() {
register_nav_menus(
array(
'primary-menu' => __('Primary Menu')
)
);
}
add_action('init', 'register_theme_menus');
function wpv_theme_styles(){
wp_enqueue_style( 'googleapis_css', 'https://fonts.googleapis.com/css?kit=IQHow_FEYlDC4Gzy_m8fckBzu7TUd5vUzi-wE6mvyJI');
wp_enqueue_style( 'bundle_css', get_template_directory_uri(). '/css/1691512649-css_bundle_v2.css');
// wp_enqueue_style( 'authorization147e_css', get_template_directory_uri(). 'css/authorization147e.css?targetBlogID=8510576969454812066&zx=eed29623-557e-475c-b8f3-19b425da3ab4');
wp_enqueue_style( 'google_fonts','http://fonts.googleapis.com/css?family=Roboto:400,900,700,500,300,400italic|Montserrat:700');
wp_enqueue_style( 'roboto_fonts','http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,700,500italic,900,700italic,900italic');
wp_enqueue_style( 'fontawesome_css', get_template_directory_uri(). '/css/font-awesome.min.css');
wp_enqueue_style( 'bootstrap_css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css');
wp_enqueue_style( 'main_css', get_template_directory_uri(). '/css/main.css');
}
add_action( 'wp_enqueue_scripts', 'wpv_theme_styles' );
function wpv_theme_js(){
wp_enqueue_script( 'bootstrap_js', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js', array('jquery'), '', true );
wp_enqueue_script( 'script_js', get_template_directory_uri().'/js/script.js', array('jquery'), '', true );
}
add_action( 'wp_enqueue_scripts', 'wpv_theme_js' );
$widj = array(
'name' => __( 'right-sidebar', 'sideb' ),
'id' => 'sid-12',
'description' => '',
'class' => '',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>' );
register_sidebar($widj);
// comment adjust
?>
| {
"content_hash": "ac9814800b68bfb906e5c3166a4f3dd8",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 188,
"avg_line_length": 41.86538461538461,
"alnum_prop": 0.6467615985300873,
"repo_name": "DhaAlae/Wordpress_theme_vidnlol",
"id": "a57c5a8ac257eb8d5a5a8f576e0933f3180534e4",
"size": "2177",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "functions.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "39693"
},
{
"name": "CSS",
"bytes": "51659"
},
{
"name": "JavaScript",
"bytes": "98"
},
{
"name": "PHP",
"bytes": "20580"
}
],
"symlink_target": ""
} |
package org.apache.activemq.apollo.broker.web;
import org.apache.activemq.apollo.util.Service;
import org.fusesource.hawtdispatch.Task;
import java.net.URI;
/**
* @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
*/
public interface WebServer extends Service {
public void update(Task task);
public URI[] uris();
}
| {
"content_hash": "addaeadb405e5d3641b13c2fa2c2f4ec",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 75,
"avg_line_length": 23.466666666666665,
"alnum_prop": 0.7357954545454546,
"repo_name": "christian-posta/activemq-apollo-java-port",
"id": "034511d2033147dc7a0735de551a4f5fa7fca389",
"size": "1150",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "apollo-broker/src/main/java/org/apache/activemq/apollo/broker/web/WebServer.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "654215"
}
],
"symlink_target": ""
} |
<div class="statementparagraph" id="problemmainstatement">
<p>
Baltic Olympiad in Informatics – programmeringstävlingen för länderna i östersjöregionen – kommer till våren att anordnas i Stockholm, och deltagarna kommer åka tunnelbana mellan vandrarhemmet och tävlingsarenan.
</p>
<p>
På tunnelbanetågen finns det sätesgrupper med fyra säten vardera. Nu kommer ett antal grupper av deltagare och vill sätta sig. Varje grupp har storlek 1, 2, 3 eller 4. Helst skulle alla personerna i en grupp vilja sitta i samma fyrsätesgrupp, alltså slippa dela på sig. Hur många fyrsätesgrupper krävs för att detta ska vara möjligt?
</p>
</div>
<h2 class="inputoutputtitle" id="inputtitle">Input</h2>
<div class="statementparagraph" id="inputstatement">
<p>
Indata består av en rad med fyra heltal $a_1, a_2, a_3, a_4$ – antalet grupper av varje storlek. Alla tal är mellan $0$ och $100$.
</p>
</div>
<h2 class="inputoutputtitle" id="outputtitle">Output</h2>
<div class="statementparagraph" id="outputstatement">
<p>
Skriv ut ett enda tal: det minsta antalet fyrsätesgrupper som behövs för att
personerna ska kunna sätta sig så att alla inom varje grupp sitter tillsammans.
</p>
</div>
| {
"content_hash": "4d0d2c3ad389cab4d63628b2772def75",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 337,
"avg_line_length": 38.875,
"alnum_prop": 0.7290996784565916,
"repo_name": "ArVID220u/judge",
"id": "691ae06d189f82ae336f09b32e855ea5c62d77aa",
"size": "1278",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "problems/tunnelbaneplatser/statement.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "3921"
},
{
"name": "CSS",
"bytes": "5040"
},
{
"name": "HTML",
"bytes": "43079"
},
{
"name": "Python",
"bytes": "27562"
}
],
"symlink_target": ""
} |
#include <ruby.h>
#include <stdbool.h>
#include <stdint.h>
#include <constants.h>
#include <struct.h>
#include "macros.h"
VALUE rb_thrift_binary_proto_native_qmark(VALUE self) {
return Qtrue;
}
static int VERSION_1;
static int VERSION_MASK;
static int TYPE_MASK;
static int BAD_VERSION;
static ID rbuf_ivar_id;
static void write_byte_direct(VALUE trans, int8_t b) {
WRITE(trans, (char*)&b, 1);
}
static void write_i16_direct(VALUE trans, int16_t value) {
char data[2];
data[1] = value;
data[0] = (value >> 8);
WRITE(trans, data, 2);
}
static void write_i32_direct(VALUE trans, int32_t value) {
char data[4];
data[3] = value;
data[2] = (value >> 8);
data[1] = (value >> 16);
data[0] = (value >> 24);
WRITE(trans, data, 4);
}
static void write_i64_direct(VALUE trans, int64_t value) {
char data[8];
data[7] = value;
data[6] = (value >> 8);
data[5] = (value >> 16);
data[4] = (value >> 24);
data[3] = (value >> 32);
data[2] = (value >> 40);
data[1] = (value >> 48);
data[0] = (value >> 56);
WRITE(trans, data, 8);
}
static void write_string_direct(VALUE trans, VALUE str) {
if (TYPE(str) != T_STRING) {
rb_raise(rb_eStandardError, "Value should be a string");
}
write_i32_direct(trans, RSTRING_LEN(str));
rb_funcall(trans, write_method_id, 1, str);
}
//--------------------------------
// interface writing methods
//--------------------------------
VALUE rb_thrift_binary_proto_write_message_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_struct_begin(VALUE self, VALUE name) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_struct_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_field_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_map_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_list_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_set_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_write_message_begin(VALUE self, VALUE name, VALUE type, VALUE seqid) {
VALUE trans = GET_TRANSPORT(self);
VALUE strict_write = GET_STRICT_WRITE(self);
if (strict_write == Qtrue) {
write_i32_direct(trans, VERSION_1 | FIX2INT(type));
write_string_direct(trans, name);
write_i32_direct(trans, FIX2INT(seqid));
} else {
write_string_direct(trans, name);
write_byte_direct(trans, FIX2INT(type));
write_i32_direct(trans, FIX2INT(seqid));
}
return Qnil;
}
VALUE rb_thrift_binary_proto_write_field_begin(VALUE self, VALUE name, VALUE type, VALUE id) {
VALUE trans = GET_TRANSPORT(self);
write_byte_direct(trans, FIX2INT(type));
write_i16_direct(trans, FIX2INT(id));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_field_stop(VALUE self) {
write_byte_direct(GET_TRANSPORT(self), TTYPE_STOP);
return Qnil;
}
VALUE rb_thrift_binary_proto_write_map_begin(VALUE self, VALUE ktype, VALUE vtype, VALUE size) {
VALUE trans = GET_TRANSPORT(self);
write_byte_direct(trans, FIX2INT(ktype));
write_byte_direct(trans, FIX2INT(vtype));
write_i32_direct(trans, FIX2INT(size));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_list_begin(VALUE self, VALUE etype, VALUE size) {
VALUE trans = GET_TRANSPORT(self);
write_byte_direct(trans, FIX2INT(etype));
write_i32_direct(trans, FIX2INT(size));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_set_begin(VALUE self, VALUE etype, VALUE size) {
rb_thrift_binary_proto_write_list_begin(self, etype, size);
return Qnil;
}
VALUE rb_thrift_binary_proto_write_bool(VALUE self, VALUE b) {
write_byte_direct(GET_TRANSPORT(self), RTEST(b) ? 1 : 0);
return Qnil;
}
VALUE rb_thrift_binary_proto_write_byte(VALUE self, VALUE byte) {
CHECK_NIL(byte);
write_byte_direct(GET_TRANSPORT(self), NUM2INT(byte));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_i16(VALUE self, VALUE i16) {
CHECK_NIL(i16);
write_i16_direct(GET_TRANSPORT(self), FIX2INT(i16));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_i32(VALUE self, VALUE i32) {
CHECK_NIL(i32);
write_i32_direct(GET_TRANSPORT(self), NUM2INT(i32));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_i64(VALUE self, VALUE i64) {
CHECK_NIL(i64);
write_i64_direct(GET_TRANSPORT(self), NUM2LL(i64));
return Qnil;
}
VALUE rb_thrift_binary_proto_write_double(VALUE self, VALUE dub) {
CHECK_NIL(dub);
// Unfortunately, bitwise_cast doesn't work in C. Bad C!
union {
double f;
int64_t t;
} transfer;
transfer.f = RFLOAT_VALUE(rb_Float(dub));
write_i64_direct(GET_TRANSPORT(self), transfer.t);
return Qnil;
}
VALUE rb_thrift_binary_proto_write_string(VALUE self, VALUE str) {
CHECK_NIL(str);
VALUE trans = GET_TRANSPORT(self);
write_string_direct(trans, str);
return Qnil;
}
//---------------------------------------
// interface reading methods
//---------------------------------------
VALUE rb_thrift_binary_proto_read_string(VALUE self);
VALUE rb_thrift_binary_proto_read_byte(VALUE self);
VALUE rb_thrift_binary_proto_read_i32(VALUE self);
VALUE rb_thrift_binary_proto_read_i16(VALUE self);
static char read_byte_direct(VALUE self) {
VALUE byte = rb_funcall(GET_TRANSPORT(self), read_byte_method_id, 0);
return (char)(FIX2INT(byte));
}
static int16_t read_i16_direct(VALUE self) {
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(2));
return (int16_t)(((uint8_t)(RSTRING_PTR(rbuf)[1])) | ((uint16_t)((RSTRING_PTR(rbuf)[0]) << 8)));
}
static int32_t read_i32_direct(VALUE self) {
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(4));
return ((uint8_t)(RSTRING_PTR(rbuf)[3])) |
(((uint8_t)(RSTRING_PTR(rbuf)[2])) << 8) |
(((uint8_t)(RSTRING_PTR(rbuf)[1])) << 16) |
(((uint8_t)(RSTRING_PTR(rbuf)[0])) << 24);
}
static int64_t read_i64_direct(VALUE self) {
VALUE rbuf = rb_ivar_get(self, rbuf_ivar_id);
rb_funcall(GET_TRANSPORT(self), read_into_buffer_method_id, 2, rbuf, INT2FIX(8));
uint64_t hi = ((uint8_t)(RSTRING_PTR(rbuf)[3])) |
(((uint8_t)(RSTRING_PTR(rbuf)[2])) << 8) |
(((uint8_t)(RSTRING_PTR(rbuf)[1])) << 16) |
(((uint8_t)(RSTRING_PTR(rbuf)[0])) << 24);
uint32_t lo = ((uint8_t)(RSTRING_PTR(rbuf)[7])) |
(((uint8_t)(RSTRING_PTR(rbuf)[6])) << 8) |
(((uint8_t)(RSTRING_PTR(rbuf)[5])) << 16) |
(((uint8_t)(RSTRING_PTR(rbuf)[4])) << 24);
return (hi << 32) | lo;
}
static VALUE get_protocol_exception(VALUE code, VALUE message) {
VALUE args[2];
args[0] = code;
args[1] = message;
return rb_class_new_instance(2, (VALUE*)&args, protocol_exception_class);
}
VALUE rb_thrift_binary_proto_read_message_end(VALUE self) {
return Qnil;
}
VALUE rb_thift_binary_proto_read_struct_begin(VALUE self) {
return Qnil;
}
VALUE rb_thift_binary_proto_read_struct_end(VALUE self) {
return Qnil;
}
VALUE rb_thift_binary_proto_read_field_end(VALUE self) {
return Qnil;
}
VALUE rb_thift_binary_proto_read_map_end(VALUE self) {
return Qnil;
}
VALUE rb_thift_binary_proto_read_list_end(VALUE self) {
return Qnil;
}
VALUE rb_thift_binary_proto_read_set_end(VALUE self) {
return Qnil;
}
VALUE rb_thrift_binary_proto_read_message_begin(VALUE self) {
VALUE strict_read = GET_STRICT_READ(self);
VALUE name, seqid;
int type;
int version = read_i32_direct(self);
if (version < 0) {
if ((version & VERSION_MASK) != VERSION_1) {
rb_exc_raise(get_protocol_exception(INT2FIX(BAD_VERSION), rb_str_new2("Missing version identifier")));
}
type = version & TYPE_MASK;
name = rb_thrift_binary_proto_read_string(self);
seqid = rb_thrift_binary_proto_read_i32(self);
} else {
if (strict_read == Qtrue) {
rb_exc_raise(get_protocol_exception(INT2FIX(BAD_VERSION), rb_str_new2("No version identifier, old protocol client?")));
}
name = READ(self, version);
type = read_byte_direct(self);
seqid = rb_thrift_binary_proto_read_i32(self);
}
return rb_ary_new3(3, name, INT2FIX(type), seqid);
}
VALUE rb_thrift_binary_proto_read_field_begin(VALUE self) {
int type = read_byte_direct(self);
if (type == TTYPE_STOP) {
return rb_ary_new3(3, Qnil, INT2FIX(type), INT2FIX(0));
} else {
VALUE id = rb_thrift_binary_proto_read_i16(self);
return rb_ary_new3(3, Qnil, INT2FIX(type), id);
}
}
VALUE rb_thrift_binary_proto_read_map_begin(VALUE self) {
VALUE ktype = rb_thrift_binary_proto_read_byte(self);
VALUE vtype = rb_thrift_binary_proto_read_byte(self);
VALUE size = rb_thrift_binary_proto_read_i32(self);
return rb_ary_new3(3, ktype, vtype, size);
}
VALUE rb_thrift_binary_proto_read_list_begin(VALUE self) {
VALUE etype = rb_thrift_binary_proto_read_byte(self);
VALUE size = rb_thrift_binary_proto_read_i32(self);
return rb_ary_new3(2, etype, size);
}
VALUE rb_thrift_binary_proto_read_set_begin(VALUE self) {
return rb_thrift_binary_proto_read_list_begin(self);
}
VALUE rb_thrift_binary_proto_read_bool(VALUE self) {
char byte = read_byte_direct(self);
return byte != 0 ? Qtrue : Qfalse;
}
VALUE rb_thrift_binary_proto_read_byte(VALUE self) {
return INT2FIX(read_byte_direct(self));
}
VALUE rb_thrift_binary_proto_read_i16(VALUE self) {
return INT2FIX(read_i16_direct(self));
}
VALUE rb_thrift_binary_proto_read_i32(VALUE self) {
return INT2NUM(read_i32_direct(self));
}
VALUE rb_thrift_binary_proto_read_i64(VALUE self) {
return LL2NUM(read_i64_direct(self));
}
VALUE rb_thrift_binary_proto_read_double(VALUE self) {
union {
double f;
int64_t t;
} transfer;
transfer.t = read_i64_direct(self);
return rb_float_new(transfer.f);
}
VALUE rb_thrift_binary_proto_read_string(VALUE self) {
int size = read_i32_direct(self);
return READ(self, size);
}
void Init_binary_protocol_accelerated() {
VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
VERSION_1 = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_1")));
VERSION_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("VERSION_MASK")));
TYPE_MASK = rb_num2ll(rb_const_get(thrift_binary_protocol_class, rb_intern("TYPE_MASK")));
VALUE bpa_class = rb_define_class_under(thrift_module, "BinaryProtocolAccelerated", thrift_binary_protocol_class);
rb_define_method(bpa_class, "native?", rb_thrift_binary_proto_native_qmark, 0);
rb_define_method(bpa_class, "write_message_begin", rb_thrift_binary_proto_write_message_begin, 3);
rb_define_method(bpa_class, "write_field_begin", rb_thrift_binary_proto_write_field_begin, 3);
rb_define_method(bpa_class, "write_field_stop", rb_thrift_binary_proto_write_field_stop, 0);
rb_define_method(bpa_class, "write_map_begin", rb_thrift_binary_proto_write_map_begin, 3);
rb_define_method(bpa_class, "write_list_begin", rb_thrift_binary_proto_write_list_begin, 2);
rb_define_method(bpa_class, "write_set_begin", rb_thrift_binary_proto_write_set_begin, 2);
rb_define_method(bpa_class, "write_byte", rb_thrift_binary_proto_write_byte, 1);
rb_define_method(bpa_class, "write_bool", rb_thrift_binary_proto_write_bool, 1);
rb_define_method(bpa_class, "write_i16", rb_thrift_binary_proto_write_i16, 1);
rb_define_method(bpa_class, "write_i32", rb_thrift_binary_proto_write_i32, 1);
rb_define_method(bpa_class, "write_i64", rb_thrift_binary_proto_write_i64, 1);
rb_define_method(bpa_class, "write_double", rb_thrift_binary_proto_write_double, 1);
rb_define_method(bpa_class, "write_string", rb_thrift_binary_proto_write_string, 1);
// unused methods
rb_define_method(bpa_class, "write_message_end", rb_thrift_binary_proto_write_message_end, 0);
rb_define_method(bpa_class, "write_struct_begin", rb_thrift_binary_proto_write_struct_begin, 1);
rb_define_method(bpa_class, "write_struct_end", rb_thrift_binary_proto_write_struct_end, 0);
rb_define_method(bpa_class, "write_field_end", rb_thrift_binary_proto_write_field_end, 0);
rb_define_method(bpa_class, "write_map_end", rb_thrift_binary_proto_write_map_end, 0);
rb_define_method(bpa_class, "write_list_end", rb_thrift_binary_proto_write_list_end, 0);
rb_define_method(bpa_class, "write_set_end", rb_thrift_binary_proto_write_set_end, 0);
rb_define_method(bpa_class, "read_message_begin", rb_thrift_binary_proto_read_message_begin, 0);
rb_define_method(bpa_class, "read_field_begin", rb_thrift_binary_proto_read_field_begin, 0);
rb_define_method(bpa_class, "read_map_begin", rb_thrift_binary_proto_read_map_begin, 0);
rb_define_method(bpa_class, "read_list_begin", rb_thrift_binary_proto_read_list_begin, 0);
rb_define_method(bpa_class, "read_set_begin", rb_thrift_binary_proto_read_set_begin, 0);
rb_define_method(bpa_class, "read_byte", rb_thrift_binary_proto_read_byte, 0);
rb_define_method(bpa_class, "read_bool", rb_thrift_binary_proto_read_bool, 0);
rb_define_method(bpa_class, "read_i16", rb_thrift_binary_proto_read_i16, 0);
rb_define_method(bpa_class, "read_i32", rb_thrift_binary_proto_read_i32, 0);
rb_define_method(bpa_class, "read_i64", rb_thrift_binary_proto_read_i64, 0);
rb_define_method(bpa_class, "read_double", rb_thrift_binary_proto_read_double, 0);
rb_define_method(bpa_class, "read_string", rb_thrift_binary_proto_read_string, 0);
// unused methods
rb_define_method(bpa_class, "read_message_end", rb_thrift_binary_proto_read_message_end, 0);
rb_define_method(bpa_class, "read_struct_begin", rb_thift_binary_proto_read_struct_begin, 0);
rb_define_method(bpa_class, "read_struct_end", rb_thift_binary_proto_read_struct_end, 0);
rb_define_method(bpa_class, "read_field_end", rb_thift_binary_proto_read_field_end, 0);
rb_define_method(bpa_class, "read_map_end", rb_thift_binary_proto_read_map_end, 0);
rb_define_method(bpa_class, "read_list_end", rb_thift_binary_proto_read_list_end, 0);
rb_define_method(bpa_class, "read_set_end", rb_thift_binary_proto_read_set_end, 0);
rbuf_ivar_id = rb_intern("@rbuf");
}
| {
"content_hash": "42ac4d349e041ff9f2cf039475d2acf3",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 125,
"avg_line_length": 33.45283018867924,
"alnum_prop": 0.6767484489565708,
"repo_name": "steven-sheffey-tungsten/thrift",
"id": "bd1c2da10949dd562c5832af6a7f7300621cdc0b",
"size": "14988",
"binary": false,
"copies": "6",
"ref": "refs/heads/0.7.0-fix",
"path": "lib/rb/ext/binary_protocol_accelerated.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "65846"
},
{
"name": "C",
"bytes": "378610"
},
{
"name": "C#",
"bytes": "162080"
},
{
"name": "C++",
"bytes": "2513275"
},
{
"name": "Emacs Lisp",
"bytes": "5154"
},
{
"name": "Erlang",
"bytes": "137451"
},
{
"name": "Go",
"bytes": "361326"
},
{
"name": "HTML",
"bytes": "6351"
},
{
"name": "Haskell",
"bytes": "53155"
},
{
"name": "Java",
"bytes": "680583"
},
{
"name": "JavaScript",
"bytes": "79243"
},
{
"name": "Lex",
"bytes": "14002"
},
{
"name": "M4",
"bytes": "67504"
},
{
"name": "Makefile",
"bytes": "87309"
},
{
"name": "OCaml",
"bytes": "33971"
},
{
"name": "Objective-C",
"bytes": "68119"
},
{
"name": "PHP",
"bytes": "131794"
},
{
"name": "Perl",
"bytes": "70565"
},
{
"name": "Python",
"bytes": "184421"
},
{
"name": "Ruby",
"bytes": "328369"
},
{
"name": "Shell",
"bytes": "15475"
},
{
"name": "Smalltalk",
"bytes": "22944"
},
{
"name": "Thrift",
"bytes": "48982"
},
{
"name": "Vim script",
"bytes": "2837"
},
{
"name": "Yacc",
"bytes": "26284"
}
],
"symlink_target": ""
} |
package com.google.template.soy.exprtree;
import com.google.common.base.Preconditions;
import com.google.template.soy.base.SourceLocation;
import com.google.template.soy.basetree.AbstractNode;
import com.google.template.soy.basetree.CopyState;
/**
* Abstract implementation of an ExprNode.
*
* <p>Important: Do not use outside of Soy code (treat as superpackage-private).
*/
public abstract class AbstractExprNode extends AbstractNode implements ExprNode {
private final SourceLocation sourceLocation;
@Override
public ParentExprNode getParent() {
return (ParentExprNode) super.getParent();
}
protected AbstractExprNode(SourceLocation sourceLocation) {
this.sourceLocation = Preconditions.checkNotNull(sourceLocation);
}
/**
* Copy constructor.
*
* @param orig The node to copy.
*/
protected AbstractExprNode(AbstractExprNode orig, CopyState copyState) {
super(orig, copyState);
this.sourceLocation = orig.sourceLocation;
}
@Override
public SourceLocation getSourceLocation() {
return sourceLocation;
}
}
| {
"content_hash": "4009c07f235c8d312acceb851fb20706",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 81,
"avg_line_length": 25.571428571428573,
"alnum_prop": 0.7560521415270018,
"repo_name": "google/closure-templates",
"id": "392ab9a54d5a57a3ceedc863093d01cd40f2afc5",
"size": "1668",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/src/com/google/template/soy/exprtree/AbstractExprNode.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Closure Templates",
"bytes": "3332"
},
{
"name": "HTML",
"bytes": "21890"
},
{
"name": "Java",
"bytes": "8407238"
},
{
"name": "JavaScript",
"bytes": "248481"
},
{
"name": "Python",
"bytes": "92193"
},
{
"name": "Starlark",
"bytes": "239786"
},
{
"name": "TypeScript",
"bytes": "52777"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "b973094e33d38792552eb65d6ed9e8fb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "fb3a8109dc050828de59bc351495812a253bb9cb",
"size": "194",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Moraceae/Ficus/Ficus rupestris/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import React, { Component } from 'react';
import { FormattedMessage } from 'react-intl';
class Privacy extends Component {
render() {
return (
<h1 className="text-center"><FormattedMessage id={ 'privacy' } /></h1>
);
}
}
export default Privacy;
| {
"content_hash": "38bcbc55d69fdd12ee5639ab5addaab0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 76,
"avg_line_length": 22.083333333333332,
"alnum_prop": 0.6490566037735849,
"repo_name": "jhonfredynova/Scaffolding-Nodejs-Reactjs",
"id": "ce7dba54d46ca31d18d1497bc0b59bfc322ae92a",
"size": "265",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "web/src/components/Privacy.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1103"
},
{
"name": "HTML",
"bytes": "435"
},
{
"name": "JavaScript",
"bytes": "21887"
}
],
"symlink_target": ""
} |
package org.jivesoftware.smack.sasl.core;
import static org.junit.Assert.assertEquals;
import org.jivesoftware.smack.DummyConnection;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.sasl.packet.SaslNonza.AuthMechanism;
import org.jivesoftware.smack.sasl.packet.SaslNonza.Response;
import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.util.stringencoder.Base64;
import org.junit.Test;
import org.jxmpp.jid.JidTestUtil;
public class SCRAMSHA1MechanismTest extends SmackTestSuite {
public static final String USERNAME = "user";
public static final String PASSWORD = "pencil";
public static final String CLIENT_FIRST_MESSAGE = "n,,n=user,r=fyko+d2lbbFgONRv9qkxdawL";
public static final String SERVER_FIRST_MESSAGE = "r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,s=QSXCR+Q6sek8bf92,i=4096";
public static final String CLIENT_FINAL_MESSAGE = "c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts=";
public static final String SERVER_FINAL_MESSAGE = "v=rmF9pqV8S7suAoZWja4dJRkFsKQ=";
@Test
public void testScramSha1Mechanism() throws NotConnectedException, SmackException, InterruptedException {
final DummyConnection con = new DummyConnection();
SCRAMSHA1Mechanism mech = new SCRAMSHA1Mechanism() {
@Override
public String getRandomAscii() {
this.connection = con;
return "fyko+d2lbbFgONRv9qkxdawL";
}
};
mech.authenticate(USERNAME, "unusedFoo", JidTestUtil.DOMAIN_BARE_JID_1, PASSWORD, null, null);
AuthMechanism authMechanism = con.getSentPacket();
assertEquals(SCRAMSHA1Mechanism.NAME, authMechanism.getMechanism());
assertEquals(CLIENT_FIRST_MESSAGE, saslLayerString(authMechanism.getAuthenticationText()));
mech.challengeReceived(Base64.encode(SERVER_FIRST_MESSAGE), false);
Response response = con.getSentPacket();
assertEquals(CLIENT_FINAL_MESSAGE, saslLayerString(response.getAuthenticationText()));
mech.challengeReceived(Base64.encode(SERVER_FINAL_MESSAGE), true);
mech.checkIfSuccessfulOrThrow();
}
private static String saslLayerString(String string) {
return Base64.decodeToString(string);
}
}
| {
"content_hash": "fad035ac617ac21715de293a5f5abc2a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 139,
"avg_line_length": 45.0377358490566,
"alnum_prop": 0.750733137829912,
"repo_name": "vanitasvitae/Smack",
"id": "490a855d67d4b7c11ed17f2a70b5bf928c34603e",
"size": "2994",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "smack-core/src/test/java/org/jivesoftware/smack/sasl/core/SCRAMSHA1MechanismTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "602"
},
{
"name": "HTML",
"bytes": "2595"
},
{
"name": "Java",
"bytes": "8964946"
},
{
"name": "Makefile",
"bytes": "718"
},
{
"name": "Scala",
"bytes": "1582"
},
{
"name": "Shell",
"bytes": "8381"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.