text
stringlengths 2
1.04M
| meta
dict |
---|---|
console.log('###########################\n')
console.log('Este exemplo continha erros')
console.log('\n##########################')
//Esta linha contem erros
var var
| {
"content_hash": "6eedacdddc45a29c79931e51ffe3b181",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 44,
"avg_line_length": 27.833333333333332,
"alnum_prop": 0.49101796407185627,
"repo_name": "rvitorper/Aulas-ITA-Jr",
"id": "25f8dd015d89d94fef589f5d1a0f301b16759b79",
"size": "167",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Aula 2/Exercicio 4/com_erros.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "411"
},
{
"name": "JavaScript",
"bytes": "11022"
}
],
"symlink_target": ""
} |
require File.expand_path('../boot', __FILE__)
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module AlzAboutMe
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
# config.web_console.development_only = false
end
end
| {
"content_hash": "6a077600107f137cddeae353cb244aeb",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 99,
"avg_line_length": 39.189189189189186,
"alnum_prop": 0.7351724137931035,
"repo_name": "EzzySri/AlzAboutMe",
"id": "697a6ae6373497ee585703f14efdae06af5f25c2",
"size": "1450",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "config/application.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "42012"
},
{
"name": "CoffeeScript",
"bytes": "844"
},
{
"name": "Cucumber",
"bytes": "14286"
},
{
"name": "HTML",
"bytes": "28110"
},
{
"name": "JavaScript",
"bytes": "1480331"
},
{
"name": "Ruby",
"bytes": "94719"
}
],
"symlink_target": ""
} |
"""Tests for tf.keras models using tf.distribute.Strategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.python import keras
from tensorflow.python.data.experimental.ops import cardinality
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import distribution_strategy_context
from tensorflow.python.distribute import mirrored_strategy
from tensorflow.python.distribute import strategy_combinations
from tensorflow.python.distribute import tpu_strategy
from tensorflow.python.eager import test
from tensorflow.python.keras import testing_utils
from tensorflow.python.keras.distribute import distributed_training_utils
from tensorflow.python.keras.optimizer_v2 import gradient_descent as gradient_descent_keras
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops.losses import loss_reduction
from tensorflow.python.training import gradient_descent
from tensorflow.python.training import rmsprop
_RANDOM_SEED = 1337
_TRAIN_SIZE = 200
_INPUT_SIZE = (10,)
_NUM_CLASS = 2
# Note: Please make sure the tests in this file are also covered in
# keras_backward_compat_test for features that are supported with both APIs.
# TODO(anjalisridhar): Add a decorator that will allow us to run these tests as
# part of the tf.keras unit tests suite.
def simple_sequential_model():
model = keras.models.Sequential()
model.add(keras.layers.Dense(16, activation='relu', input_shape=_INPUT_SIZE))
model.add(keras.layers.Dropout(0.1))
model.add(keras.layers.Dense(_NUM_CLASS, activation='softmax'))
return model
def simple_subclassed_model(num_labels=_NUM_CLASS):
class _SimpleMLP(keras.Model):
def __init__(self, num_labels):
super(_SimpleMLP, self).__init__()
self.dense = keras.layers.Dense(num_labels)
def call(self, inputs):
return self.dense(inputs)
return _SimpleMLP(num_labels)
def simple_multi_inputs_multi_outputs_model():
input_a = keras.layers.Input(shape=(16,), name='input_a')
input_b = keras.layers.Input(shape=(16,), name='input_b')
merged = keras.layers.concatenate([input_a, input_b], name='merge')
output_c = keras.layers.Dense(3, activation='softmax', name='dense_2')(merged)
output_d = keras.layers.Dense(2, activation='softmax', name='dense_3')(merged)
model = keras.models.Model(
inputs=[input_a, input_b], outputs=[output_c, output_d])
return model
def get_multi_inputs_multi_outputs_data():
(a_train, c_train), (a_test, c_test) = testing_utils.get_test_data(
train_samples=_TRAIN_SIZE,
test_samples=50,
input_shape=(16,),
num_classes=3,
random_seed=_RANDOM_SEED)
(b_train, d_train), (b_test, d_test) = testing_utils.get_test_data(
train_samples=_TRAIN_SIZE,
test_samples=50,
input_shape=(16,),
num_classes=2,
random_seed=_RANDOM_SEED)
(m_train, _), (m_test, _) = testing_utils.get_test_data(
train_samples=_TRAIN_SIZE,
test_samples=50,
input_shape=(8,),
num_classes=2,
random_seed=_RANDOM_SEED)
c_train = keras.utils.to_categorical(c_train)
c_test = keras.utils.to_categorical(c_test)
d_train = keras.utils.to_categorical(d_train)
d_test = keras.utils.to_categorical(d_test)
train_data = {
'input_a': a_train,
'input_b': b_train,
'input_m': m_train,
'output_c': c_train,
'output_d': d_train
}
test_data = {
'input_a': a_test,
'input_b': b_test,
'input_m': m_test,
'output_c': c_test,
'output_d': d_test
}
return (train_data, test_data)
def batch_wrapper(dataset, batch_size, distribution, repeat=None):
if repeat:
dataset = dataset.repeat(repeat)
# TPUs currently require fully defined input shapes, drop_remainder ensures
# the input will have fully defined shapes.
if isinstance(distribution, (tpu_strategy.TPUStrategy,
tpu_strategy.TPUStrategyV1)):
return dataset.batch(batch_size, drop_remainder=True)
else:
return dataset.batch(batch_size)
def get_model():
x = keras.layers.Input(shape=(3,), name='input')
y = keras.layers.Dense(4, name='dense')(x)
model = keras.Model(x, y)
return model
def get_sample_weights_model():
x = keras.layers.Input(shape=(1,), name='input')
y = keras.layers.Dense(
1, kernel_initializer='ones', bias_initializer='zeros', name='dense')(x)
model = keras.Model(x, y)
return model
def get_dataset(distribution):
inputs = np.zeros((10, 3), dtype=np.float32)
targets = np.zeros((10, 4), dtype=np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices((inputs, targets))
dataset = dataset.repeat(100)
dataset = batch_wrapper(dataset, 10, distribution)
return dataset
def get_predict_dataset(distribution):
inputs = np.zeros((10, 3), dtype=np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices(inputs)
dataset = dataset.repeat(100)
dataset = batch_wrapper(dataset, 10, distribution)
return dataset
def convert_numpy_to_dataset_with_unknown_cardinality(inputs,
targets=None):
if targets is not None:
input_slices = (inputs, targets)
dummy_op = (lambda inp, target: True)
else:
input_slices = inputs
dummy_op = (lambda inp: True)
original_dataset = (dataset_ops.Dataset.from_tensor_slices(
input_slices))
ds_with_unknown_cardinality = (original_dataset.filter(dummy_op).
batch(10, drop_remainder=True))
return ds_with_unknown_cardinality
def multi_input_output_model():
a = keras.layers.Input(shape=(3,), name='input_a')
b = keras.layers.Input(shape=(5,), name='input_b')
# TODO(anjalisridhar): Change the output dimension of the second Dense layer
# once the iterator output validation issue has been fixed.
dense_1 = keras.layers.Dense(7, name='dense_1')
dense_2 = keras.layers.Dense(7, name='dense_2')
c = dense_1(a)
d = dense_2(b)
e = keras.layers.Dropout(0.5, name='dropout')(c)
model = keras.models.Model([a, b], [d, e])
return model
strategies_minus_default_minus_tpu = [
strategy_combinations.one_device_strategy,
strategy_combinations.one_device_strategy_gpu,
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus
]
strategies_minus_tpu = [
strategy_combinations.default_strategy,
strategy_combinations.one_device_strategy,
strategy_combinations.one_device_strategy_gpu,
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus
]
tpu_strategies = [
strategy_combinations.tpu_strategy, # steps_per_run=2
strategy_combinations.tpu_strategy_one_step
]
def strategy_minus_tpu_combinations():
return combinations.combine(distribution=strategies_minus_tpu,
mode=['graph', 'eager'])
def tpu_strategy_combinations():
return combinations.combine(distribution=tpu_strategies,
mode=['graph', 'eager'])
def tpu_strategy_combinations_graph_only():
return combinations.combine(distribution=tpu_strategies,
mode=['graph'])
def all_strategy_combinations():
return strategy_minus_tpu_combinations() + tpu_strategy_combinations()
def all_strategy_combinations_plus_cloning():
return (
combinations.combine(
distribution=strategies_minus_tpu,
mode=['graph', 'eager'],
cloning=[True, False]) +
combinations.combine(
distribution=tpu_strategies,
mode=['graph', 'eager'],
cloning=[False]))
def all_strategy_minus_default_and_tpu_combinations():
return combinations.combine(
distribution=[
strategy_combinations.one_device_strategy,
strategy_combinations.one_device_strategy_gpu,
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus,
],
mode=['graph', 'eager'])
def all_strategy_combinations_minus_default():
return (all_strategy_minus_default_and_tpu_combinations() +
tpu_strategy_combinations())
def strategy_and_optimizer_combinations():
non_tpu_strategies = combinations.times(
strategy_minus_tpu_combinations(),
# TODO(b/130808953): Simplify when optimizers v1 work with cloning=False.
combinations.combine(
optimizer=[
strategy_combinations.adagrad_optimizer_v1_fn,
strategy_combinations.adam_optimizer_v1_fn,
strategy_combinations.gradient_descent_optimizer_v1_fn,
strategy_combinations.rmsprop_optimizer_v1_fn,
],
cloning=True) +
combinations.combine(
optimizer=[
strategy_combinations.adagrad_optimizer_keras_v2_fn,
strategy_combinations.adam_optimizer_keras_v2_fn,
strategy_combinations.gradient_descent_optimizer_keras_v2_fn,
strategy_combinations.rmsprop_optimizer_keras_v2_fn
],
cloning=[True, False]))
# TODO(b/130808953): Simplify when optimizers v1 work with cloning=False.
tpu_strategies_graph = combinations.combine(
distribution=tpu_strategies,
mode=['graph'],
cloning=[True],
optimizer=[
strategy_combinations.adagrad_optimizer_v1_fn,
strategy_combinations.adam_optimizer_v1_fn,
strategy_combinations.gradient_descent_optimizer_v1_fn,
strategy_combinations.rmsprop_optimizer_v1_fn,
strategy_combinations.adagrad_optimizer_keras_v2_fn,
strategy_combinations.adam_optimizer_keras_v2_fn,
strategy_combinations.gradient_descent_optimizer_keras_v2_fn,
strategy_combinations.rmsprop_optimizer_keras_v2_fn
])
tpu_strategies_eager = combinations.combine(
distribution=tpu_strategies,
mode=['eager'],
cloning=[False],
optimizer=[
strategy_combinations.adagrad_optimizer_keras_v2_fn,
strategy_combinations.adam_optimizer_keras_v2_fn,
strategy_combinations.gradient_descent_optimizer_keras_v2_fn,
strategy_combinations.rmsprop_optimizer_keras_v2_fn
])
return non_tpu_strategies + tpu_strategies_eager + tpu_strategies_graph
class TestDistributionStrategyWithNumpyArrays(test.TestCase,
parameterized.TestCase):
@combinations.generate(all_strategy_combinations())
def test_calculating_input_params_no_steps_no_batch_size(self, distribution):
# Calculate the per_replica_batch_size scaling factor for strategies
# that use per_core_batch_size
replica_scale_factor = 1.0
if not distributed_training_utils.global_batch_size_supported(distribution):
replica_scale_factor = distribution.num_replicas_in_sync
with self.cached_session():
# Input samples of different sizes
input_20_samples = np.zeros((20, 3), dtype=np.float32)
input_64_samples = np.zeros((64, 3), dtype=np.float32)
# Default global batch size 32 for input with 64 samples run in 2 steps
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=None, batch_size=None)
self.assertEqual(batch_size, 32 // replica_scale_factor)
self.assertEqual(steps, 2)
# Computed global batch size 20 is lower than 32 if we pass less samples.
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_20_samples, steps=None, batch_size=None)
self.assertEqual(batch_size, 20 // replica_scale_factor)
self.assertEqual(steps, 1)
@combinations.generate(all_strategy_combinations())
def test_calculating_input_params_with_steps_no_batch_size(self,
distribution):
# Calculate the per_replica_batch_size scaling factor for strategies
# that use per_core_batch_size
replica_scale_factor = 1.0
if not distributed_training_utils.global_batch_size_supported(distribution):
replica_scale_factor = distribution.num_replicas_in_sync
with self.cached_session():
# Input samples of different sizes
input_63_samples = np.zeros((63, 3), dtype=np.float32)
input_64_samples = np.zeros((64, 3), dtype=np.float32)
# Computed global batch size is correct for number of specified 1 step
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=1, batch_size=None)
self.assertEqual(batch_size, 64 // replica_scale_factor)
self.assertEqual(steps, 1)
# Computed global batch size is correct for number of specified 2 steps
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=2, batch_size=None)
self.assertEqual(batch_size, 32 // replica_scale_factor)
self.assertEqual(steps, 2)
# All samples can not be consumed in specified number of steps
with self.assertRaisesRegexp(ValueError, 'not divisible by steps'):
distributed_training_utils.get_input_params(
distribution, input_63_samples, steps=2, batch_size=None)
# This cases is different for different strategies due to the
# difference in supported batch size being global or per-replica.
if replica_scale_factor == 1:
# Computed global batch size is correct even if not sharadable
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_63_samples, steps=3, batch_size=None)
self.assertEqual(batch_size, 21)
self.assertEqual(steps, 3)
else:
# Computed global batch size can not be sharded across replicas
with self.assertRaisesRegexp(ValueError, 'could not be sharded evenly '
'across the sync replicas'):
distributed_training_utils.get_input_params(
distribution, input_63_samples, steps=1, batch_size=None)
@combinations.generate(all_strategy_combinations())
def test_calculating_input_params_no_steps_with_batch_size(self,
distribution):
# Calculate the per_replica_batch_size scaling factor for strategies
# that use per_core_batch_size
replica_scale_factor = 1.0
if not distributed_training_utils.global_batch_size_supported(distribution):
replica_scale_factor = distribution.num_replicas_in_sync
with self.cached_session():
input_64_samples = np.zeros((64, 3), dtype=np.float32)
# Computed steps is correct for specified batch size
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=None, batch_size=16)
self.assertEqual(batch_size, 16)
self.assertEqual(steps, 4 // replica_scale_factor)
# Computed steps is correct for specified batch size
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=None, batch_size=32)
self.assertEqual(batch_size, 32)
self.assertEqual(steps, 2 // replica_scale_factor)
@combinations.generate(all_strategy_combinations())
def test_calculating_input_params_with_steps_with_batch_size(self,
distribution):
with self.cached_session():
input_64_samples = np.zeros((64, 3), dtype=np.float32)
# No change to steps and batch size if both specified and feasible
steps, batch_size = distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=5, batch_size=3)
self.assertEqual(batch_size, 3)
self.assertEqual(steps, 5)
# Number of samples is less than global batch size * steps
with self.assertRaisesRegexp(ValueError, 'less than samples required'):
distributed_training_utils.get_input_params(
distribution, input_64_samples, steps=10, batch_size=13)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_calling_model_with_numpy_arrays(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning or not distribution_strategy_context.has_strategy()
else gradient_descent_keras.SGD)
optimizer = optimizer_fn(0.001)
model = get_model()
loss = 'mse'
metrics = ['mae']
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
inputs = np.zeros((64, 3), dtype=np.float32)
targets = np.zeros((64, 4), dtype=np.float32)
# Call fit with validation data
model.fit(inputs, targets, epochs=1, batch_size=2, verbose=0,
validation_data=(inputs, targets))
# TODO(anjalisridhar): We need tests for when the batch size and steps
# are smaller and results in a 0 batch_size and steps value.
model.evaluate(inputs, targets)
# with steps
model.evaluate(inputs, targets, steps=2)
# with batch_size
model.evaluate(inputs, targets, batch_size=8)
model.predict(inputs)
# with steps
model.predict(inputs, steps=2)
# with batch_size
model.predict(inputs, batch_size=8)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_calling_model_with_nested_numpy_arrays(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(learning_rate=0.001)
model = multi_input_output_model()
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
input_a_np = np.asarray(np.random.random((64, 3)), dtype=np.float32)
input_b_np = np.asarray(np.random.random((64, 5)), dtype=np.float32)
inputs = [input_a_np, input_b_np]
output_d_np = np.asarray(np.random.random((64, 7)), dtype=np.float32)
output_e_np = np.asarray(np.random.random((64, 7)), dtype=np.float32)
targets = [output_d_np, output_e_np]
# Call fit with validation data
model.fit(inputs, targets, epochs=1, batch_size=8, verbose=0)
# TODO(anjalisridhar): We need tests for when the batch size and steps are
# smaller and results in a 0 batch_size and steps value.
model.evaluate(inputs, targets)
# with steps
model.evaluate(inputs, targets, steps=2)
# with batch_size
model.evaluate(inputs, targets, batch_size=8)
model.predict(inputs)
# with steps
model.predict(inputs, steps=2)
# with batch_size
model.predict(inputs, batch_size=8)
@combinations.generate(
combinations.combine(distribution=strategies_minus_tpu,
mode=['graph', 'eager']))
def test_numpy_with_sample_weights(self, distribution):
with self.cached_session(), distribution.scope():
model = get_sample_weights_model()
optimizer = rmsprop.RMSPropOptimizer(learning_rate=0.001)
loss = 'mse'
model.compile(optimizer, loss)
inputs = np.array([[0], [1], [2], [3]], np.float32)
targets = np.array([[2], [4], [6], [8]], np.float32)
sample_weights = np.array([0.25, 0.5, 0.75, 1], np.float32)
result = model.evaluate(inputs, targets, batch_size=2,
sample_weight=sample_weights, verbose=1)
# The per sample loss is multipled by the corresponding sample weight. The
# average of these weighted losses is the return value of the `evaluate`
# call. For example, in the test above the average weighted loss is
# calculated in the following manner:
# batch_1 = (((2-0)^2) * 0.25 + ((4-1)^2) * 0.5) / 2 = 5.5 / 2 = 2.75
# batch_2 = (((6-2)^2 * 0.75) + ((8-3)^2 * 1)) / 2 = 37 / 2 = 18.5
# final result = (batch_1 + batch_2) / 2 = 10.625.
# The first time we divide by number of input samples and the second time
# we divide by number of steps/batches that the loss is aggregated over.
self.assertAllClose(result, 10.625)
# We now test without passing sample_weights:
# batch_1 = ((2-0)^2) + ((4-1)^2) / 2 = 13 / 2 = 6.5
# batch_2 = ((6-2)^2) + ((8-3)^2) / 2 = 41 / 2 = 20.5
# final result = (batch_1 + batch_2) / 2 = 27 / 2 = 13.5
result = model.evaluate(inputs, targets, batch_size=2, verbose=1)
self.assertAllClose(result, 13.5)
@combinations.generate(
combinations.combine(distribution=strategies_minus_default_minus_tpu,
mode=['eager']))
def test_numpy_with_sample_weights_eager_with_cloning(self, distribution):
with self.cached_session(), distribution.scope():
model = get_sample_weights_model()
optimizer = rmsprop.RMSPropOptimizer(learning_rate=0.001)
loss = 'mse'
model.compile(optimizer, loss, cloning=True)
inputs = np.array([[0], [1], [2], [3]], np.float32)
targets = np.array([[2], [4], [6], [8]], np.float32)
sample_weights = np.array([0.25, 0.5, 0.75, 1], np.float32)
with self.assertRaisesRegexp(NotImplementedError,
'`sample_weight` is not supported when '
'using tf.distribute.Strategy in '):
model.evaluate(inputs, targets, batch_size=2,
sample_weight=sample_weights, verbose=1)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_flatten_predict_outputs(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
model = multi_input_output_model()
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(learning_rate=0.001)
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
# We take 6 input samples with each input having a dimension of 3 or 5.
input_a_np = np.asarray(np.random.random((6, 3)), dtype=np.float32)
input_b_np = np.asarray(np.random.random((6, 5)), dtype=np.float32)
inputs = [input_a_np, input_b_np]
outs = model.predict(inputs, steps=1)
# `predict` a list that is equal in length to the number of model outputs.
# In this test our model has two outputs and each element of `outs`
# corresponds to all the samples of one of the model outputs.
self.assertLen(outs, 2)
# Each of the output samples have a dimension of 7. We should process all
# the available input samples(6).
self.assertAllEqual([6, 7], outs[0].shape)
self.assertAllEqual([6, 7], outs[1].shape)
@combinations.generate(
combinations.times(tpu_strategy_combinations_graph_only(),
combinations.combine(batch_size=[4, 6])))
def test_evaluate_with_partial_batch(self, distribution, batch_size):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
with distribution.scope():
model_with_ds_strategy = get_model()
model_with_ds_strategy.compile(optimizer, loss, metrics=metrics)
cpu_model = get_model()
cpu_model.compile(optimizer, loss, metrics=metrics)
x = np.random.random((10, 3)).astype('float32')
y = np.random.random((10, 4)).astype('float32')
# As sample size is 10, we batch by 4 so that the last batch is
# a partial batch. Also `evaluate()` using numpy array as inputs without
# distribution strategy uses entire sample as a single batch. As so,
# we remove parameters `batch_size` and `steps`.
cpu_model.set_weights(model_with_ds_strategy.get_weights())
evaluate_ground_truth = cpu_model.evaluate(x, y)
# We don't compare the loss as loss is currently not computed as metric
# in Keras, the loss value is inaccurate for last partial batch due to
# more weights for the last batch samples.
steps = np.ceil(10.0 / batch_size)
self.assertAllClose(
model_with_ds_strategy.evaluate(
x, y, batch_size=batch_size, steps=steps)[1:],
evaluate_ground_truth[1:],
atol=1e-5,
rtol=1e-5)
# Test that `steps` is inferred correctly when final partial batch exists.
self.assertAllClose(
model_with_ds_strategy.evaluate(x, y, batch_size=batch_size)[1:],
evaluate_ground_truth[1:],
atol=1e-5,
rtol=1e-5)
@combinations.generate(
combinations.times(tpu_strategy_combinations_graph_only(),
combinations.combine(cloning=[True, False])))
def test_predict_with_partial_batch(self, distribution, cloning):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
loss = 'mse'
with distribution.scope():
model_with_ds_strategy = get_model()
model_with_ds_strategy.compile(optimizer, loss, cloning=cloning)
cpu_model = get_model()
cpu_model.compile(optimizer, loss)
inputs = np.random.random((10, 3)).astype(np.float32)
# As sample size is 10, we batch by 4 so that the last batch is
# a partial batch. Also `predict()` using numpy array as inputs without
# distribution strategy uses entire sample as a single batch. As so,
# we remove parameters `batch_size` and `steps`.
cpu_model.set_weights(model_with_ds_strategy.get_weights())
predict_ground_truth = cpu_model.predict(inputs)
self.assertAllClose(
model_with_ds_strategy.predict(inputs, batch_size=4, steps=3),
predict_ground_truth,
atol=1e-5,
rtol=1e-5)
# Test that `steps` is inferred correctly when final partial batch exists.
self.assertAllClose(
model_with_ds_strategy.predict(inputs, batch_size=4),
predict_ground_truth,
atol=1e-5,
rtol=1e-5)
@combinations.generate(tpu_strategy_combinations_graph_only())
def test_no_target_model(self, distribution):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
class MyLayer(keras.layers.Layer):
def call(self, inputs, training=None):
self.add_loss(math_ops.reduce_sum(inputs), inputs=True)
return inputs
with distribution.scope():
model = keras.models.Sequential()
model.add(keras.layers.Dense(16, activation='relu',
input_shape=_INPUT_SIZE))
model.add(MyLayer())
model.add(keras.layers.Dense(_NUM_CLASS, activation='softmax'))
model.compile(optimizer)
inputs = np.zeros((20, 10), np.float32)
model.fit(inputs, epochs=1, steps_per_epoch=2)
model.predict(inputs, steps=1)
model.evaluate(inputs, steps=1)
@combinations.generate(
combinations.times(tpu_strategy_combinations_graph_only(),
combinations.combine(cloning=[True, False])))
def test_predict_multi_output_model_with_partial_batch(
self, distribution, cloning):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
loss = 'mse'
with distribution.scope():
model_with_ds_strategy = simple_multi_inputs_multi_outputs_model()
model_with_ds_strategy.compile(optimizer, loss, cloning=cloning)
cpu_model = simple_multi_inputs_multi_outputs_model()
cpu_model.compile(optimizer, loss)
input_data, _ = get_multi_inputs_multi_outputs_data()
input_dict = {
'input_a': input_data['input_a'],
'input_b': input_data['input_b'],
}
# As sample size is 200, we batch by 18 so that the last batch is
# a partial batch. Also `fit()` using numpy array as inputs without
# distribution strategy uses entire sample as a single batch. As so,
# we remove parameters `batch_size` and `steps`.
cpu_model.set_weights(model_with_ds_strategy.get_weights())
self.assertAllClose(
model_with_ds_strategy.predict(input_dict, batch_size=18, steps=12),
cpu_model.predict(input_dict),
atol=1e-4, rtol=1e-4)
class TestDistributionStrategyWithDatasets(test.TestCase,
parameterized.TestCase):
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_calling_model_on_same_dataset(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(0.001)
model = get_model()
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
dataset = get_dataset(distribution)
# Call fit with validation data
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=0,
validation_data=dataset, validation_steps=2)
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=0,
validation_data=dataset, validation_steps=2)
model.predict(get_predict_dataset(distribution), steps=2)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_model_interleaved_eval_same_as_direct_eval(self, distribution,
cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
user_controlled_model = get_model()
user_controlled_model.compile(
optimizer_fn(0.001),
loss='mse',
metrics=['mae', keras.metrics.CategoricalAccuracy()],
cloning=cloning)
interleaved_model = get_model()
interleaved_model.set_weights(user_controlled_model.get_weights())
interleaved_model.compile(
optimizer_fn(0.001),
loss='mse',
metrics=['mae', keras.metrics.CategoricalAccuracy()],
cloning=cloning)
dataset = get_dataset(distribution)
# Call fit with validation interleaved
interleaved_output = interleaved_model.fit(
dataset, epochs=2, steps_per_epoch=2, verbose=1,
validation_data=dataset, validation_steps=2, shuffle=False)
# Manually control the validation running after each epoch.
user_controlled_output = []
for _ in range(2):
user_controlled_model.fit(
dataset, epochs=1, steps_per_epoch=2, verbose=1, shuffle=False)
user_controlled_output.append(
user_controlled_model.evaluate(dataset, steps=2))
self.assertEqual(interleaved_output.history['val_loss'],
[x[0] for x in user_controlled_output])
val_mean_absolute_error = interleaved_output.history.get(
'val_mean_absolute_error')
if not val_mean_absolute_error:
# The name of the metric changed in TF2.0
val_mean_absolute_error = interleaved_output.history['val_mae']
self.assertEqual(val_mean_absolute_error,
[x[1] for x in user_controlled_output])
self.assertEqual(interleaved_output.history['val_categorical_accuracy'],
[x[2] for x in user_controlled_output])
# TODO(priyag): Enable this test for TPU. Currently tuples/dict don't work
# as clone_model's input_tensors argument only seems to accept list and not
# tuples or dict.
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.mirrored_strategy_with_gpu_and_cpu
],
mode=['graph', 'eager'], cloning=[True, False]))
def test_fit_with_tuple_and_dict_dataset_inputs(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(learning_rate=0.001)
model = multi_input_output_model()
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
input_a_np = np.random.random((10, 3))
input_b_np = np.random.random((10, 5))
output_d_np = np.random.random((10, 7))
output_e_np = np.random.random((10, 7))
# Test with tuples
dataset_tuple = dataset_ops.Dataset.from_tensor_slices((
(input_a_np, input_b_np), (output_d_np, output_e_np)))
dataset_tuple = dataset_tuple.repeat(100)
dataset_tuple = dataset_tuple.batch(10)
model.fit(dataset_tuple, epochs=1, steps_per_epoch=2, verbose=1)
# Test with dict
dataset_dict = dataset_ops.Dataset.from_tensor_slices((
{'input_a': input_a_np, 'input_b': input_b_np},
(output_d_np, output_e_np)))
dataset_dict = dataset_dict.repeat(100)
dataset_dict = dataset_dict.batch(10)
model.fit(dataset_dict, epochs=1, steps_per_epoch=2, verbose=1)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_fit_eval_and_predict_methods_on_dataset_without_steps(
self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(0.001)
model = get_model()
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
inputs = np.zeros((1000, 3), dtype=np.float32)
targets = np.zeros((1000, 4), dtype=np.float32)
# steps/steps_per_epoch are calculated when using numpy arrays as
# input data.
fit_with_numpy = model.fit(inputs, targets, epochs=1,
batch_size=10).history
eval_with_numpy = model.evaluate(inputs, targets, batch_size=10)
predict_with_numpy = model.predict(inputs, batch_size=10)
dataset = dataset_ops.Dataset.from_tensor_slices((inputs, targets))
dataset = dataset.batch(10, drop_remainder=True)
fit_with_ds = model.fit(dataset, epochs=1).history
eval_with_ds = model.evaluate(dataset)
predict_dataset = dataset_ops.Dataset.from_tensor_slices(inputs)
predict_dataset = predict_dataset.batch(10, drop_remainder=True)
predict_with_ds = model.predict(predict_dataset)
self.assertAllClose(
fit_with_numpy, fit_with_ds, atol=1e-4, rtol=1e-4)
self.assertAllClose(
eval_with_numpy, eval_with_ds, atol=1e-4, rtol=1e-4)
self.assertAllClose(
predict_with_numpy, predict_with_ds, atol=1e-4, rtol=1e-4)
@combinations.generate(
combinations.times(strategy_minus_tpu_combinations(),
combinations.combine(cloning=[True, False])))
def test_on_dataset_with_unknown_cardinality_without_steps(
self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(0.001)
model = get_model()
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
inputs = np.zeros((1000, 3), dtype=np.float32)
targets = np.zeros((1000, 4), dtype=np.float32)
# steps/steps_per_epoch are calculated when using numpy arrays as
# input data.
fit_with_numpy = model.fit(inputs, targets, epochs=1,
batch_size=10).history
fit_with_numpy_multiple_epochs = model.fit(
inputs, targets, epochs=2, batch_size=10).history
eval_with_numpy = model.evaluate(inputs, targets, batch_size=10)
predict_with_numpy = model.predict(inputs, batch_size=10)
dataset = convert_numpy_to_dataset_with_unknown_cardinality(
inputs, targets)
predict_dataset = convert_numpy_to_dataset_with_unknown_cardinality(
inputs)
self.assertEqual(keras.backend.get_value(cardinality.cardinality(
dataset)), cardinality.UNKNOWN)
self.assertEqual(keras.backend.get_value(cardinality.cardinality(
predict_dataset)), cardinality.UNKNOWN)
eval_with_ds = model.evaluate(dataset)
predict_with_ds = model.predict(predict_dataset)
self.assertAllClose(
eval_with_numpy, eval_with_ds, atol=1e-4, rtol=1e-4)
self.assertAllClose(
predict_with_numpy, predict_with_ds, atol=1e-4, rtol=1e-4)
fit_with_ds = model.fit(dataset,
epochs=1).history
fit_with_ds_multiple_epochs = model.fit(dataset,
epochs=2).history
self.assertAllClose(
fit_with_numpy, fit_with_ds, atol=1e-4, rtol=1e-4)
self.assertAllClose(
fit_with_numpy_multiple_epochs,
fit_with_ds_multiple_epochs, atol=1e-4, rtol=1e-4)
@combinations.generate(
combinations.times(tpu_strategy_combinations(),
combinations.combine(cloning=[True, False])))
def test_on_dataset_with_unknown_cardinality(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
model = get_model()
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
model.compile(
gradient_descent.GradientDescentOptimizer(0.001),
loss,
metrics=metrics,
cloning=cloning)
inputs = np.zeros((1000, 3), dtype=np.float32)
targets = np.zeros((1000, 4), dtype=np.float32)
# steps/steps_per_epoch are calculated when using numpy arrays as
# input data.
eval_with_numpy = model.evaluate(inputs, targets, batch_size=10)
predict_with_numpy = model.predict(inputs, batch_size=10)
dataset = convert_numpy_to_dataset_with_unknown_cardinality(
inputs, targets)
predict_dataset = convert_numpy_to_dataset_with_unknown_cardinality(
inputs)
self.assertEqual(
keras.backend.get_value(cardinality.cardinality(dataset)),
cardinality.UNKNOWN)
self.assertEqual(
keras.backend.get_value(cardinality.cardinality(predict_dataset)),
cardinality.UNKNOWN)
eval_with_ds = model.evaluate(dataset, steps=100)
predict_with_ds = model.predict(predict_dataset, steps=100)
self.assertAllClose(eval_with_numpy, eval_with_ds, atol=1e-4, rtol=1e-4)
self.assertAllClose(
predict_with_numpy, predict_with_ds, atol=1e-4, rtol=1e-4)
with self.assertRaisesRegexp(ValueError,
'Number of steps could not be infered'):
model.fit(dataset, epochs=1)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_fit_eval_and_predict_methods_on_dataset(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(0.001)
model = get_model()
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
dataset = get_dataset(distribution)
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=1)
model.evaluate(dataset, steps=2, verbose=1)
model.predict(get_predict_dataset(distribution), steps=2)
@combinations.generate(strategy_and_optimizer_combinations())
def test_fit_eval_and_predict_with_optimizer(self, distribution, optimizer,
cloning):
with self.cached_session():
with distribution.scope():
model = get_model()
loss = 'mse'
model.compile(optimizer(), loss, cloning=cloning)
dataset = get_dataset(distribution)
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=1)
model.evaluate(dataset, steps=2, verbose=1)
model.predict(get_predict_dataset(distribution), steps=2)
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.one_device_strategy
],
mode=['graph', 'eager'], cloning=[True, False]))
def test_dataset_wrong_input_shape(self, distribution, cloning, mode):
if cloning or mode == 'graph':
self.skipTest('TODO(b/120943676, b/120957836): Re-enable for cloning=True'
' once the validation code is restored.')
with self.cached_session():
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
rmsprop.RMSPropOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(learning_rate=0.001)
model = get_model()
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
# Wrong input shape
inputs = np.zeros((10, 5), dtype=np.float32)
targets = np.zeros((10, 4), dtype=np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices((inputs, targets))
dataset = dataset.repeat(100)
dataset = dataset.batch(10)
with self.assertRaisesRegexp(ValueError,
'expected input to have shape'):
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=0)
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.mirrored_strategy_with_gpu_and_cpu
],
mode=['graph', 'eager'],
cloning=[True, False]))
def test_dataset_no_batch_input_validation(self, distribution,
cloning, mode):
if cloning or mode == 'graph':
self.skipTest('TODO(b/120943676, b/120957836): Re-enable for cloning=True'
' once the validation code is restored.')
with self.cached_session():
with distribution.scope():
model = get_model()
optimizer = rmsprop.RMSPropOptimizer(learning_rate=0.001)
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
# User forgets to batch the dataset
inputs = np.zeros((10, 6), dtype=np.float32)
targets = np.zeros((10, 4), dtype=np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices((inputs, targets))
dataset = dataset.repeat(100)
with self.assertRaisesRegexp(ValueError, 'Call.*batch.*on.*Dataset'):
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=0)
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus
],
mode=['graph', 'eager'], cloning=[True, False]))
def test_learning_phase_value(self, distribution, cloning):
# TODO(anjalisridhar): Modify this test to use Lambdas since we can compare
# meaningful values. Currently we don't pass the learning phase if the
# Lambda layer uses the learning phase.
with self.cached_session():
with distribution.scope():
x = keras.layers.Input(shape=(1,), name='input')
y = keras.layers.Dense(1, kernel_initializer='ones')(x)
z = keras.layers.Dropout(0.9999)(y)
model = keras.Model(x, z)
initial_weights = model.get_weights()
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
gradient_descent.GradientDescentOptimizer
if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(0.005)
loss = 'mse'
metrics = ['acc']
model.compile(optimizer, loss, metrics=metrics, cloning=cloning)
batch_size = 8
if isinstance(distribution, mirrored_strategy.MirroredStrategy):
# MirroredStrategy uses global batch size.
batch_size = 8 * distribution.num_replicas_in_sync
inputs = np.ones((10, 1), dtype=np.float32)
targets = np.ones((10, 1), dtype=np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices((inputs, targets))
dataset = dataset.repeat().batch(batch_size)
hist = model.fit(dataset, epochs=1, steps_per_epoch=20, verbose=1)
self.assertAlmostEqual(hist.history['acc'][0], 0, 0)
with distribution.scope():
model.set_weights(initial_weights)
# TODO(psv/anjalisridhar): Enable these lines after we fix b/117431185.
# evaluate_output = model.evaluate(dataset, steps=20)
# self.assertAlmostEqual(evaluate_output[1], 1, 0)
inputs = np.ones((10, 1), dtype=np.float32)
predict_dataset = dataset_ops.Dataset.from_tensor_slices(inputs)
predict_dataset = predict_dataset.repeat().batch(batch_size)
output = model.predict(predict_dataset, steps=10)
# `predict` runs for 10 steps
ref_output = np.ones((160, 1), dtype=np.float32)
self.assertArrayNear(output, ref_output, 1e-1)
@combinations.generate(all_strategy_combinations_plus_cloning())
def testOptimizerWithCallbacks(self, distribution, cloning):
with self.cached_session():
with distribution.scope():
model = get_model()
optimizer = gradient_descent_keras.SGD(0.01)
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
dataset = get_dataset(distribution)
def schedule(_):
return 0.001
model.fit(dataset, epochs=1, steps_per_epoch=2, verbose=0,
callbacks=[keras.callbacks.LearningRateScheduler(schedule)])
self.assertAllClose(0.001, keras.backend.get_value(model.optimizer.lr))
@combinations.generate(
combinations.times(tpu_strategy_combinations_graph_only(),
combinations.combine(batch_size=[4, 6])))
def test_evaluate_with_dataset_with_partial_batch(self, distribution,
batch_size):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
loss = 'mse'
metrics = ['mae', keras.metrics.CategoricalAccuracy()]
with distribution.scope():
model_with_ds_strategy = get_model()
model_with_ds_strategy.compile(optimizer, loss, metrics=metrics)
cpu_model = get_model()
cpu_model.compile(optimizer, loss, metrics=metrics)
x = np.random.random((10, 3)).astype('float32')
y = np.random.random((10, 4)).astype('float32')
dataset = dataset_ops.Dataset.from_tensor_slices((x, y))
# As sample size is 10, we make the last batch a partial batch.
cpu_model.set_weights(model_with_ds_strategy.get_weights())
dataset_with_partial_batch = dataset.batch(batch_size)
# We don't compare the loss as loss is currently not computed as metric
# in Keras, the loss value is inaccurate for last partial batch due to
# more weights for the last batch samples.
steps = np.ceil(10.0 / batch_size)
self.assertAllClose(
model_with_ds_strategy.evaluate(
dataset_with_partial_batch, steps=steps)[1:],
cpu_model.evaluate(dataset_with_partial_batch, steps=steps)[1:],
atol=1e-5,
rtol=1e-5)
self.assertAllClose(
model_with_ds_strategy.evaluate(dataset_with_partial_batch)[1:],
cpu_model.evaluate(dataset_with_partial_batch)[1:],
atol=1e-5,
rtol=1e-5)
@combinations.generate(
combinations.times(tpu_strategy_combinations_graph_only(),
combinations.combine(cloning=[True, False])))
def test_predict_with_dataset_with_partial_batch(self, distribution, cloning):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
loss = 'mse'
with distribution.scope():
model_with_ds_strategy = get_model()
model_with_ds_strategy.compile(optimizer, loss, cloning=cloning)
cpu_model = get_model()
cpu_model.compile(optimizer, loss)
inputs = np.random.random((10, 3)).astype(np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices((inputs))
# As sample size is 10, we batch by 4 so that the last batch is
# a partial batch.
dataset_with_partial_batch = dataset.batch(4)
cpu_model.set_weights(model_with_ds_strategy.get_weights())
self.assertAllClose(
model_with_ds_strategy.predict(dataset_with_partial_batch, steps=3),
cpu_model.predict(dataset_with_partial_batch, steps=3),
atol=1e-5,
rtol=1e-5)
@combinations.generate(
combinations.times(tpu_strategy_combinations_graph_only(),
combinations.combine(cloning=[True, False])))
def test_predict_multi_output_model_with_dataset_with_partial_batch(
self, distribution, cloning):
with self.cached_session():
optimizer = gradient_descent.GradientDescentOptimizer(0.001)
loss = 'mse'
with distribution.scope():
model_with_ds_strategy = simple_multi_inputs_multi_outputs_model()
model_with_ds_strategy.compile(optimizer, loss, cloning=cloning)
cpu_model = simple_multi_inputs_multi_outputs_model()
cpu_model.compile(optimizer, loss)
input_data, _ = get_multi_inputs_multi_outputs_data()
input_dict = {
'input_a': input_data['input_a'],
'input_b': input_data['input_b'],
}
dataset = dataset_ops.Dataset.from_tensor_slices(input_dict)
# As sample size is 200, we batch by 18 using 12 steps per epoch so
# that the last batch is a partial batch.
dataset_with_partial_batch = dataset.batch(18)
cpu_model.set_weights(model_with_ds_strategy.get_weights())
self.assertAllClose(
model_with_ds_strategy.predict(dataset_with_partial_batch, steps=12),
cpu_model.predict(dataset_with_partial_batch, steps=12),
atol=1e-4, rtol=1e-4)
@combinations.generate(all_strategy_combinations_minus_default())
def test_match_model_input_matches_with_dataset_tensors(self, distribution):
def _create_model_input_output_tensors():
input_a = keras.layers.Input(shape=(16,), name='z_input_sorted_last')
input_b = keras.layers.Input(shape=(32,), name='a_input_sorted_first')
intermediate_a = keras.layers.Dense(10)(input_a)
intermediate_b = keras.layers.Dense(10)(input_b)
merged = keras.layers.Add()([intermediate_a, intermediate_b])
output = keras.layers.Dense(2)(merged)
return input_a, input_b, output
input_dict = {
'z_input_sorted_last': np.random.rand(32, 16).astype(np.float32),
'a_input_sorted_first': np.random.rand(32, 32).astype(np.float32)
}
target = np.ones((32, 2), dtype=np.float32)
dataset = dataset_ops.Dataset.from_tensor_slices((input_dict, target))
dataset = dataset.batch(4, drop_remainder=True)
with self.cached_session():
with distribution.scope():
input_a, input_b, output = _create_model_input_output_tensors()
# `input_a`, which has input name that comes last in alphanumeric
# order, is the first input of the model input layers. If tensors
# from `input_dict` is blindly flattened and passed to model
# inputs incorrectly, this would result in `input_a` input layer
# matching with tensor `a_input_sorted_first` and would result in
# shape mismatch.
model_with_array_input = keras.models.Model(
inputs=[input_a, input_b], outputs=output)
model_with_array_input.compile('sgd', 'mse')
model_weights = model_with_array_input.get_weights()
model_with_array_input_fit = model_with_array_input.fit(
dataset, steps_per_epoch=1, epochs=1).history
input_a, input_b, output = _create_model_input_output_tensors()
model_with_dict_input = keras.models.Model(
inputs={
'z_input_sorted_last': input_a,
'a_input_sorted_first': input_b,
},
outputs=output)
model_with_dict_input.compile('sgd', 'mse')
model_with_dict_input.set_weights(model_weights)
model_with_dict_input_fit = model_with_dict_input.fit(
dataset, steps_per_epoch=1, epochs=1).history
self.assertAllClose(
model_with_dict_input_fit,
model_with_array_input_fit,
atol=1e-4,
rtol=1e-4)
@combinations.generate(
combinations.combine(distribution=strategies_minus_tpu,
mode=['graph', 'eager']))
def test_dataset_with_sample_weights(self, distribution):
with self.cached_session(), distribution.scope():
model = get_sample_weights_model()
optimizer = rmsprop.RMSPropOptimizer(learning_rate=0.001)
loss = 'mse'
model.compile(optimizer, loss)
inputs = np.array([[0], [1], [2], [3]], np.float32)
targets = np.array([[2], [4], [6], [8]], np.float32)
sample_weights = np.array([0.25, 0.5, 0.75, 1], np.float32)
ds = dataset_ops.Dataset.from_tensor_slices((inputs, targets,
sample_weights)).batch(2)
result = model.evaluate(ds, verbose=1)
# The per sample loss is multipled by the corresponding sample weight. The
# average of these weighted losses is the return value of the `evaluate`
# call. For example, in the test above the average weighted loss is
# calculated in the following manner:
# batch_1 = (((2-0)^2) * 0.25 + ((4-1)^2) * 0.5) / 2 = 5.5 / 2 = 2.75
# batch_2 = (((6-2)^2 * 0.75) + ((8-3)^2 * 1)) / 2 = 37 / 2 = 18.5
# final result = (batch_1 + batch_2) / 2 = 10.625.
# The first time we divide by number of input samples and the second time
# we divide by number of steps/batches that the loss is aggregated over.
self.assertAllClose(result, 10.625)
# We now test without passing sample_weights:
# batch_1 = ((2-0)^2) + ((4-1)^2) / 2 = 13 / 2 = 6.5
# batch_2 = ((6-2)^2) + ((8-3)^2) / 2 = 41 / 2 = 20.5
# final result = (batch_1 + batch_2) / 2 = 27 / 2 = 13.5
ds = dataset_ops.Dataset.from_tensor_slices((inputs, targets)).batch(2)
result = model.evaluate(ds, verbose=1)
self.assertAllClose(result, 13.5)
@combinations.generate(
combinations.combine(distribution=strategies_minus_default_minus_tpu,
mode=['eager']))
def test_dataset_with_sample_weights_eager_with_cloning(self, distribution):
with self.cached_session(), distribution.scope():
model = get_sample_weights_model()
optimizer = rmsprop.RMSPropOptimizer(learning_rate=0.001)
loss = 'mse'
model.compile(optimizer, loss, cloning=True)
inputs = np.array([[0], [1], [2], [3]], np.float32)
targets = np.array([[2], [4], [6], [8]], np.float32)
sample_weights = np.array([0.25, 0.5, 0.75, 1], np.float32)
ds = dataset_ops.Dataset.from_tensor_slices((inputs, targets,
sample_weights)).batch(2)
with self.assertRaisesRegexp(NotImplementedError,
'`sample_weight` is not supported when '
'using tf.distribute.Strategy in '):
model.evaluate(ds, verbose=1)
class TestRegularizerLoss(test.TestCase, parameterized.TestCase):
class IdentityRegularizer(keras.regularizers.Regularizer):
def __call__(self, x):
return array_ops.identity(x)
class AddLayer(keras.layers.Layer):
def build(self, _):
self.v = self.add_weight(
'v', (), initializer='ones',
regularizer=TestRegularizerLoss.IdentityRegularizer())
def call(self, inputs):
return inputs + self.v
@staticmethod
def loss_fn(_, y_pred):
return math_ops.reduce_mean(y_pred)
@combinations.generate(
combinations.times(
strategy_combinations.all_strategy_combinations_minus_default(),
combinations.combine(cloning=[True, False])))
def test_regularizer_loss(self, distribution, cloning):
batch_size = 2
if not distributed_training_utils.global_batch_size_supported(distribution):
batch_size //= distribution.num_replicas_in_sync
# Given an input x, which is always 1, and variable v, this model computes
# Loss=x+v+regularizer_loss, where regularizer_loss=v and the variable is
# initialized to 1. Therefore, this model computes Loss=1+2v, and so the
# gradient dLoss/dv = 2. This gradient of 2 is averaged over all examples
# in a batch and then multiplied by the learning rate of 1. As a result,
# the model update for one batch should subtract 2 from v, resulting in v
# being -1. If the regularizer loss is not scaled correctly by number of
# replicas, the variable value will be incorrect when number of replicas
# >1. For e.g. it will be -2 if num replicas = 2.
with distribution.scope():
x = keras.layers.Input(shape=(1,), batch_size=batch_size)
y = TestRegularizerLoss.AddLayer()(x)
model = keras.models.Model(inputs=x, outputs=y)
opt = gradient_descent_keras.SGD(1.)
model.compile(opt, loss=TestRegularizerLoss.loss_fn, cloning=cloning)
model.fit(
x=np.array([[1.], [1.]], dtype=np.float32),
y=np.array([[1.], [1.]], dtype=np.float32),
batch_size=batch_size)
v = model.get_weights()[0]
self.assertEqual(-1.0, v)
class TestDistributionStrategyWithKerasModels(test.TestCase,
parameterized.TestCase):
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_distribution_strategy_on_sequential_model(self, distribution,
cloning):
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
rmsprop.RMSPropOptimizer if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(learning_rate=0.001)
model = simple_sequential_model()
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
inputs = np.zeros((20, 10), np.float32)
targets = np.zeros((20, 2), np.float32)
model.fit(inputs, targets, epochs=1, steps_per_epoch=2)
model.predict(inputs, steps=1)
model.evaluate(inputs, targets, steps=1)
@combinations.generate(all_strategy_combinations_plus_cloning())
def test_distribution_strategy_on_functional_model(self, distribution,
cloning):
with distribution.scope():
# TODO(b/130808953): Re-enable the V1 optimizer after iterations is
# mirrored.
optimizer_fn = (
rmsprop.RMSPropOptimizer if cloning else gradient_descent_keras.SGD)
optimizer = optimizer_fn(learning_rate=0.001)
model = get_model()
loss = 'mse'
model.compile(optimizer, loss, cloning=cloning)
inputs = np.zeros((64, 3), dtype=np.float32)
targets = np.zeros((64, 4), dtype=np.float32)
model.fit(inputs, targets, epochs=1, steps_per_epoch=2)
model.predict(inputs, steps=1)
model.evaluate(inputs, targets, steps=1)
@combinations.generate(
combinations.times(
all_strategy_minus_default_and_tpu_combinations() +
tpu_strategy_combinations(),
combinations.combine(cloning=[True, False])))
def test_distribution_strategy_one_dimensional(self, distribution, cloning):
with distribution.scope():
inp = keras.layers.Input(shape=(10,))
out = keras.layers.Dense(3, activation='softmax')(inp)
model = keras.Model(inputs=[inp], outputs=[out])
model.compile(
optimizer='rmsprop',
loss='sparse_categorical_crossentropy',
metrics=['sparse_categorical_accuracy'],
cloning=cloning)
x = np.random.random((64, 10)).astype('float32')
y = np.random.randint(3, size=64)
model.fit(x, y, epochs=1, steps_per_epoch=2)
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus
],
mode=['graph', 'eager'],
cloning=[True, False],
reduction=[
loss_reduction.ReductionV2.SUM_OVER_BATCH_SIZE,
loss_reduction.ReductionV2.SUM
]))
def test_distribution_strategy_with_loss_reduction_types(
self, distribution, cloning, reduction):
np.random.seed(_RANDOM_SEED)
def _get_model():
inputs = keras.Input((10,))
x1 = keras.layers.Dense(10, kernel_initializer='zeros')(inputs)
x2 = keras.layers.Dense(10, kernel_initializer='zeros')(x1)
outputs = keras.layers.Dense(1, kernel_initializer='zeros')(x2)
model = keras.Model(inputs, outputs)
return model
x = np.random.random((64, 10))
y = np.random.random((64, 1))
dataset = dataset_ops.Dataset.from_tensor_slices((x, y))
dataset = dataset.batch(32)
model = _get_model()
model.compile(
'sgd', loss=keras.losses.MeanSquaredError(reduction=reduction))
history = model.fit(dataset, steps_per_epoch=2, epochs=1, shuffle=False)
with distribution.scope():
ds_model = _get_model()
ds_model.compile(
'sgd',
loss=keras.losses.MeanSquaredError(reduction=reduction),
cloning=cloning)
ds_history = ds_model.fit(
dataset, steps_per_epoch=2, epochs=1, shuffle=False)
self.assertArrayNear(history.history['loss'], ds_history.history['loss'],
1e-5)
@combinations.generate(
combinations.times(all_strategy_minus_default_and_tpu_combinations(),
combinations.combine(cloning=[True, False])))
def test_distribution_strategy_with_symbolic_add_loss(self, distribution,
cloning):
def _make_model_with_add_loss():
inputs = keras.Input((10,))
x1 = keras.layers.Dense(10, kernel_initializer='zeros')(inputs)
x2 = keras.layers.Dense(10, kernel_initializer='zeros')(x1)
outputs = keras.layers.Dense(1, kernel_initializer='zeros')(x2)
model = keras.Model(inputs, outputs)
model.add_loss(math_ops.reduce_mean(x1))
model.add_loss(math_ops.reduce_mean(outputs))
return model
x = np.ones((64, 10)).astype('float32')
model = _make_model_with_add_loss()
model.compile('sgd')
history = model.fit(x, steps_per_epoch=2, epochs=1)
with distribution.scope():
ds_model = _make_model_with_add_loss()
ds_model.compile('sgd', cloning=cloning)
ds_history = ds_model.fit(x, steps_per_epoch=2, epochs=1)
self.assertAllClose(history.history, ds_history.history)
# TODO(omalleyt): Investigate flakiness and re-enable.
@combinations.generate(all_strategy_minus_default_and_tpu_combinations())
def DISABLED_test_distribution_strategy_with_callable_add_loss(
self, distribution):
def _make_model():
inputs = keras.Input((10,))
x1 = keras.layers.Dense(10, kernel_initializer='zeros')(inputs)
x2 = keras.layers.Dense(10, kernel_initializer='zeros')(x1)
d = keras.layers.Dense(1, kernel_initializer='zeros')
outputs = d(x2)
model = keras.Model(inputs, outputs)
model.add_loss(lambda: 100. * math_ops.reduce_mean(d.kernel))
return model
x = np.ones((64, 10)).astype('float32')
y = np.ones((64, 1)).astype('float32')
model = _make_model()
self.assertLen(model.losses, 1)
model.compile('sgd', 'mse')
history = model.fit(x, y, steps_per_epoch=2, epochs=1)
with distribution.scope():
ds_model = _make_model()
self.assertLen(ds_model.losses, 1)
ds_model.compile('sgd', 'mse')
ds_history = ds_model.fit(x, y, steps_per_epoch=2, epochs=1)
self.assertAllClose(history.history, ds_history.history)
@combinations.generate(
combinations.times(all_strategy_minus_default_and_tpu_combinations(),
combinations.combine(cloning=[True, False])))
def test_distribution_strategy_with_add_metric_in_call(
self, distribution, cloning):
class Bias(keras.layers.Layer):
def build(self, input_shape):
self.bias = self.add_weight(name='bias', initializer='zeros', shape=())
def call(self, inputs):
self.add_metric(
math_ops.reduce_mean(inputs), name='bias', aggregation='mean')
return inputs + self.bias
def _make_model_with_add_metric():
inputs = keras.Input((10,))
x1 = keras.layers.Dense(10, kernel_initializer='zeros')(inputs)
x2 = Bias()(x1)
outputs = keras.layers.Dense(1, kernel_initializer='zeros')(x2)
model = keras.Model(inputs, outputs)
return model
x = np.ones((64, 10)).astype('float32')
y = np.ones((64, 1)).astype('float32')
model = _make_model_with_add_metric()
self.assertLen(model.metrics, 1)
model.compile('sgd', 'mse')
history = model.fit(
x,
y,
steps_per_epoch=2,
validation_data=(x, y),
validation_steps=2,
epochs=2)
with distribution.scope():
ds_model = _make_model_with_add_metric()
self.assertLen(ds_model.metrics, 1)
ds_model.compile('sgd', 'mse', cloning=cloning)
ds_history = ds_model.fit(
x,
y,
steps_per_epoch=2,
validation_data=(x, y),
validation_steps=2,
epochs=2)
self.assertLen(ds_model.metrics, 1)
self.assertAllClose(history.history, ds_history.history)
@combinations.generate(
combinations.combine(
distribution=[
strategy_combinations.one_device_strategy,
strategy_combinations.one_device_strategy_gpu,
strategy_combinations.mirrored_strategy_with_gpu_and_cpu,
strategy_combinations.mirrored_strategy_with_two_gpus,
],
mode=['eager'],
cloning=[False]))
def test_distribution_strategy_with_add_metric_object(self, distribution,
cloning):
class Bias(keras.layers.Layer):
def build(self, input_shape):
self.bias = self.add_weight(name='bias', initializer='zeros', shape=())
self.mean = keras.metrics.Mean(name='mean')
def call(self, inputs):
self.add_metric(self.mean(inputs))
return inputs + self.bias
def _make_model_with_add_metric_object():
inputs = keras.Input((10,))
x1 = keras.layers.Dense(10, kernel_initializer='zeros')(inputs)
x2 = Bias()(x1)
outputs = keras.layers.Dense(1, kernel_initializer='zeros')(x2)
model = keras.Model(inputs, outputs)
return model
x = np.ones((64, 10)).astype('float32')
y = np.ones((64, 1)).astype('float32')
model = _make_model_with_add_metric_object()
self.assertLen(model.metrics, 1)
model.compile('sgd', 'mse')
history = model.fit(
x,
y,
steps_per_epoch=2,
validation_data=(x, y),
validation_steps=2,
epochs=2)
with distribution.scope():
ds_model = _make_model_with_add_metric_object()
self.assertLen(ds_model.metrics, 1)
ds_model.compile('sgd', 'mse', cloning=cloning)
ds_history = ds_model.fit(
x,
y,
steps_per_epoch=2,
validation_data=(x, y),
validation_steps=2,
epochs=2)
self.assertLen(ds_model.metrics, 1)
self.assertAllClose(history.history, ds_history.history)
@combinations.generate(
combinations.times(all_strategy_minus_default_and_tpu_combinations(),
combinations.combine(cloning=[True, False])))
def test_distribution_strategy_with_add_metric_outside_call(
self, distribution, cloning):
def _make_model_with_add_metric():
inputs = keras.Input((10,))
x1 = keras.layers.Dense(10, kernel_initializer='zeros')(inputs)
outputs = keras.layers.Dense(1, kernel_initializer='zeros')(x1)
model = keras.Model(inputs, outputs)
model.add_metric(
math_ops.reduce_mean(x1), name='mid_mean', aggregation='mean')
return model
x = np.ones((64, 10)).astype('float32')
y = np.ones((64, 1)).astype('float32')
model = _make_model_with_add_metric()
self.assertLen(model.metrics, 1)
model.compile('sgd', 'mse')
history = model.fit(
x,
y,
steps_per_epoch=2,
validation_data=(x, y),
validation_steps=2,
epochs=2)
with distribution.scope():
ds_model = _make_model_with_add_metric()
self.assertLen(ds_model.metrics, 1)
ds_model.compile('sgd', 'mse', cloning=cloning)
ds_history = ds_model.fit(
x,
y,
steps_per_epoch=2,
validation_data=(x, y),
validation_steps=2,
epochs=2)
self.assertLen(ds_model.metrics, 1)
self.assertAllClose(history.history, ds_history.history)
if __name__ == '__main__':
test.main()
| {
"content_hash": "7c5645521f44c835e80a530db43f148c",
"timestamp": "",
"source": "github",
"line_count": 1749,
"max_line_length": 91,
"avg_line_length": 40.81132075471698,
"alnum_prop": 0.6425139046498269,
"repo_name": "alsrgv/tensorflow",
"id": "bd594a8862f6b0f3e2ac9126d931d4c25ebe5b1e",
"size": "72068",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tensorflow/python/keras/distribute/distribute_strategy_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3568"
},
{
"name": "Batchfile",
"bytes": "15317"
},
{
"name": "C",
"bytes": "755360"
},
{
"name": "C#",
"bytes": "8446"
},
{
"name": "C++",
"bytes": "68001148"
},
{
"name": "CMake",
"bytes": "204596"
},
{
"name": "Dockerfile",
"bytes": "73602"
},
{
"name": "Go",
"bytes": "1627121"
},
{
"name": "HTML",
"bytes": "4680118"
},
{
"name": "Java",
"bytes": "842866"
},
{
"name": "Jupyter Notebook",
"bytes": "1665584"
},
{
"name": "LLVM",
"bytes": "6536"
},
{
"name": "Makefile",
"bytes": "101157"
},
{
"name": "Objective-C",
"bytes": "104061"
},
{
"name": "Objective-C++",
"bytes": "175222"
},
{
"name": "PHP",
"bytes": "17570"
},
{
"name": "Pascal",
"bytes": "3239"
},
{
"name": "Perl",
"bytes": "7536"
},
{
"name": "Python",
"bytes": "48843099"
},
{
"name": "RobotFramework",
"bytes": "891"
},
{
"name": "Ruby",
"bytes": "4733"
},
{
"name": "Shell",
"bytes": "488241"
},
{
"name": "Smarty",
"bytes": "27495"
},
{
"name": "Swift",
"bytes": "56155"
},
{
"name": "TSQL",
"bytes": "921"
}
],
"symlink_target": ""
} |
//============================================================================
//
// Copyright (c) 1999-2015 . All Rights Reserved.
//
//----------------------------------------------------------------------------
//
// Fichero: TPDUACK.java 1.0 9/9/99
//
//
// Descripción: Clase TPDUACK.
//
// Authors:
// Alejandro García-Domínguez ([email protected])
// Antonio Berrocal Piris ([email protected])
//
// Historial:
// 07.04.2015 Changed licence to Apache 2.0
//
// This file is part of PTMF
//
// 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 ptmf;
import java.util.*;
import java.lang.*;
/**
* Clase TPDU ACK.<br>
* Hereda de la clase TPDUDatos.<br>
*
* Para crear un objeto de esta clase se tienen que usar los métodos estáticos.
* Una vez creado no puede ser modicado.<br>
*
* El formato completo del TPDU ACK es: <br>
*
* 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3<br>
* +0-1-2-3-4-5-6-7-8-9-0-1-2-3-4-5-6-7-8-9-0-1-2-3-4-5-6-7-8-9-0-1<br>
* +---------------------------------------------------------------+<br>
* + Puerto Mulitcast | Puerto Unicast +<br>
* +---------------------------------------------------------------+<br>
* + ID_GRUPO_LOCAL(4 bytes primeros) +<br>
* +---------------------------------------------------------------+<br>
* +ID_GRUPO_LOCAL(2 bytes últimos)| Longitud +<br>
* +---------------------------------------------------------------+<br>
* + Cheksum | V |0|1|0|1|1| No Usado +<br>
* +---------------------------------------------------------------+<br>
* + Número de Ráfaga Fuente | Dirección IP Fuente +<br>
* + | (16 bits superiores) +<br>
* +---------------------------------------------------------------+<br>
* + Dirección IP Fuente | Puerto Unicast Fuente +<br>
* + (16 bits superiores) | +<br>
* +---------------------------------------------------------------+<br>
* + Número de Secuencia Fuente +<br>
* +---------------------------------------------------------------+<br>
* <br>
* <br>
* Esta clase no es thread-safe.<br>
* @see Buffer
* @version 1.0
* @author M. Alejandro García Domínguez
* <A HREF="mailto:[email protected]">([email protected])</A><p>
* Antonio Berrocal Piris
* <A HREF="mailto:AntonioBP.wanadoo.es">([email protected])</A><p>
*/
public class TPDUACK extends TPDUDatos
{
// ATRIBUTOS
/** Tamaño de la cabecera del TPDUACK*/
static final int LONGHEADER = 7 * 4;
/**
* Número de Ráfaga Fuente (16 bits):
*/
int NUMERO_RAFAGA_FUENTE = 0;
/**
* Dirección IP Fuente (32 bits): dirección IP del socket que originó los datos.
*/
IPv4 DIR_IP_FUENTE = null;
/**
* Puerto Unicast Fuente (16 bits): puerto unicast fuente
*/
int PUERTO_UNICAST_FUENTE = 0;
/**
* Número de secuencia (32 bits): número de secuencia del TPDU que estoy
* asentiendo.
*/
NumeroSecuencia NUMERO_SECUENCIA_FUENTE = null;
/**
* Se forma con el valor de otros campos.<br>
* <ul>ID TPDU Fuente : (10 bytes)
* <li><ul>ID Socket Fuente (6 byte)
* <li>Dirección IP Fuente (4 byte)</li>
* <li>Puerto Unicast Fuente (2 byte)</li></ul></li>
* <li>Número secuencia Fuente (4 bytes)</li></ul>
*/
private ID_TPDU ID_TPDU_FUENTE = null;
//==========================================================================
/**
* Constructor por defecto.
* Este constructor es para crear TPDUS a partir del parser de un Buffer
* @exception PTMFExcepcion
* @exception ParametroInvalido Se lanza en el constructor de la clase TPDU.
*/
private TPDUACK ()
throws ParametroInvalidoExcepcion,PTMFExcepcion
{
super();
}
//==========================================================================
/**
* Constructor utilizado para crear un TPDUACK.
* @param socketPTMFImp Objeto SocketPTMFImp del que obtiene el valor de los
* campos de la cabecera común.
* @exception PTMFExcepcion
* @exception ParametroInvalidoExcepcion lanzada si socketPTMFImp es null
*/
private TPDUACK (SocketPTMFImp socketPTMFImp)
throws PTMFExcepcion,ParametroInvalidoExcepcion
{
super (socketPTMFImp);
}
//============================================================================
/**
* Crea un TPDUACK con la información facilitada.
* @param socketPTMFImp Objeto SocketPTMFImp del que obtiene el valor de los
* campos de la cabecera común.
* @param numeroRafagaFuente número de ráfaga fuente
* @param dirIPFuente dirección IP Fuente
* @param nSec número secuencia
* @param puertoUnicastFuente puerto unicast fuente
* @return objeto TPDUACK creado.
* @exception ParametroInvalidoExcepcion si alguno de los parámetros es erróneo.
* @exception PTMFExcepcion si hay un error al crear el TPDUACK
*/
static TPDUACK crearTPDUACK (SocketPTMFImp socketPTMFImp,
int numeroRafagaFuente,
IPv4 dirIPFuente,
NumeroSecuencia nSec,
int puertoUnicastFuente)
throws ParametroInvalidoExcepcion, PTMFExcepcion
{
// Crear el TPDUDatos vacio
TPDUACK resultTPDU = new TPDUACK (socketPTMFImp);
// Guardar los datos en la cabecera para cuando sean pedidos
resultTPDU.NUMERO_RAFAGA_FUENTE = numeroRafagaFuente;
resultTPDU.DIR_IP_FUENTE = dirIPFuente;
resultTPDU.NUMERO_SECUENCIA_FUENTE = (NumeroSecuencia)nSec.clone();
resultTPDU.PUERTO_UNICAST_FUENTE = puertoUnicastFuente;
return resultTPDU;
}
//==========================================================================
/**
* Construir el TPDU ACK, devuelve un buffer con el contenido del TPDUACK,
* según el formato especificado en el protocolo.
* <b>Este buffer no debe de ser modificado.</B>
* @return un buffer con el TPDUACK.
* @exception PTMFExcepcion Se lanza si ocurre algún error en la construcción
* del TPDU
* @exception ParametroInvalidoExcepcion lanzada si ocurre algún error en la
* construcción del TPDU
*/
Buffer construirTPDUACK () throws PTMFExcepcion,ParametroInvalidoExcepcion
{
final String mn = "TPDU.construirTPDUDatos";
int offset = 14;
// Crear la cabecera común a todos los TPDU
Buffer bufferResult = construirCabeceraComun (PTMF.SUBTIPO_TPDU_DATOS_ACK,
TPDUACK.LONGHEADER);
if (bufferResult == null)
throw new PTMFExcepcion ("No se ha podido crear el buffer");
// 15º BYTE : Subtipo: (3 bits )
short anterior = bufferResult.getByte (offset);
// anterior : XXXX XXXX
// and : 1111 1110 = 0xFE
// ----------
// XXXX XXX0
anterior &= 0xFE;
bufferResult.addByte((byte)anterior,offset);
offset ++;
// 16º BYTE : No usado
bufferResult.addByte ((byte)0,offset);
offset ++;
// 17º y 18º BYTE : Número de Ráfaga Fuente
bufferResult.addShort (this.NUMERO_RAFAGA_FUENTE,offset);
offset+=2;
// 19º, 20º, 21º y 22º BYTE : Dirección IP Fuente
bufferResult.addBytes (this.DIR_IP_FUENTE.ipv4,0,offset,4);
offset+=4;
// 23º y 24º BYTE : Puerto Unicast Fuente
bufferResult.addShort (this.PUERTO_UNICAST_FUENTE,offset);
offset+=2;
// 25º, 26º, 27º y 28º BYTE : Número de Secuencia
bufferResult.addInt (this.NUMERO_SECUENCIA_FUENTE.tolong(),offset);
offset += 4;
return bufferResult;
}
//==========================================================================
/**
* Parse un Buffer de datos recibidos y crea un TPDU ACK que lo encapsule.
* El buffer debe de contener un TPDU ACK.
* @param buf Un buffer que contiene el TPDU ACK recibido.
* @param ipv4Emisor dirección IP unicast del emisor del ACK.
* @return Un objeto TPDUACK
* @exception PTMFExcepcion El buffer pasado no contiene una cabecera TPDU
* correcta, el mensaje de la excepción especifica el tipo de error.
* @exception ParametroInvalidoExcepcion Se lanza si el buffer pasado no
* contiene un TPDUACK válido.
*/
static TPDUACK parserBuffer (Buffer buffer,IPv4 ipv4Emisor)
throws PTMFExcepcion,ParametroInvalidoExcepcion
{
int aux;
int offset = 16;
// Crear el TPDUDatos.
if (buffer==null)
throw new ParametroInvalidoExcepcion ("Buffer nulo");
TPDUACK tpduACK = new TPDUACK ();
// Analizar los datos comunes
TPDUDatos.parseCabeceraComun (buffer,tpduACK,ipv4Emisor);
// Comprobar si el tipo es correcto
if (tpduACK.SUBTIPO != PTMF.SUBTIPO_TPDU_DATOS_ACK)
throw new PTMFExcepcion ("El subtipo del TPDU Datos no es correcto");
// 15º BYTE : SUBTIPO (3 BITS) ACK (1 BIT)
//
// 16º BYTE : No usado
//
//
// 17º y 18º BYTE : Número de ráfaga fuente
//
tpduACK.NUMERO_RAFAGA_FUENTE = buffer.getShort (offset);
offset+=2;
//
// 19º, 20º, 21º y 22º BYTE : Dirección IP fuente
//
tpduACK.DIR_IP_FUENTE = new IPv4 (new Buffer (buffer.getBytes (offset,4)));
offset+=4;
//
// 23º y 24º BYTE : Puerto Unicast Fuente
//
tpduACK.PUERTO_UNICAST_FUENTE = buffer.getShort (offset);
offset += 2;
//
// 25º, 26º, 27º y 28º BYTE : Número de secuencia
//
tpduACK.NUMERO_SECUENCIA_FUENTE = new NumeroSecuencia (buffer.getInt (offset));
offset+=4;
return tpduACK;
}
//===========================================================================
/**
* Devuelve una cadena informativa del TPDU ACK
*/
public String toString()
{
return "===================================================="+
"\nPuerto Multicast: " + this.getPuertoMulticast() +
"\nPuerto Unicast: " + this.getPuertoUnicast() +
"\nIDGL: " + this.ID_GRUPO_LOCAL +
"\nLongitud: " + this.LONGITUD +
"\nCHECKSUM: " + this.CHEKSUM +
"\nVersion: " + this.VERSION +
"\nTipo: " + this.TIPO +
"\nNúmero Ráfaga Fuente: " + this.NUMERO_RAFAGA_FUENTE +
"\nIP fuente: " + this.DIR_IP_FUENTE +
"\nPuerto Unicast Fuente: " + this.PUERTO_UNICAST_FUENTE +
"\nNúmero Secuencia Fuente: " + this.NUMERO_SECUENCIA_FUENTE +
"\nSubtipo: " + PTMF.SUBTIPO_TPDU_DATOS_ACK+
"\n====================================================";
}
//==========================================================================
/**
* Devuelve el {@link #ID_TPDU_FUENTE ID_TDPU Fuente}.
*/
ID_TPDU getID_TPDUFuente ()
{
if (ID_TPDU_FUENTE == null)
{
try {
ID_Socket id_SocketFuente = new ID_Socket
(this.DIR_IP_FUENTE,this.PUERTO_UNICAST_FUENTE);
this.ID_TPDU_FUENTE = new ID_TPDU (id_SocketFuente,this.NUMERO_SECUENCIA_FUENTE);
} catch (ParametroInvalidoExcepcion e){}
}
return this.ID_TPDU_FUENTE;
}
//==========================================================================
/**
* Devuelve el número de ráfaga fuente.
*/
int getNumeroRafagaFuente ()
{
return this.NUMERO_RAFAGA_FUENTE;
}
} // Fin de la clase.
| {
"content_hash": "034e344f6d270175d60cb8bd148746d6",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 102,
"avg_line_length": 27.658198614318707,
"alnum_prop": 0.552438209752839,
"repo_name": "iacobus-net/ptmf",
"id": "ae1b48ba5d95f612b654bf81c6f597a09ab39256",
"size": "11976",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ptmf/TPDUACK.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "6515"
},
{
"name": "Java",
"bytes": "1591187"
}
],
"symlink_target": ""
} |
package com.thoughtworks.go.server.service.materials.commands;
import java.io.Serializable;
import java.util.HashMap;
import com.thoughtworks.go.config.CaseInsensitiveString;
import com.thoughtworks.go.config.PipelineConfig;
import com.thoughtworks.go.config.materials.PackageMaterialConfig;
import com.thoughtworks.go.domain.packagerepository.PackageDefinitionMother;
import com.thoughtworks.go.server.domain.Username;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
public class PackageMaterialUpdateWithNewPackageDefinitionCommandTest extends PackageMaterialSaveCommandTestBase {
private PipelineConfig pipelineConfig;
private PackageMaterialConfig materialToBeUpdated;
@Before
public void setUp() throws Exception {
pipelineConfig = cruiseConfig.pipelineConfigByName(new CaseInsensitiveString(pipelineName));
materialToBeUpdated = (PackageMaterialConfig) pipelineConfig.materialConfigs().first();
}
@Test
public void shouldUpdateMaterialWithNewPackageDefinition() {
String repoId = "repo1";
String pkgName = "pkg-2";
HashMap<String, Serializable> params = PackageDefinitionMother.paramsForPackageMaterialCreation(repoId, pkgName);
PackageMaterialUpdateWithNewPackageDefinitionCommand command = new PackageMaterialUpdateWithNewPackageDefinitionCommand(packageDefinitionService,
securityService, pipelineName, materialToBeUpdated, admin, params);
command.update(cruiseConfig);
assertThat(pipelineConfig.materialConfigs().first() instanceof PackageMaterialConfig, is(true));
PackageMaterialConfig editedMaterial = (PackageMaterialConfig) pipelineConfig.materialConfigs().first();
assertThat(editedMaterial, is(materialToBeUpdated));
assertThat(editedMaterial.getPackageDefinition(), is(notNullValue()));
assertThat(editedMaterial.getPackageDefinition().getId(), is(notNullValue()));
assertThat(editedMaterial.getPackageDefinition().getRepository().getId(), is(repoId));
assertThat(editedMaterial.getPackageDefinition().getName(), is(pkgName));
assertThat(editedMaterial.getPackageDefinition().getConfiguration().size(), is(2));
assertThat(editedMaterial.getPackageDefinition().getConfiguration().getProperty("key1").getConfigurationValue().getValue(), is("value1"));
assertThat(editedMaterial.getPackageDefinition().getConfiguration().getProperty("key2").getConfigurationValue().getValue(), is("value2"));
verify(packageDefinitionService, times(1)).performPluginValidationsFor(editedMaterial.getPackageDefinition());
}
@Test
public void shouldHandleDeletedPackageRepo() {
String repoId = "deleted-repo";
String pkgName = "pkg-2";
HashMap<String, Serializable> params = PackageDefinitionMother.paramsForPackageMaterialCreation(repoId, pkgName);
PackageMaterialUpdateWithNewPackageDefinitionCommand command = new PackageMaterialUpdateWithNewPackageDefinitionCommand(packageDefinitionService,
securityService, pipelineName, materialToBeUpdated, admin, params);
command.update(cruiseConfig);
assertThat(pipelineConfig.materialConfigs().first() instanceof PackageMaterialConfig, is(true));
PackageMaterialConfig editedMaterial = (PackageMaterialConfig) pipelineConfig.materialConfigs().first();
assertThat(editedMaterial, is(materialToBeUpdated));
assertThat(editedMaterial.getPackageDefinition(), is(notNullValue()));
assertThat(editedMaterial.getPackageDefinition().getId(), is(nullValue()));
assertThat(editedMaterial.getPackageDefinition().getRepository(), is(nullValue()));
assertThat(editedMaterial.getPackageDefinition().getName(), is(pkgName));
assertThat(editedMaterial.getPackageDefinition().getConfiguration().size(), is(0));
verify(packageDefinitionService, never()).performPluginValidationsFor(editedMaterial.getPackageDefinition());
}
@Override
protected PackageMaterialSaveCommand getCommand(Username username) {
return new PackageMaterialUpdateWithNewPackageDefinitionCommand(packageDefinitionService, securityService, pipelineName,
materialToBeUpdated, username, PackageDefinitionMother.paramsForPackageMaterialCreation("repo1", "repo1-pkg-1"));
}
}
| {
"content_hash": "c41524ed710328c91dfedfb47c67b9d1",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 153,
"avg_line_length": 52.88636363636363,
"alnum_prop": 0.7754619681993984,
"repo_name": "kierarad/gocd",
"id": "ce6c3a2b2d4b98fbe93812fa9ce683ff53d5f315",
"size": "5255",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "server/src/test-fast/java/com/thoughtworks/go/server/service/materials/commands/PackageMaterialUpdateWithNewPackageDefinitionCommandTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "466"
},
{
"name": "CSS",
"bytes": "811678"
},
{
"name": "FreeMarker",
"bytes": "9764"
},
{
"name": "Groovy",
"bytes": "1807719"
},
{
"name": "HTML",
"bytes": "711872"
},
{
"name": "Java",
"bytes": "20248829"
},
{
"name": "JavaScript",
"bytes": "2817322"
},
{
"name": "NSIS",
"bytes": "23526"
},
{
"name": "PowerShell",
"bytes": "691"
},
{
"name": "Ruby",
"bytes": "2282141"
},
{
"name": "Shell",
"bytes": "169000"
},
{
"name": "TSQL",
"bytes": "200114"
},
{
"name": "TypeScript",
"bytes": "2498330"
},
{
"name": "XSLT",
"bytes": "197778"
}
],
"symlink_target": ""
} |
package edu.javacourse.hibernate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
@Entity
@Table(name = "jc_cash_payment")
@PrimaryKeyJoinColumn(name = "PAYMENT_ID")
public class CashPayment extends Payment {
@Column(name = "CASH_DESK")
private String cashDesk;
public String getCashDesk() {
return cashDesk;
}
public void setCashDesk(String cashDesk) {
this.cashDesk = cashDesk;
}
@Override
public String toString() {
return "CashPayment{" +
"cashDesk='" + cashDesk + '\'' +
"} " + super.toString();
}
}
| {
"content_hash": "b856e4b99fd5dad12c165da93a90d206",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 48,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.6514285714285715,
"repo_name": "java-course-ee/java-course-ee",
"id": "ca690a3bf68dd5e963c2baabc265e176979759e7",
"size": "700",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Hibernate/part2/hibernate-inheritance-joined/src/main/java/edu/javacourse/hibernate/CashPayment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3751"
},
{
"name": "Dockerfile",
"bytes": "2363"
},
{
"name": "HTML",
"bytes": "51899"
},
{
"name": "Java",
"bytes": "573911"
},
{
"name": "JavaScript",
"bytes": "52"
},
{
"name": "Shell",
"bytes": "507"
},
{
"name": "TSQL",
"bytes": "2047"
},
{
"name": "XSLT",
"bytes": "1122"
}
],
"symlink_target": ""
} |
describe("Platform", function() {
// We need to check for platforms that do not support the Web MIDI API nor the JazzPlugin (such
// as Firefox 52+.
it("should be checked to make sure current environment is supported.");
});
| {
"content_hash": "5e0efcb8664999478939a506b7b8b346",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 97,
"avg_line_length": 33.285714285714285,
"alnum_prop": 0.7081545064377682,
"repo_name": "cotejp/webmidi",
"id": "11d12d0d3b4fde0d243e939c9a940cf8e14ecd97",
"size": "233",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/browser/platform.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1592"
},
{
"name": "JavaScript",
"bytes": "187790"
}
],
"symlink_target": ""
} |
/* NOTE - eventually this file will be automatically updated using a Perl script that understand
* the naming of test case files, functions, and namespaces.
*/
#include <time.h> /* for time() */
#include <stdlib.h> /* for srand() */
#include "std_testcase.h"
#include "testcases.h"
int main(int argc, char * argv[]) {
/* seed randomness */
srand( (unsigned)time(NULL) );
globalArgc = argc;
globalArgv = argv;
#ifndef OMITGOOD
/* Calling C good functions */
/* BEGIN-AUTOGENERATED-C-GOOD-FUNCTION-CALLS */
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_01_good();");
CWE476_NULL_Pointer_Dereference__binary_if_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_02_good();");
CWE476_NULL_Pointer_Dereference__binary_if_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_03_good();");
CWE476_NULL_Pointer_Dereference__binary_if_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_04_good();");
CWE476_NULL_Pointer_Dereference__binary_if_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_05_good();");
CWE476_NULL_Pointer_Dereference__binary_if_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_06_good();");
CWE476_NULL_Pointer_Dereference__binary_if_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_07_good();");
CWE476_NULL_Pointer_Dereference__binary_if_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_08_good();");
CWE476_NULL_Pointer_Dereference__binary_if_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_09_good();");
CWE476_NULL_Pointer_Dereference__binary_if_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_10_good();");
CWE476_NULL_Pointer_Dereference__binary_if_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_11_good();");
CWE476_NULL_Pointer_Dereference__binary_if_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_12_good();");
CWE476_NULL_Pointer_Dereference__binary_if_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_13_good();");
CWE476_NULL_Pointer_Dereference__binary_if_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_14_good();");
CWE476_NULL_Pointer_Dereference__binary_if_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_15_good();");
CWE476_NULL_Pointer_Dereference__binary_if_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_16_good();");
CWE476_NULL_Pointer_Dereference__binary_if_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_17_good();");
CWE476_NULL_Pointer_Dereference__binary_if_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_18_good();");
CWE476_NULL_Pointer_Dereference__binary_if_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_01_good();");
CWE476_NULL_Pointer_Dereference__char_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_02_good();");
CWE476_NULL_Pointer_Dereference__char_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_03_good();");
CWE476_NULL_Pointer_Dereference__char_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_04_good();");
CWE476_NULL_Pointer_Dereference__char_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_05_good();");
CWE476_NULL_Pointer_Dereference__char_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_06_good();");
CWE476_NULL_Pointer_Dereference__char_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_07_good();");
CWE476_NULL_Pointer_Dereference__char_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_08_good();");
CWE476_NULL_Pointer_Dereference__char_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_09_good();");
CWE476_NULL_Pointer_Dereference__char_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_10_good();");
CWE476_NULL_Pointer_Dereference__char_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_11_good();");
CWE476_NULL_Pointer_Dereference__char_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_12_good();");
CWE476_NULL_Pointer_Dereference__char_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_13_good();");
CWE476_NULL_Pointer_Dereference__char_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_14_good();");
CWE476_NULL_Pointer_Dereference__char_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_15_good();");
CWE476_NULL_Pointer_Dereference__char_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_16_good();");
CWE476_NULL_Pointer_Dereference__char_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_17_good();");
CWE476_NULL_Pointer_Dereference__char_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_18_good();");
CWE476_NULL_Pointer_Dereference__char_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_21_good();");
CWE476_NULL_Pointer_Dereference__char_21_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_22_good();");
CWE476_NULL_Pointer_Dereference__char_22_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_31_good();");
CWE476_NULL_Pointer_Dereference__char_31_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_32_good();");
CWE476_NULL_Pointer_Dereference__char_32_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_34_good();");
CWE476_NULL_Pointer_Dereference__char_34_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_41_good();");
CWE476_NULL_Pointer_Dereference__char_41_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_44_good();");
CWE476_NULL_Pointer_Dereference__char_44_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_45_good();");
CWE476_NULL_Pointer_Dereference__char_45_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_51_good();");
CWE476_NULL_Pointer_Dereference__char_51_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_52_good();");
CWE476_NULL_Pointer_Dereference__char_52_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_53_good();");
CWE476_NULL_Pointer_Dereference__char_53_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_54_good();");
CWE476_NULL_Pointer_Dereference__char_54_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_63_good();");
CWE476_NULL_Pointer_Dereference__char_63_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_64_good();");
CWE476_NULL_Pointer_Dereference__char_64_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_65_good();");
CWE476_NULL_Pointer_Dereference__char_65_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_66_good();");
CWE476_NULL_Pointer_Dereference__char_66_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_67_good();");
CWE476_NULL_Pointer_Dereference__char_67_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_68_good();");
CWE476_NULL_Pointer_Dereference__char_68_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_01_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_02_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_03_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_04_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_05_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_06_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_07_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_08_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_09_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_10_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_11_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_12_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_13_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_14_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_15_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_16_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_17_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_18_good();");
CWE476_NULL_Pointer_Dereference__deref_after_check_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_01_good();");
CWE476_NULL_Pointer_Dereference__int64_t_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_02_good();");
CWE476_NULL_Pointer_Dereference__int64_t_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_03_good();");
CWE476_NULL_Pointer_Dereference__int64_t_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_04_good();");
CWE476_NULL_Pointer_Dereference__int64_t_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_05_good();");
CWE476_NULL_Pointer_Dereference__int64_t_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_06_good();");
CWE476_NULL_Pointer_Dereference__int64_t_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_07_good();");
CWE476_NULL_Pointer_Dereference__int64_t_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_08_good();");
CWE476_NULL_Pointer_Dereference__int64_t_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_09_good();");
CWE476_NULL_Pointer_Dereference__int64_t_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_10_good();");
CWE476_NULL_Pointer_Dereference__int64_t_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_11_good();");
CWE476_NULL_Pointer_Dereference__int64_t_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_12_good();");
CWE476_NULL_Pointer_Dereference__int64_t_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_13_good();");
CWE476_NULL_Pointer_Dereference__int64_t_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_14_good();");
CWE476_NULL_Pointer_Dereference__int64_t_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_15_good();");
CWE476_NULL_Pointer_Dereference__int64_t_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_16_good();");
CWE476_NULL_Pointer_Dereference__int64_t_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_17_good();");
CWE476_NULL_Pointer_Dereference__int64_t_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_18_good();");
CWE476_NULL_Pointer_Dereference__int64_t_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_21_good();");
CWE476_NULL_Pointer_Dereference__int64_t_21_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_22_good();");
CWE476_NULL_Pointer_Dereference__int64_t_22_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_31_good();");
CWE476_NULL_Pointer_Dereference__int64_t_31_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_32_good();");
CWE476_NULL_Pointer_Dereference__int64_t_32_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_34_good();");
CWE476_NULL_Pointer_Dereference__int64_t_34_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_41_good();");
CWE476_NULL_Pointer_Dereference__int64_t_41_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_44_good();");
CWE476_NULL_Pointer_Dereference__int64_t_44_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_45_good();");
CWE476_NULL_Pointer_Dereference__int64_t_45_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_51_good();");
CWE476_NULL_Pointer_Dereference__int64_t_51_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_52_good();");
CWE476_NULL_Pointer_Dereference__int64_t_52_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_53_good();");
CWE476_NULL_Pointer_Dereference__int64_t_53_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_54_good();");
CWE476_NULL_Pointer_Dereference__int64_t_54_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_63_good();");
CWE476_NULL_Pointer_Dereference__int64_t_63_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_64_good();");
CWE476_NULL_Pointer_Dereference__int64_t_64_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_65_good();");
CWE476_NULL_Pointer_Dereference__int64_t_65_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_66_good();");
CWE476_NULL_Pointer_Dereference__int64_t_66_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_67_good();");
CWE476_NULL_Pointer_Dereference__int64_t_67_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_68_good();");
CWE476_NULL_Pointer_Dereference__int64_t_68_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_01_good();");
CWE476_NULL_Pointer_Dereference__int_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_02_good();");
CWE476_NULL_Pointer_Dereference__int_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_03_good();");
CWE476_NULL_Pointer_Dereference__int_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_04_good();");
CWE476_NULL_Pointer_Dereference__int_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_05_good();");
CWE476_NULL_Pointer_Dereference__int_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_06_good();");
CWE476_NULL_Pointer_Dereference__int_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_07_good();");
CWE476_NULL_Pointer_Dereference__int_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_08_good();");
CWE476_NULL_Pointer_Dereference__int_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_09_good();");
CWE476_NULL_Pointer_Dereference__int_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_10_good();");
CWE476_NULL_Pointer_Dereference__int_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_11_good();");
CWE476_NULL_Pointer_Dereference__int_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_12_good();");
CWE476_NULL_Pointer_Dereference__int_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_13_good();");
CWE476_NULL_Pointer_Dereference__int_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_14_good();");
CWE476_NULL_Pointer_Dereference__int_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_15_good();");
CWE476_NULL_Pointer_Dereference__int_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_16_good();");
CWE476_NULL_Pointer_Dereference__int_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_17_good();");
CWE476_NULL_Pointer_Dereference__int_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_18_good();");
CWE476_NULL_Pointer_Dereference__int_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_21_good();");
CWE476_NULL_Pointer_Dereference__int_21_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_22_good();");
CWE476_NULL_Pointer_Dereference__int_22_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_31_good();");
CWE476_NULL_Pointer_Dereference__int_31_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_32_good();");
CWE476_NULL_Pointer_Dereference__int_32_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_34_good();");
CWE476_NULL_Pointer_Dereference__int_34_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_41_good();");
CWE476_NULL_Pointer_Dereference__int_41_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_44_good();");
CWE476_NULL_Pointer_Dereference__int_44_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_45_good();");
CWE476_NULL_Pointer_Dereference__int_45_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_51_good();");
CWE476_NULL_Pointer_Dereference__int_51_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_52_good();");
CWE476_NULL_Pointer_Dereference__int_52_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_53_good();");
CWE476_NULL_Pointer_Dereference__int_53_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_54_good();");
CWE476_NULL_Pointer_Dereference__int_54_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_63_good();");
CWE476_NULL_Pointer_Dereference__int_63_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_64_good();");
CWE476_NULL_Pointer_Dereference__int_64_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_65_good();");
CWE476_NULL_Pointer_Dereference__int_65_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_66_good();");
CWE476_NULL_Pointer_Dereference__int_66_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_67_good();");
CWE476_NULL_Pointer_Dereference__int_67_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_68_good();");
CWE476_NULL_Pointer_Dereference__int_68_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_01_good();");
CWE476_NULL_Pointer_Dereference__long_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_02_good();");
CWE476_NULL_Pointer_Dereference__long_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_03_good();");
CWE476_NULL_Pointer_Dereference__long_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_04_good();");
CWE476_NULL_Pointer_Dereference__long_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_05_good();");
CWE476_NULL_Pointer_Dereference__long_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_06_good();");
CWE476_NULL_Pointer_Dereference__long_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_07_good();");
CWE476_NULL_Pointer_Dereference__long_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_08_good();");
CWE476_NULL_Pointer_Dereference__long_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_09_good();");
CWE476_NULL_Pointer_Dereference__long_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_10_good();");
CWE476_NULL_Pointer_Dereference__long_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_11_good();");
CWE476_NULL_Pointer_Dereference__long_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_12_good();");
CWE476_NULL_Pointer_Dereference__long_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_13_good();");
CWE476_NULL_Pointer_Dereference__long_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_14_good();");
CWE476_NULL_Pointer_Dereference__long_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_15_good();");
CWE476_NULL_Pointer_Dereference__long_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_16_good();");
CWE476_NULL_Pointer_Dereference__long_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_17_good();");
CWE476_NULL_Pointer_Dereference__long_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_18_good();");
CWE476_NULL_Pointer_Dereference__long_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_21_good();");
CWE476_NULL_Pointer_Dereference__long_21_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_22_good();");
CWE476_NULL_Pointer_Dereference__long_22_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_31_good();");
CWE476_NULL_Pointer_Dereference__long_31_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_32_good();");
CWE476_NULL_Pointer_Dereference__long_32_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_34_good();");
CWE476_NULL_Pointer_Dereference__long_34_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_41_good();");
CWE476_NULL_Pointer_Dereference__long_41_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_44_good();");
CWE476_NULL_Pointer_Dereference__long_44_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_45_good();");
CWE476_NULL_Pointer_Dereference__long_45_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_51_good();");
CWE476_NULL_Pointer_Dereference__long_51_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_52_good();");
CWE476_NULL_Pointer_Dereference__long_52_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_53_good();");
CWE476_NULL_Pointer_Dereference__long_53_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_54_good();");
CWE476_NULL_Pointer_Dereference__long_54_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_63_good();");
CWE476_NULL_Pointer_Dereference__long_63_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_64_good();");
CWE476_NULL_Pointer_Dereference__long_64_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_65_good();");
CWE476_NULL_Pointer_Dereference__long_65_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_66_good();");
CWE476_NULL_Pointer_Dereference__long_66_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_67_good();");
CWE476_NULL_Pointer_Dereference__long_67_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_68_good();");
CWE476_NULL_Pointer_Dereference__long_68_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_01_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_02_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_03_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_04_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_05_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_06_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_07_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_08_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_09_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_10_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_11_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_12_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_13_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_14_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_15_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_16_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_17_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_18_good();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_01_good();");
CWE476_NULL_Pointer_Dereference__struct_01_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_02_good();");
CWE476_NULL_Pointer_Dereference__struct_02_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_03_good();");
CWE476_NULL_Pointer_Dereference__struct_03_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_04_good();");
CWE476_NULL_Pointer_Dereference__struct_04_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_05_good();");
CWE476_NULL_Pointer_Dereference__struct_05_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_06_good();");
CWE476_NULL_Pointer_Dereference__struct_06_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_07_good();");
CWE476_NULL_Pointer_Dereference__struct_07_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_08_good();");
CWE476_NULL_Pointer_Dereference__struct_08_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_09_good();");
CWE476_NULL_Pointer_Dereference__struct_09_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_10_good();");
CWE476_NULL_Pointer_Dereference__struct_10_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_11_good();");
CWE476_NULL_Pointer_Dereference__struct_11_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_12_good();");
CWE476_NULL_Pointer_Dereference__struct_12_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_13_good();");
CWE476_NULL_Pointer_Dereference__struct_13_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_14_good();");
CWE476_NULL_Pointer_Dereference__struct_14_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_15_good();");
CWE476_NULL_Pointer_Dereference__struct_15_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_16_good();");
CWE476_NULL_Pointer_Dereference__struct_16_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_17_good();");
CWE476_NULL_Pointer_Dereference__struct_17_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_18_good();");
CWE476_NULL_Pointer_Dereference__struct_18_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_21_good();");
CWE476_NULL_Pointer_Dereference__struct_21_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_22_good();");
CWE476_NULL_Pointer_Dereference__struct_22_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_31_good();");
CWE476_NULL_Pointer_Dereference__struct_31_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_32_good();");
CWE476_NULL_Pointer_Dereference__struct_32_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_34_good();");
CWE476_NULL_Pointer_Dereference__struct_34_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_41_good();");
CWE476_NULL_Pointer_Dereference__struct_41_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_44_good();");
CWE476_NULL_Pointer_Dereference__struct_44_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_45_good();");
CWE476_NULL_Pointer_Dereference__struct_45_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_51_good();");
CWE476_NULL_Pointer_Dereference__struct_51_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_52_good();");
CWE476_NULL_Pointer_Dereference__struct_52_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_53_good();");
CWE476_NULL_Pointer_Dereference__struct_53_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_54_good();");
CWE476_NULL_Pointer_Dereference__struct_54_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_63_good();");
CWE476_NULL_Pointer_Dereference__struct_63_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_64_good();");
CWE476_NULL_Pointer_Dereference__struct_64_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_65_good();");
CWE476_NULL_Pointer_Dereference__struct_65_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_66_good();");
CWE476_NULL_Pointer_Dereference__struct_66_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_67_good();");
CWE476_NULL_Pointer_Dereference__struct_67_good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_68_good();");
CWE476_NULL_Pointer_Dereference__struct_68_good();
/* END-AUTOGENERATED-C-GOOD-FUNCTION-CALLS */
#ifdef __cplusplus
/* Calling C++ good functions */
/* BEGIN-AUTOGENERATED-CPP-GOOD-FUNCTION-CALLS */
printLine("Calling CWE476_NULL_Pointer_Dereference__char_33::good();");
CWE476_NULL_Pointer_Dereference__char_33::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_72::good();");
CWE476_NULL_Pointer_Dereference__char_72::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_73::good();");
CWE476_NULL_Pointer_Dereference__char_73::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_74::good();");
CWE476_NULL_Pointer_Dereference__char_74::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_81::good();");
CWE476_NULL_Pointer_Dereference__char_81::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_82::good();");
CWE476_NULL_Pointer_Dereference__char_82::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_01::good();");
CWE476_NULL_Pointer_Dereference__class_01::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_02::good();");
CWE476_NULL_Pointer_Dereference__class_02::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_03::good();");
CWE476_NULL_Pointer_Dereference__class_03::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_04::good();");
CWE476_NULL_Pointer_Dereference__class_04::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_05::good();");
CWE476_NULL_Pointer_Dereference__class_05::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_06::good();");
CWE476_NULL_Pointer_Dereference__class_06::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_07::good();");
CWE476_NULL_Pointer_Dereference__class_07::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_08::good();");
CWE476_NULL_Pointer_Dereference__class_08::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_09::good();");
CWE476_NULL_Pointer_Dereference__class_09::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_10::good();");
CWE476_NULL_Pointer_Dereference__class_10::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_11::good();");
CWE476_NULL_Pointer_Dereference__class_11::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_12::good();");
CWE476_NULL_Pointer_Dereference__class_12::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_13::good();");
CWE476_NULL_Pointer_Dereference__class_13::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_14::good();");
CWE476_NULL_Pointer_Dereference__class_14::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_15::good();");
CWE476_NULL_Pointer_Dereference__class_15::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_16::good();");
CWE476_NULL_Pointer_Dereference__class_16::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_17::good();");
CWE476_NULL_Pointer_Dereference__class_17::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_18::good();");
CWE476_NULL_Pointer_Dereference__class_18::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_21::good();");
CWE476_NULL_Pointer_Dereference__class_21::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_22::good();");
CWE476_NULL_Pointer_Dereference__class_22::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_31::good();");
CWE476_NULL_Pointer_Dereference__class_31::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_32::good();");
CWE476_NULL_Pointer_Dereference__class_32::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_33::good();");
CWE476_NULL_Pointer_Dereference__class_33::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_34::good();");
CWE476_NULL_Pointer_Dereference__class_34::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_41::good();");
CWE476_NULL_Pointer_Dereference__class_41::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_44::good();");
CWE476_NULL_Pointer_Dereference__class_44::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_45::good();");
CWE476_NULL_Pointer_Dereference__class_45::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_51::good();");
CWE476_NULL_Pointer_Dereference__class_51::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_52::good();");
CWE476_NULL_Pointer_Dereference__class_52::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_53::good();");
CWE476_NULL_Pointer_Dereference__class_53::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_54::good();");
CWE476_NULL_Pointer_Dereference__class_54::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_63::good();");
CWE476_NULL_Pointer_Dereference__class_63::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_64::good();");
CWE476_NULL_Pointer_Dereference__class_64::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_65::good();");
CWE476_NULL_Pointer_Dereference__class_65::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_66::good();");
CWE476_NULL_Pointer_Dereference__class_66::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_67::good();");
CWE476_NULL_Pointer_Dereference__class_67::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_68::good();");
CWE476_NULL_Pointer_Dereference__class_68::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_72::good();");
CWE476_NULL_Pointer_Dereference__class_72::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_73::good();");
CWE476_NULL_Pointer_Dereference__class_73::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_74::good();");
CWE476_NULL_Pointer_Dereference__class_74::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_81::good();");
CWE476_NULL_Pointer_Dereference__class_81::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_82::good();");
CWE476_NULL_Pointer_Dereference__class_82::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_33::good();");
CWE476_NULL_Pointer_Dereference__int64_t_33::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_72::good();");
CWE476_NULL_Pointer_Dereference__int64_t_72::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_73::good();");
CWE476_NULL_Pointer_Dereference__int64_t_73::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_74::good();");
CWE476_NULL_Pointer_Dereference__int64_t_74::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_81::good();");
CWE476_NULL_Pointer_Dereference__int64_t_81::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_82::good();");
CWE476_NULL_Pointer_Dereference__int64_t_82::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_33::good();");
CWE476_NULL_Pointer_Dereference__int_33::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_72::good();");
CWE476_NULL_Pointer_Dereference__int_72::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_73::good();");
CWE476_NULL_Pointer_Dereference__int_73::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_74::good();");
CWE476_NULL_Pointer_Dereference__int_74::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_81::good();");
CWE476_NULL_Pointer_Dereference__int_81::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_82::good();");
CWE476_NULL_Pointer_Dereference__int_82::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_33::good();");
CWE476_NULL_Pointer_Dereference__long_33::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_72::good();");
CWE476_NULL_Pointer_Dereference__long_72::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_73::good();");
CWE476_NULL_Pointer_Dereference__long_73::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_74::good();");
CWE476_NULL_Pointer_Dereference__long_74::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_81::good();");
CWE476_NULL_Pointer_Dereference__long_81::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_82::good();");
CWE476_NULL_Pointer_Dereference__long_82::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_33::good();");
CWE476_NULL_Pointer_Dereference__struct_33::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_72::good();");
CWE476_NULL_Pointer_Dereference__struct_72::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_73::good();");
CWE476_NULL_Pointer_Dereference__struct_73::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_74::good();");
CWE476_NULL_Pointer_Dereference__struct_74::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_81::good();");
CWE476_NULL_Pointer_Dereference__struct_81::good();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_82::good();");
CWE476_NULL_Pointer_Dereference__struct_82::good();
/* END-AUTOGENERATED-CPP-GOOD-FUNCTION-CALLS */
#endif /* __cplusplus */
#endif /* OMITGOOD */
#ifndef OMITBAD
/* Calling C bad functions */
/* BEGIN-AUTOGENERATED-C-BAD-FUNCTION-CALLS */
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_01_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_02_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_03_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_04_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_05_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_06_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_07_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_08_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_09_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_10_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_11_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_12_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_13_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_14_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_15_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_16_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_17_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__binary_if_18_bad();");
CWE476_NULL_Pointer_Dereference__binary_if_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_01_bad();");
CWE476_NULL_Pointer_Dereference__char_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_02_bad();");
CWE476_NULL_Pointer_Dereference__char_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_03_bad();");
CWE476_NULL_Pointer_Dereference__char_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_04_bad();");
CWE476_NULL_Pointer_Dereference__char_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_05_bad();");
CWE476_NULL_Pointer_Dereference__char_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_06_bad();");
CWE476_NULL_Pointer_Dereference__char_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_07_bad();");
CWE476_NULL_Pointer_Dereference__char_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_08_bad();");
CWE476_NULL_Pointer_Dereference__char_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_09_bad();");
CWE476_NULL_Pointer_Dereference__char_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_10_bad();");
CWE476_NULL_Pointer_Dereference__char_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_11_bad();");
CWE476_NULL_Pointer_Dereference__char_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_12_bad();");
CWE476_NULL_Pointer_Dereference__char_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_13_bad();");
CWE476_NULL_Pointer_Dereference__char_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_14_bad();");
CWE476_NULL_Pointer_Dereference__char_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_15_bad();");
CWE476_NULL_Pointer_Dereference__char_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_16_bad();");
CWE476_NULL_Pointer_Dereference__char_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_17_bad();");
CWE476_NULL_Pointer_Dereference__char_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_18_bad();");
CWE476_NULL_Pointer_Dereference__char_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_21_bad();");
CWE476_NULL_Pointer_Dereference__char_21_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_22_bad();");
CWE476_NULL_Pointer_Dereference__char_22_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_31_bad();");
CWE476_NULL_Pointer_Dereference__char_31_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_32_bad();");
CWE476_NULL_Pointer_Dereference__char_32_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_34_bad();");
CWE476_NULL_Pointer_Dereference__char_34_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_41_bad();");
CWE476_NULL_Pointer_Dereference__char_41_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_44_bad();");
CWE476_NULL_Pointer_Dereference__char_44_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_45_bad();");
CWE476_NULL_Pointer_Dereference__char_45_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_51_bad();");
CWE476_NULL_Pointer_Dereference__char_51_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_52_bad();");
CWE476_NULL_Pointer_Dereference__char_52_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_53_bad();");
CWE476_NULL_Pointer_Dereference__char_53_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_54_bad();");
CWE476_NULL_Pointer_Dereference__char_54_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_63_bad();");
CWE476_NULL_Pointer_Dereference__char_63_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_64_bad();");
CWE476_NULL_Pointer_Dereference__char_64_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_65_bad();");
CWE476_NULL_Pointer_Dereference__char_65_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_66_bad();");
CWE476_NULL_Pointer_Dereference__char_66_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_67_bad();");
CWE476_NULL_Pointer_Dereference__char_67_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_68_bad();");
CWE476_NULL_Pointer_Dereference__char_68_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_01_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_02_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_03_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_04_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_05_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_06_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_07_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_08_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_09_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_10_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_11_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_12_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_13_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_14_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_15_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_16_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_17_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__deref_after_check_18_bad();");
CWE476_NULL_Pointer_Dereference__deref_after_check_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_01_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_02_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_03_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_04_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_05_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_06_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_07_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_08_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_09_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_10_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_11_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_12_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_13_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_14_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_15_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_16_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_17_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_18_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_21_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_21_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_22_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_22_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_31_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_31_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_32_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_32_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_34_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_34_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_41_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_41_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_44_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_44_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_45_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_45_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_51_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_51_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_52_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_52_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_53_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_53_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_54_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_54_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_63_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_63_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_64_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_64_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_65_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_65_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_66_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_66_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_67_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_67_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_68_bad();");
CWE476_NULL_Pointer_Dereference__int64_t_68_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_01_bad();");
CWE476_NULL_Pointer_Dereference__int_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_02_bad();");
CWE476_NULL_Pointer_Dereference__int_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_03_bad();");
CWE476_NULL_Pointer_Dereference__int_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_04_bad();");
CWE476_NULL_Pointer_Dereference__int_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_05_bad();");
CWE476_NULL_Pointer_Dereference__int_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_06_bad();");
CWE476_NULL_Pointer_Dereference__int_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_07_bad();");
CWE476_NULL_Pointer_Dereference__int_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_08_bad();");
CWE476_NULL_Pointer_Dereference__int_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_09_bad();");
CWE476_NULL_Pointer_Dereference__int_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_10_bad();");
CWE476_NULL_Pointer_Dereference__int_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_11_bad();");
CWE476_NULL_Pointer_Dereference__int_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_12_bad();");
CWE476_NULL_Pointer_Dereference__int_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_13_bad();");
CWE476_NULL_Pointer_Dereference__int_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_14_bad();");
CWE476_NULL_Pointer_Dereference__int_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_15_bad();");
CWE476_NULL_Pointer_Dereference__int_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_16_bad();");
CWE476_NULL_Pointer_Dereference__int_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_17_bad();");
CWE476_NULL_Pointer_Dereference__int_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_18_bad();");
CWE476_NULL_Pointer_Dereference__int_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_21_bad();");
CWE476_NULL_Pointer_Dereference__int_21_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_22_bad();");
CWE476_NULL_Pointer_Dereference__int_22_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_31_bad();");
CWE476_NULL_Pointer_Dereference__int_31_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_32_bad();");
CWE476_NULL_Pointer_Dereference__int_32_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_34_bad();");
CWE476_NULL_Pointer_Dereference__int_34_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_41_bad();");
CWE476_NULL_Pointer_Dereference__int_41_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_44_bad();");
CWE476_NULL_Pointer_Dereference__int_44_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_45_bad();");
CWE476_NULL_Pointer_Dereference__int_45_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_51_bad();");
CWE476_NULL_Pointer_Dereference__int_51_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_52_bad();");
CWE476_NULL_Pointer_Dereference__int_52_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_53_bad();");
CWE476_NULL_Pointer_Dereference__int_53_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_54_bad();");
CWE476_NULL_Pointer_Dereference__int_54_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_63_bad();");
CWE476_NULL_Pointer_Dereference__int_63_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_64_bad();");
CWE476_NULL_Pointer_Dereference__int_64_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_65_bad();");
CWE476_NULL_Pointer_Dereference__int_65_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_66_bad();");
CWE476_NULL_Pointer_Dereference__int_66_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_67_bad();");
CWE476_NULL_Pointer_Dereference__int_67_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_68_bad();");
CWE476_NULL_Pointer_Dereference__int_68_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_01_bad();");
CWE476_NULL_Pointer_Dereference__long_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_02_bad();");
CWE476_NULL_Pointer_Dereference__long_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_03_bad();");
CWE476_NULL_Pointer_Dereference__long_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_04_bad();");
CWE476_NULL_Pointer_Dereference__long_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_05_bad();");
CWE476_NULL_Pointer_Dereference__long_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_06_bad();");
CWE476_NULL_Pointer_Dereference__long_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_07_bad();");
CWE476_NULL_Pointer_Dereference__long_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_08_bad();");
CWE476_NULL_Pointer_Dereference__long_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_09_bad();");
CWE476_NULL_Pointer_Dereference__long_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_10_bad();");
CWE476_NULL_Pointer_Dereference__long_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_11_bad();");
CWE476_NULL_Pointer_Dereference__long_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_12_bad();");
CWE476_NULL_Pointer_Dereference__long_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_13_bad();");
CWE476_NULL_Pointer_Dereference__long_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_14_bad();");
CWE476_NULL_Pointer_Dereference__long_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_15_bad();");
CWE476_NULL_Pointer_Dereference__long_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_16_bad();");
CWE476_NULL_Pointer_Dereference__long_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_17_bad();");
CWE476_NULL_Pointer_Dereference__long_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_18_bad();");
CWE476_NULL_Pointer_Dereference__long_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_21_bad();");
CWE476_NULL_Pointer_Dereference__long_21_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_22_bad();");
CWE476_NULL_Pointer_Dereference__long_22_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_31_bad();");
CWE476_NULL_Pointer_Dereference__long_31_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_32_bad();");
CWE476_NULL_Pointer_Dereference__long_32_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_34_bad();");
CWE476_NULL_Pointer_Dereference__long_34_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_41_bad();");
CWE476_NULL_Pointer_Dereference__long_41_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_44_bad();");
CWE476_NULL_Pointer_Dereference__long_44_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_45_bad();");
CWE476_NULL_Pointer_Dereference__long_45_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_51_bad();");
CWE476_NULL_Pointer_Dereference__long_51_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_52_bad();");
CWE476_NULL_Pointer_Dereference__long_52_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_53_bad();");
CWE476_NULL_Pointer_Dereference__long_53_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_54_bad();");
CWE476_NULL_Pointer_Dereference__long_54_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_63_bad();");
CWE476_NULL_Pointer_Dereference__long_63_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_64_bad();");
CWE476_NULL_Pointer_Dereference__long_64_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_65_bad();");
CWE476_NULL_Pointer_Dereference__long_65_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_66_bad();");
CWE476_NULL_Pointer_Dereference__long_66_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_67_bad();");
CWE476_NULL_Pointer_Dereference__long_67_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_68_bad();");
CWE476_NULL_Pointer_Dereference__long_68_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_01_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_02_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_03_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_04_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_05_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_06_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_07_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_08_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_09_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_10_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_11_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_12_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_13_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_14_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_15_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_16_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_17_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__null_check_after_deref_18_bad();");
CWE476_NULL_Pointer_Dereference__null_check_after_deref_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_01_bad();");
CWE476_NULL_Pointer_Dereference__struct_01_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_02_bad();");
CWE476_NULL_Pointer_Dereference__struct_02_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_03_bad();");
CWE476_NULL_Pointer_Dereference__struct_03_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_04_bad();");
CWE476_NULL_Pointer_Dereference__struct_04_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_05_bad();");
CWE476_NULL_Pointer_Dereference__struct_05_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_06_bad();");
CWE476_NULL_Pointer_Dereference__struct_06_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_07_bad();");
CWE476_NULL_Pointer_Dereference__struct_07_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_08_bad();");
CWE476_NULL_Pointer_Dereference__struct_08_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_09_bad();");
CWE476_NULL_Pointer_Dereference__struct_09_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_10_bad();");
CWE476_NULL_Pointer_Dereference__struct_10_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_11_bad();");
CWE476_NULL_Pointer_Dereference__struct_11_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_12_bad();");
CWE476_NULL_Pointer_Dereference__struct_12_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_13_bad();");
CWE476_NULL_Pointer_Dereference__struct_13_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_14_bad();");
CWE476_NULL_Pointer_Dereference__struct_14_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_15_bad();");
CWE476_NULL_Pointer_Dereference__struct_15_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_16_bad();");
CWE476_NULL_Pointer_Dereference__struct_16_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_17_bad();");
CWE476_NULL_Pointer_Dereference__struct_17_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_18_bad();");
CWE476_NULL_Pointer_Dereference__struct_18_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_21_bad();");
CWE476_NULL_Pointer_Dereference__struct_21_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_22_bad();");
CWE476_NULL_Pointer_Dereference__struct_22_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_31_bad();");
CWE476_NULL_Pointer_Dereference__struct_31_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_32_bad();");
CWE476_NULL_Pointer_Dereference__struct_32_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_34_bad();");
CWE476_NULL_Pointer_Dereference__struct_34_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_41_bad();");
CWE476_NULL_Pointer_Dereference__struct_41_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_44_bad();");
CWE476_NULL_Pointer_Dereference__struct_44_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_45_bad();");
CWE476_NULL_Pointer_Dereference__struct_45_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_51_bad();");
CWE476_NULL_Pointer_Dereference__struct_51_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_52_bad();");
CWE476_NULL_Pointer_Dereference__struct_52_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_53_bad();");
CWE476_NULL_Pointer_Dereference__struct_53_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_54_bad();");
CWE476_NULL_Pointer_Dereference__struct_54_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_63_bad();");
CWE476_NULL_Pointer_Dereference__struct_63_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_64_bad();");
CWE476_NULL_Pointer_Dereference__struct_64_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_65_bad();");
CWE476_NULL_Pointer_Dereference__struct_65_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_66_bad();");
CWE476_NULL_Pointer_Dereference__struct_66_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_67_bad();");
CWE476_NULL_Pointer_Dereference__struct_67_bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_68_bad();");
CWE476_NULL_Pointer_Dereference__struct_68_bad();
/* END-AUTOGENERATED-C-BAD-FUNCTION-CALLS */
#ifdef __cplusplus
/* Calling C++ bad functions */
/* BEGIN-AUTOGENERATED-CPP-BAD-FUNCTION-CALLS */
printLine("Calling CWE476_NULL_Pointer_Dereference__char_33::bad();");
CWE476_NULL_Pointer_Dereference__char_33::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_72::bad();");
CWE476_NULL_Pointer_Dereference__char_72::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_73::bad();");
CWE476_NULL_Pointer_Dereference__char_73::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_74::bad();");
CWE476_NULL_Pointer_Dereference__char_74::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_81::bad();");
CWE476_NULL_Pointer_Dereference__char_81::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__char_82::bad();");
CWE476_NULL_Pointer_Dereference__char_82::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_01::bad();");
CWE476_NULL_Pointer_Dereference__class_01::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_02::bad();");
CWE476_NULL_Pointer_Dereference__class_02::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_03::bad();");
CWE476_NULL_Pointer_Dereference__class_03::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_04::bad();");
CWE476_NULL_Pointer_Dereference__class_04::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_05::bad();");
CWE476_NULL_Pointer_Dereference__class_05::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_06::bad();");
CWE476_NULL_Pointer_Dereference__class_06::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_07::bad();");
CWE476_NULL_Pointer_Dereference__class_07::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_08::bad();");
CWE476_NULL_Pointer_Dereference__class_08::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_09::bad();");
CWE476_NULL_Pointer_Dereference__class_09::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_10::bad();");
CWE476_NULL_Pointer_Dereference__class_10::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_11::bad();");
CWE476_NULL_Pointer_Dereference__class_11::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_12::bad();");
CWE476_NULL_Pointer_Dereference__class_12::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_13::bad();");
CWE476_NULL_Pointer_Dereference__class_13::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_14::bad();");
CWE476_NULL_Pointer_Dereference__class_14::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_15::bad();");
CWE476_NULL_Pointer_Dereference__class_15::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_16::bad();");
CWE476_NULL_Pointer_Dereference__class_16::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_17::bad();");
CWE476_NULL_Pointer_Dereference__class_17::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_18::bad();");
CWE476_NULL_Pointer_Dereference__class_18::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_21::bad();");
CWE476_NULL_Pointer_Dereference__class_21::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_22::bad();");
CWE476_NULL_Pointer_Dereference__class_22::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_31::bad();");
CWE476_NULL_Pointer_Dereference__class_31::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_32::bad();");
CWE476_NULL_Pointer_Dereference__class_32::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_33::bad();");
CWE476_NULL_Pointer_Dereference__class_33::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_34::bad();");
CWE476_NULL_Pointer_Dereference__class_34::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_41::bad();");
CWE476_NULL_Pointer_Dereference__class_41::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_44::bad();");
CWE476_NULL_Pointer_Dereference__class_44::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_45::bad();");
CWE476_NULL_Pointer_Dereference__class_45::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_51::bad();");
CWE476_NULL_Pointer_Dereference__class_51::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_52::bad();");
CWE476_NULL_Pointer_Dereference__class_52::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_53::bad();");
CWE476_NULL_Pointer_Dereference__class_53::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_54::bad();");
CWE476_NULL_Pointer_Dereference__class_54::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_63::bad();");
CWE476_NULL_Pointer_Dereference__class_63::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_64::bad();");
CWE476_NULL_Pointer_Dereference__class_64::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_65::bad();");
CWE476_NULL_Pointer_Dereference__class_65::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_66::bad();");
CWE476_NULL_Pointer_Dereference__class_66::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_67::bad();");
CWE476_NULL_Pointer_Dereference__class_67::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_68::bad();");
CWE476_NULL_Pointer_Dereference__class_68::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_72::bad();");
CWE476_NULL_Pointer_Dereference__class_72::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_73::bad();");
CWE476_NULL_Pointer_Dereference__class_73::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_74::bad();");
CWE476_NULL_Pointer_Dereference__class_74::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_81::bad();");
CWE476_NULL_Pointer_Dereference__class_81::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__class_82::bad();");
CWE476_NULL_Pointer_Dereference__class_82::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_33::bad();");
CWE476_NULL_Pointer_Dereference__int64_t_33::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_72::bad();");
CWE476_NULL_Pointer_Dereference__int64_t_72::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_73::bad();");
CWE476_NULL_Pointer_Dereference__int64_t_73::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_74::bad();");
CWE476_NULL_Pointer_Dereference__int64_t_74::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_81::bad();");
CWE476_NULL_Pointer_Dereference__int64_t_81::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int64_t_82::bad();");
CWE476_NULL_Pointer_Dereference__int64_t_82::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_33::bad();");
CWE476_NULL_Pointer_Dereference__int_33::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_72::bad();");
CWE476_NULL_Pointer_Dereference__int_72::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_73::bad();");
CWE476_NULL_Pointer_Dereference__int_73::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_74::bad();");
CWE476_NULL_Pointer_Dereference__int_74::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_81::bad();");
CWE476_NULL_Pointer_Dereference__int_81::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__int_82::bad();");
CWE476_NULL_Pointer_Dereference__int_82::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_33::bad();");
CWE476_NULL_Pointer_Dereference__long_33::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_72::bad();");
CWE476_NULL_Pointer_Dereference__long_72::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_73::bad();");
CWE476_NULL_Pointer_Dereference__long_73::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_74::bad();");
CWE476_NULL_Pointer_Dereference__long_74::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_81::bad();");
CWE476_NULL_Pointer_Dereference__long_81::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__long_82::bad();");
CWE476_NULL_Pointer_Dereference__long_82::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_33::bad();");
CWE476_NULL_Pointer_Dereference__struct_33::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_72::bad();");
CWE476_NULL_Pointer_Dereference__struct_72::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_73::bad();");
CWE476_NULL_Pointer_Dereference__struct_73::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_74::bad();");
CWE476_NULL_Pointer_Dereference__struct_74::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_81::bad();");
CWE476_NULL_Pointer_Dereference__struct_81::bad();
printLine("Calling CWE476_NULL_Pointer_Dereference__struct_82::bad();");
CWE476_NULL_Pointer_Dereference__struct_82::bad();
/* END-AUTOGENERATED-CPP-BAD-FUNCTION-CALLS */
#endif /* __cplusplus */
#endif /* OMITBAD */
return 0;
}
| {
"content_hash": "b2d285eee7311411f4bc070ce07acc0a",
"timestamp": "",
"source": "github",
"line_count": 1896,
"max_line_length": 96,
"avg_line_length": 42.94356540084388,
"alnum_prop": 0.7282027978040063,
"repo_name": "maurer/tiamat",
"id": "44fbc7aa3bf3c6bde26e2654269021326f606f84",
"size": "81421",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/Juliet/testcases/CWE476_NULL_Pointer_Dereference/main_linux.cpp",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?xml version='1.0' encoding='UTF-8'?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--=== App-specific strings =============================================================-->
<!--This should make it easier for forks to change the branding-->
<!--Used in AndroidManifest.xml-->
<string name="app_name">K-9 Mail</string>
<string name="beta_app_name">K-9 Mail BETA</string>
<string name="shortcuts_title">K-9 Облікові записи</string>
<string name="unread_widget_label">K-9 Непрочитані</string>
<string name="remote_control_label">Дситанційне управління K-9 Mail</string>
<string name="remote_control_desc">Дозволяє цій програмі управляти діяльністю та налаштуваннями K-9 Mail.</string>
<!--Used in the about dialog-->
<string name="app_authors">Google, The K-9 Dog Walkers.</string>
<string name="app_copyright_fmt">Copyright 2008-<xliff:g>%s</xliff:g> The K-9 Dog Walkers. Portions Copyright 2006-<xliff:g>%s</xliff:g> the Android Open Source Project.</string>
<string name="app_license">Ліцензія Apache License, Version 2.0.</string>
<!--Welcome message-->
<string name="welcome_message_title">Ласкаво просимо до K-9 Mail</string>
<string name="accounts_welcome"><![CDATA[
<p>
K-9 Mail це поштовий клієнт з відкритим вихідним кодом для Android, який базується на основі стадартної програми Android Mail client.
</p><p>
Покращені можливості K-9 включають:
</p>
<ul>
<li>Push mail при використання IMAP IDLE</li>
<li>Краща швидкодія</li>
<li>Систематизація повідомлень</li>
<li>Електронні підписи у пошті</li>
<li>Прихована копія собі</li>
<li>Підписки до папок</li>
<li>Синхронізація всіх папок</li>
<li>Налаштування зворотньої адреси</li>
<li>Клавіатурні скорочення</li>
<li>Краща підтримка IMAP</li>
<li>Збереження вкладень на карту пам’яті</li>
<li>Очищення кошика</li>
<li>Упорядкування повідомлень</li>
<li>…і більше</li>
</ul>
<p>
Зауважимо, що K-9 не підтримує більшіть безкоштовних облікових записів hotmail та, як і інші поштові програми, має деякі дивацтва при роботі з Microsoft Exchange.
</p><p>
Будь ласка, надсилайте звіти про помилки, запити про розробку нових функцій та задавайте питання на
<a href=\"http://k9mail.googlecode.com/\">http://k9mail.googlecode.com/</a>.
</p>
]]></string>
<!--Default signature-->
<!--General strings that include the app name-->
<string name="account_delete_dlg_instructions_fmt">Обліковий запис \"<xliff:g id="account">%s</xliff:g>\" буде вилучено з K-9 Mail.</string>
<string name="account_recreate_dlg_instructions_fmt">Усі дані \"<xliff:g id="account">%s</xliff:g>\" буде вилучено з K-9 Mail, але налаштування облікового запису будуть збережені.</string>
<string name="account_clear_dlg_instructions_fmt">Усі повідомлення у \"<xliff:g id="account">%s</xliff:g>\" буде вилучено з K-9 Mail, але налаштування облікового запису будуть збережені.</string>
<string name="insufficient_apg_permissions">K-9 не має дозволу для повного доступу до APG, перевстановіть K-9 для виправлення.</string>
<!--=== App Store-specific strings =======================================================-->
<string name="import_dialog_error_message">Немає відповідної програми для завершення операції імпорту. Будь ласка інсталюйте файловий менеджер з Play Google.</string>
<string name="open_market">Відкрити Play Google</string>
<!--=== General strings ==================================================================-->
<string name="app_authors_fmt">Автори: <xliff:g id="app_authors">%s</xliff:g></string>
<string name="app_revision_fmt">Інформація про зміни: <xliff:g id="app_revision_url">%s</xliff:g></string>
<string name="app_libraries">Ми використовуємо такі бібліотеки третіх сторін: <xliff:g id="app_libraries_list">%s</xliff:g></string>
<string name="app_emoji_icons">Смайлики настрою: <xliff:g id="app_emoji_icons_link">%s</xliff:g></string>
<string name="read_attachment_label">читати вкладення електронної пошти</string>
<string name="read_attachment_desc">Дозволити цій програмі читати вкладення електронної пошти.</string>
<string name="read_messages_label">читати листи</string>
<string name="read_messages_desc">Дозволити цій програмі читати ваші листи.</string>
<string name="delete_messages_label">Видалити листи</string>
<string name="delete_messages_desc">Дозволити цій програмі видаляти ваші листи.</string>
<string name="about_title_fmt">Про <xliff:g id="app_name">%s</xliff:g></string>
<string name="accounts_title">Облікові записи</string>
<string name="folders_title">Папки</string>
<string name="advanced">Додатково</string>
<string name="message_list_title"><xliff:g id="account">%s</xliff:g>:<xliff:g id="folder">%s</xliff:g> </string>
<string name="compose_title_compose">Написати новий лист</string>
<string name="compose_title_reply">Відповісти</string>
<string name="compose_title_reply_all">Відповісти всім</string>
<string name="compose_title_forward">Переслати</string>
<string name="choose_folder_title">Вибрати папку</string>
<string name="status_loading_account_folder">Запит <xliff:g id="account">%s</xliff:g>:<xliff:g id="folder">%s</xliff:g><xliff:g id="progress">%s</xliff:g></string>
<string name="status_loading_account_folder_headers">Отримання заголовків <xliff:g id="account">%s</xliff:g>:<xliff:g id="folder">%s</xliff:g><xliff:g id="progress">%s</xliff:g></string>
<string name="status_sending_account">Надсилання <xliff:g id="account">%s</xliff:g><xliff:g id="progress">%s</xliff:g></string>
<string name="status_processing_account">Опрацювання <xliff:g id="account">%s</xliff:g>:<xliff:g id="command">%s</xliff:g><xliff:g id="progress">%s</xliff:g></string>
<string name="folder_progress">\u0020<xliff:g id="completed">%s</xliff:g>/<xliff:g id="total">%s</xliff:g></string>
<string name="status_next_poll">Наступний запит <xliff:g id="nexttime">%s</xliff:g></string>
<string name="status_syncing_off">Синхронізація заборонена</string>
<string name="actionbar_selected"><xliff:g id="selection_count">%d</xliff:g> вибраний</string>
<string name="next_action">Наступний</string>
<string name="previous_action">Попередній</string>
<!--Used to confirm acceptance of dialog boxes, warnings, errors, etc.-->
<string name="okay_action">Гаразд</string>
<string name="cancel_action">Відмінити</string>
<string name="send_action">Надіслати</string>
<string name="send_again_action">Надіслати знову</string>
<string name="select_action">Вибрати</string>
<string name="deselect_action">Скасувати вибір</string>
<string name="reply_action">Відповісти</string>
<string name="reply_all_action">Відповісти всім</string>
<string name="delete_action">Видалити</string>
<string name="archive_action">Архівувати</string>
<string name="spam_action">Спам</string>
<string name="forward_action">Переслати</string>
<string name="move_action">Перемістити</string>
<string name="single_message_options_action">Надіслати</string>
<string name="continue_action">Продовжити</string>
<string name="back_action">Назад</string>
<string name="done_action">Готово</string>
<string name="discard_action">Відкинути зміни</string>
<string name="save_draft_action">Зберегти як чернетку</string>
<string name="check_mail_action">Перевірити пошту</string>
<string name="send_messages_action">Надіслати повідомлення</string>
<string name="refresh_folders_action">Оновити папки</string>
<string name="filter_folders_action">Знайти папку</string>
<string name="add_account_action">Додати обліковий запис</string>
<string name="compose_action">Написати новий лист</string>
<string name="search_action">Пошук</string>
<string name="search_results">Результати пошуку</string>
<string name="preferences_action">Налаштування</string>
<string name="account_settings_action">Налаштування пошти</string>
<string name="folder_settings_action">Налаштування папки</string>
<string name="global_settings_action">Глобальні налаштування</string>
<string name="remove_account_action">Видалити обліковий запис</string>
<string name="clear_pending_action">Зупинити незавершені дії (небезпечно!)</string>
<string name="mark_as_read_action">Відмітити як прочитаний</string>
<string name="send_alternate_action">Переслати</string>
<string name="send_alternate_chooser_title">Вибрати відправника</string>
<string name="flag_action">Додати зірочку</string>
<string name="unflag_action">Видалити зірочку</string>
<string name="copy_action">Копіювати</string>
<string name="select_text_action">Вибрати текст</string>
<string name="show_headers_action">Відображати заголовки</string>
<string name="hide_headers_action">Приховувати заголовки</string>
<string name="message_view_theme_action_dark">Застосувати темну тему</string>
<string name="message_view_theme_action_light">Застосувати світлу тему</string>
<string name="mark_as_unread_action">Відмітити як непрочитаний</string>
<string name="add_cc_bcc_action">Додати копію/приховану</string>
<string name="read_receipt">Повідомлення про прочитання</string>
<string name="read_receipt_enabled">Включити запит повідомлень про прочитання</string>
<string name="read_receipt_disabled">Вимкнути запит повідомлень про прочитання</string>
<string name="add_attachment_action">Додати вкладення</string>
<string name="empty_trash_action">Очистити Кошик</string>
<string name="expunge_action">Витерти</string>
<string name="clear_local_folder_action">Видалити локальні повідомлення</string>
<string name="about_action">Про</string>
<string name="prefs_title">Налаштування</string>
<string name="accounts_context_menu_title">Параметри облікових записів</string>
<!--Shown in place of the subject when a message has no subject. Showing this in parentheses is customary.-->
<string name="general_no_subject">(Немає теми)</string>
<string name="general_no_sender">Немає відправника</string>
<string name="status_loading">Завантаження</string>
<string name="status_loading_more">Завантажуються повідомлення\u2026</string>
<string name="status_network_error">Помилка з’єднання</string>
<string name="status_invalid_id_error">Повідомлення не знайдено</string>
<string name="status_loading_more_failed">Спробуйте ще раз завантажити повідомлення</string>
<string name="load_more_messages_fmt">Завантажити ще <xliff:g id="messages_to_load">%d</xliff:g> </string>
<string name="abbrev_gigabytes">ГБ</string>
<string name="abbrev_megabytes">МБ</string>
<string name="abbrev_kilobytes">кБ</string>
<string name="abbrev_bytes">Б</string>
<string name="account_size_changed">Розмір \"<xliff:g id="account">%s</xliff:g>\" зменшився від <xliff:g id="oldSize">%s</xliff:g> до <xliff:g id="newSize">%s</xliff:g></string>
<string name="compacting_account">Стискання скриньки \"<xliff:g id="account">%s</xliff:g>\"</string>
<string name="clearing_account">Очищення скриньки \"<xliff:g id="account">%s</xliff:g>\"</string>
<string name="recreating_account">Відновлення облікового запису\"<xliff:g id="account">%s</xliff:g>\"</string>
<string name="notification_new_title">Нова пошта</string>
<string name="notification_new_messages_title"><xliff:g id="new_message_count">%d</xliff:g> нові повідомлення</string>
<string name="notification_new_one_account_fmt"><xliff:g id="unread_message_count">%d</xliff:g> Непрочитане (<xliff:g id="account">%s</xliff:g>)</string>
<string name="notification_additional_messages">+ <xliff:g id="additional_messages">%d</xliff:g> більше на <xliff:g id="account">%s</xliff:g></string>
<string name="notification_action_reply">Відповісти</string>
<string name="notification_action_mark_as_read">Позначити як прочитаний</string>
<string name="notification_action_delete">Видалити</string>
<string name="notification_certificate_error_title">Помилка сертифікату для <xliff:g id="account">%s</xliff:g></string>
<string name="notification_certificate_error_text">Перевірте налаштування вашого серверу</string>
<string name="notification_bg_sync_ticker">Перевірка пошти: <xliff:g id="account">%s</xliff:g>:<xliff:g id="folder">%s</xliff:g></string>
<string name="notification_bg_sync_title">Перевірка пошти</string>
<string name="notification_bg_send_ticker">Надсилання пошти: <xliff:g id="account">%s</xliff:g></string>
<string name="notification_bg_send_title">Надсилання пошти</string>
<string name="notification_bg_title_separator">:</string>
<string name="special_mailbox_name_inbox">Вхідні</string>
<string name="special_mailbox_name_outbox">Вихідні</string>
<string name="special_mailbox_name_drafts">Чернетки</string>
<string name="special_mailbox_name_trash">Кошик</string>
<string name="special_mailbox_name_sent">Надіслані</string>
<string name="special_mailbox_name_archive">Архів</string>
<string name="special_mailbox_name_spam">Спам</string>
<string name="special_mailbox_name_drafts_fmt"><xliff:g id="folder">%s</xliff:g> (Drafts)</string>
<string name="special_mailbox_name_trash_fmt"><xliff:g id="folder">%s</xliff:g> (Trash)</string>
<string name="special_mailbox_name_sent_fmt"><xliff:g id="folder">%s</xliff:g> (Sent)</string>
<string name="special_mailbox_name_archive_fmt"><xliff:g id="folder">%s</xliff:g> (Archive)</string>
<string name="special_mailbox_name_spam_fmt"><xliff:g id="folder">%s</xliff:g> (Spam)</string>
<string name="send_failure_subject">Не вдалося надіслати повідомлення</string>
<string name="debug_version_fmt">Версія: <xliff:g id="version">%s</xliff:g></string>
<string name="debug_enable_debug_logging_title">Увімкнути ведення журналу налагодження</string>
<string name="debug_enable_debug_logging_summary">Запис додаткової діагностичної інформації</string>
<string name="debug_enable_sensitive_logging_title">Запис конфіденційної інформації</string>
<string name="debug_enable_sensitive_logging_summary">Можна записувати паролі в журнали.</string>
<string name="message_list_load_more_messages_action">Завантажити більше повідомлень</string>
<string name="message_to_fmt">До:<xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_compose_to_hint">Кому</string>
<string name="message_compose_cc_hint">Копія</string>
<string name="message_compose_bcc_hint">Прихована</string>
<string name="message_compose_subject_hint">Тема</string>
<string name="message_compose_content_hint">Текст повідомлення</string>
<string name="message_compose_signature_hint">Підпис</string>
<string name="message_compose_quote_header_separator">-------- Вихідне повідомлення --------</string>
<string name="message_compose_quote_header_subject">Тема:</string>
<string name="message_compose_quote_header_send_date">Надіслано:</string>
<string name="message_compose_quote_header_from">Від:</string>
<string name="message_compose_quote_header_to">Кому:</string>
<string name="message_compose_quote_header_cc">Копія:</string>
<string name="message_compose_reply_header_fmt"><xliff:g id="sender">%s</xliff:g> написав(ла):</string>
<string name="message_compose_error_no_recipients">Вам необхідно додати хоча б одного одержувача.</string>
<string name="error_contact_address_not_found">Не знайденої адреси електронної пошти.</string>
<string name="message_compose_attachments_skipped_toast">Деякі вкладення не можуть бути переслані бо вони не завантажилися.</string>
<string name="message_compose_show_quoted_text_action">Цитувати повідомлення</string>
<string name="message_compose_description_add_to">Додати одержувача (Кому)</string>
<string name="message_compose_description_add_cc">Додати одержувача (Копія)</string>
<string name="message_compose_description_add_bcc">Додати одержувача (Прихована)</string>
<string name="message_compose_description_delete_quoted_text">Видалити цитований текст</string>
<string name="message_compose_description_edit_quoted_text">Редагувати цитований текст</string>
<string name="message_view_from_format">Від: <xliff:g id="name">%s</xliff:g> <<xliff:g id="email">%s</xliff:g>></string>
<string name="message_to_label">Кому:</string>
<string name="message_view_cc_label">Копія:</string>
<string name="message_view_attachment_view_action">Відкрити</string>
<string name="message_view_attachment_download_action">Зберегти</string>
<string name="message_view_status_attachment_saved">Вкладення збережено на карту пам’яті як <xliff:g id="filename">%s</xliff:g>.</string>
<string name="message_view_status_attachment_not_saved">Не вдалося зберегти вкладення на карту пам’яті.</string>
<string name="message_view_show_pictures_action">Показати зобарження</string>
<string name="message_view_show_message_action">Показати повідомлення</string>
<string name="message_view_show_attachments_action">Показати вкладення</string>
<string name="message_view_show_more_attachments_action">Більше…</string>
<string name="message_view_fetching_attachment_toast">Отримання вкладення.</string>
<string name="message_view_no_viewer">Не знайдено програму для перегляду <xliff:g id="mimetype">%s</xliff:g>.</string>
<string name="message_view_download_remainder">Завантажити усе повідомлення</string>
<string name="message_view_downloading">Завантажується…</string>
<!--NOTE: The following message refers to strings with id account_setup_incoming_save_all_headers_label and account_setup_incoming_title-->
<string name="message_additional_headers_not_downloaded">Не всі заголовки завантажені або збережені. Виберіть \"Зберегти всі заголовки локально\" у налаштуваннях сервера вхідних повідомлень для використання цієї можливості.</string>
<string name="message_no_additional_headers_available">Всі заголовки завантажено, нема додаткових заголовків для відображення.</string>
<string name="message_additional_headers_retrieval_failed">Не вдалося завантажити додаткові заголовки з бази даних або поштового сервера.</string>
<string name="from_same_sender">Більше від цього відправника</string>
<string name="message_discarded_toast">Повідомлення скасовано</string>
<string name="message_saved_toast">Повідомлення збережено як чернетка</string>
<string name="global_settings_flag_label">Показувати зірочки</string>
<string name="global_settings_flag_summary">Зірочки показують відмічені повідомлення</string>
<string name="global_settings_checkbox_label">Прапорці для множинного вибору</string>
<string name="global_settings_checkbox_summary">Завжди показувати прапорці множинного вибору</string>
<string name="global_settings_preview_lines_label">Рядки попереднього перегляду</string>
<string name="global_settings_show_correspondent_names_label">Показувати ім’я відправника</string>
<string name="global_settings_show_correspondent_names_summary">Показувати ім’я відправника замість електронної адреси</string>
<string name="global_settings_sender_above_subject_label">Відправник вище теми</string>
<string name="global_settings_sender_above_subject_summary">Показувати імена відправників над темою, а не нижче теми</string>
<string name="global_settings_show_contact_name_label">Показувати ім’я одержувача</string>
<string name="global_settings_show_contact_name_summary">Використовувати ім’я одержувача із контактів, якщо це можливо</string>
<string name="global_settings_registered_name_color_label">Колір контактів</string>
<string name="global_settings_registered_name_color_default">Не розфарбовувати імена у списку контактів</string>
<string name="global_settings_registered_name_color_changed">Розфарбовувати імена у списку контактів</string>
<string name="global_settings_folderlist_wrap_folder_names_label">Згорнути довгі імена папок</string>
<string name="global_settings_folderlist_wrap_folder_names_summary">Використовувати декілька строчок для перегляду довгих імен папок</string>
<string name="global_settings_messageview_fixedwidth_label">Шрифти фіксованої щирини</string>
<string name="global_settings_messageview_fixedwidth_summary">Використовувати шрифт фіксованої ширини для відображення звичайних текстових повідомлень</string>
<string name="global_settings_messageview_autofit_width_label">Автоматична доставка повідомлень</string>
<string name="global_settings_messageview_autofit_width_summary">Скорочувати повідомлення для відображення на екрані</string>
<string name="global_settings_messageview_return_to_list_label">Повернутися до списку після вилучення</string>
<string name="global_settings_messageview_return_to_list_summary">Повернутися до списку повідомлень після вилучення повідомлення</string>
<string name="global_settings_messageview_show_next_label">Показувати наступне повідомлення після вилучення повідомлення</string>
<string name="global_settings_messageview_show_next_summary">За замовчуванням показувати наступне повідомлення після вилучення</string>
<string name="global_settings_confirm_actions_title">Підтвердження дій</string>
<string name="global_settings_confirm_actions_summary">Показати діалогове вікно щоразу, коли ви виконуєте вибрані дії</string>
<string name="global_settings_confirm_action_delete_starred">Вилучити позначені зірочкою (лише перегляд повідомлень)</string>
<string name="global_settings_confirm_action_spam">Спам</string>
<string name="global_settings_confirm_action_delete_notif">Видалити (з сповіщення)</string>
<string name="global_settings_notification_hide_subject_title">Приховувати тему в повідомленнях</string>
<string name="global_settings_notification_hide_subject_never">Ніколи</string>
<string name="global_settings_notification_hide_subject_when_locked">Коли пристрій заблоковано</string>
<string name="global_settings_notification_hide_subject_always">Завжди</string>
<string name="global_settings_notification_quick_delete_title">Показувати кнопку \"Видалити\"</string>
<string name="global_settings_notification_quick_delete_never">Ніколи</string>
<string name="global_settings_notification_quick_delete_when_single_msg">Сповіщення для одного повідомлення</string>
<string name="global_settings_notification_quick_delete_always">Завжди</string>
<string name="global_settings_notification_quick_delete_description">Показувати кнопку в сповіщеннях, що дозволяє швидке видалення повідомлень</string>
<string name="quiet_time">Час беззвучного режиму</string>
<string name="quiet_time_description">Заборонити вібрацю, дзвінок та блимання у нічний час</string>
<string name="quiet_time_starts">Початок часу тишини</string>
<string name="quiet_time_ends">Закінчення часу тишини</string>
<string name="account_setup_basics_title">Налаштувати новий обліковий запис</string>
<string name="account_setup_basics_email_hint">Адреса електронної пошти</string>
<string name="account_setup_basics_password_hint">Пароль</string>
<string name="account_setup_basics_manual_setup_action">Ручне налаштування</string>
<string name="account_setup_check_settings_title"/>
<string name="account_setup_check_settings_retr_info_msg">Отримання інформації про обліковий запис\u2026</string>
<string name="account_setup_check_settings_check_incoming_msg">Перевірка налаштувань вхідного сервера\u2026</string>
<string name="account_setup_check_settings_check_outgoing_msg">Перевірка налаштувань вихідного сервера\u2026</string>
<string name="account_setup_check_settings_authenticate">Автентифікація\u2026</string>
<string name="account_setup_check_settings_fetch">Отримання налаштувань облікового запису\u2026</string>
<string name="account_setup_check_settings_canceling_msg">Скасування\u2026</string>
<string name="account_setup_names_title">Вже готово!</string>
<string name="account_setup_names_account_name_label">Дайте ім’я цьому обліковому запису (необов’язково):</string>
<string name="account_setup_names_user_name_label">Введіть ваше ім’я (відображається у вихідних повідомленнях):</string>
<string name="account_setup_account_type_title">Тип поштової скриньки</string>
<string name="account_setup_account_type_instructions">Виберіть тип поштової скриньки</string>
<string name="account_setup_account_type_pop_action">POP3</string>
<string name="account_setup_account_type_imap_action">IMAP</string>
<string name="account_setup_account_type_webdav_action">Exchange (WebDAV)</string>
<string name="account_setup_incoming_title">Налаштування сервера вхідних повідомлень</string>
<string name="account_setup_incoming_username_label">Ім’я користувача</string>
<string name="account_setup_incoming_password_label">Пароль</string>
<string name="account_setup_incoming_pop_server_label">Сервер POP3</string>
<string name="account_setup_incoming_imap_server_label">Сервер IMAP</string>
<string name="account_setup_incoming_webdav_server_label">Сервер Exchange</string>
<string name="account_setup_incoming_port_label">Порт</string>
<string name="account_setup_incoming_security_label">Тип системи захисту</string>
<string name="account_setup_incoming_auth_type_label">Метод автентифікації</string>
<string name="account_setup_incoming_security_none_label">Немає</string>
<string name="account_setup_incoming_delete_policy_label">Коли повідомлення видалено</string>
<string name="account_setup_incoming_delete_policy_never_label">Не видаляти на сервері</string>
<string name="account_setup_incoming_delete_policy_delete_label">Видаляти на сервері</string>
<string name="account_setup_incoming_delete_policy_markread_label">Позначити як прочитане на сервері</string>
<string name="account_setup_incoming_compression_label">Використовувати стискання даних у мережі:</string>
<string name="account_setup_incoming_mobile_label">Мобільний інтернет</string>
<string name="account_setup_incoming_wifi_label">WI-FI</string>
<string name="account_setup_incoming_other_label">Інше</string>
<string name="local_storage_provider_external_label">Зовнішня пам’ять (SD карта)</string>
<string name="local_storage_provider_internal_label">Стандартне внутрішня пам’ять</string>
<string name="local_storage_provider_samsunggalaxy_label">%1$s додаткова внутрішня пам’ять</string>
<string name="local_storage_provider_label">Розташування пам’яті</string>
<string name="account_setup_expunge_policy_label">Вилучати повідомлення</string>
<string name="account_setup_expunge_policy_immediately">Негайно після вилучення або переміщення</string>
<string name="account_setup_expunge_policy_on_poll">Коли запитується</string>
<string name="account_setup_expunge_policy_manual">Тільки вручну</string>
<string name="account_setup_incoming_autodetect_namespace_label">Авто визначення області імен IMAP</string>
<string name="account_setup_incoming_imap_path_prefix_label">Префікс шляху IMAP</string>
<string name="drafts_folder_label">Ім’я папки Чернеток</string>
<string name="sent_folder_label">Ім’я папки Надісланих</string>
<string name="trash_folder_label">Ім’я папки Кошик</string>
<string name="archive_folder_label">Ім’я папки Архіву</string>
<string name="spam_folder_label">Ім’я папки Спам</string>
<string name="account_setup_incoming_subscribed_folders_only_label">Показувати тільки папки із підписки</string>
<string name="account_setup_auto_expand_folder">Автоматично відкривати папку</string>
<string name="account_setup_incoming_webdav_path_prefix_label">Шлях для WebDAV (Exchange)</string>
<string name="account_setup_incoming_webdav_path_prefix_hint">Необов’язкове</string>
<string name="account_setup_incoming_webdav_auth_path_label">Шлях для автентифікації</string>
<string name="account_setup_incoming_webdav_auth_path_hint">Необов’язкове</string>
<string name="account_setup_incoming_webdav_mailbox_path_label">Шлях поштової скриньки</string>
<string name="account_setup_incoming_webdav_mailbox_path_hint">Необов’язкове</string>
<string name="account_setup_outgoing_title">Налаштування сервера вихідної пошти</string>
<string name="account_setup_outgoing_smtp_server_label">Сервер SMTP</string>
<string name="account_setup_outgoing_port_label">Порт</string>
<string name="account_setup_outgoing_security_label">Тип системи захисту</string>
<string name="account_setup_outgoing_require_login_label">Завжди вимагати входу в систему.</string>
<string name="account_setup_outgoing_username_label">Ім’я користувача</string>
<string name="account_setup_outgoing_password_label">Пароль</string>
<string name="account_setup_outgoing_authentication_label">Метод автентифікації</string>
<string name="account_setup_bad_uri">Неправильне налаштування: <xliff:g id="err_mess">%s</xliff:g></string>
<string name="account_setup_options_title">Параметри пошти</string>
<string name="compact_action">Стиснути</string>
<string name="clear_action">Вилучити повідомлення (небезпечно!)</string>
<string name="recreate_action">Створити дані наново (крайні випадок!)</string>
<string name="account_setup_options_mail_check_frequency_label">Частота запиту папок</string>
<string name="account_setup_options_mail_check_frequency_never">Ніколи</string>
<string name="account_setup_options_mail_check_frequency_1min">Кожної хвилини</string>
<string name="account_setup_options_mail_check_frequency_5min">Кожні 5 хвилин</string>
<string name="account_setup_options_mail_check_frequency_10min">Кожні 10 хвилин</string>
<string name="account_setup_options_mail_check_frequency_15min">Кожні 15 хвилин</string>
<string name="account_setup_options_mail_check_frequency_30min">Кожні 30 хвилин</string>
<string name="account_setup_options_mail_check_frequency_1hour">Кожної години</string>
<string name="account_setup_options_mail_check_frequency_2hour">Кожні 2 години</string>
<string name="account_setup_options_mail_check_frequency_3hour">Кожні 3 години</string>
<string name="account_setup_options_mail_check_frequency_6hour">Кожні 6 годин</string>
<string name="account_setup_options_mail_check_frequency_12hour">Кожні 12 годин</string>
<string name="account_setup_options_mail_check_frequency_24hour">Кожні 24 години</string>
<string name="push_poll_on_connect_label">Запитувати при з’єднанні з Push поштою</string>
<string name="account_setup_options_enable_push_label">Використовувати Push пошту для цього облікового запису</string>
<string name="account_setup_options_enable_push_summary">Якщо ваш сервер підтримує таку можливість, то нові повідомлення появляються моментально. Цей параметр може істотно покращити або погіршити швидкодію.</string>
<string name="idle_refresh_period_label">Оновлювати неактивне з’єднання</string>
<string name="idle_refresh_period_1min">Кожної хвилини</string>
<string name="idle_refresh_period_2min">Кожні 2 хвилини</string>
<string name="idle_refresh_period_3min">Кожні 3 хвилини</string>
<string name="idle_refresh_period_6min">Кожні 6 хвилин</string>
<string name="idle_refresh_period_12min">Кожні 12 хвилин</string>
<string name="idle_refresh_period_24min">Кожні 24 хвилини</string>
<string name="idle_refresh_period_36min">Кожні 36 хвилин</string>
<string name="idle_refresh_period_48min">Кожні 48 хвилин</string>
<string name="idle_refresh_period_60min">Кожні 60 хвилин</string>
<string name="account_setup_options_notify_label">Сповіщати мене про прибуття нової пошти</string>
<string name="account_setup_options_notify_sync_label">Сповіщати мене, коли триває перевірка пошти</string>
<string name="account_setup_options_mail_display_count_label">Кількість показаних повідомлень</string>
<string name="account_setup_options_mail_display_count_10">10 повідомлень</string>
<string name="account_setup_options_mail_display_count_25">25 повідомлень</string>
<string name="account_setup_options_mail_display_count_50">50 повідомлень</string>
<string name="account_setup_options_mail_display_count_100">100 повідомлень</string>
<string name="account_setup_options_mail_display_count_250">250 повідомлень</string>
<string name="account_setup_options_mail_display_count_500">500 повідомлень</string>
<string name="account_setup_options_mail_display_count_1000">1000 повідомлень</string>
<string name="account_setup_options_mail_display_count_all">усі повідомлення</string>
<string name="move_copy_cannot_copy_unsynced_message">Не можна копіювати чи переміщувати повідомлення, яке не синхронізоване з сервером</string>
<string name="account_setup_failed_dlg_title">Налаштування не завершено</string>
<string name="account_setup_failed_dlg_edit_details_action">Змінити дані</string>
<string name="account_setup_failed_dlg_continue_action">Продовжити</string>
<string name="account_settings_push_advanced_title">Додатково</string>
<string name="account_settings_title_fmt">Параметри облікового запису</string>
<string name="account_settings_default_label">Типова скринька</string>
<string name="account_settings_default_summary">Надсилати пошту з цього запису за замовчуванням</string>
<string name="account_settings_notify_label">Сповіщення про нову пошту</string>
<string name="account_settings_notify_sync_label">Сповіщення про синхронізацію</string>
<string name="account_settings_email_label">Адреса вашої електронної пошти</string>
<string name="account_settings_notify_summary">Сповіщати у рядку стану про нові повідомлення</string>
<string name="account_settings_notify_sync_summary">Сповіщати у рядку стану про перевірку пошти</string>
<string name="account_settings_notify_self_label">Включаючи надіслані повідомлення</string>
<string name="account_settings_notify_self_summary">Показати сповіщення про надіслані мною повідомлення</string>
<string name="account_settings_notification_opens_unread_label">Сповіщати про відкриття непрочитаних повідомлень</string>
<string name="account_settings_notification_opens_unread_summary">Шукати непрочитані повідомлення, коли сповіщення відкрито</string>
<string name="account_settings_mark_message_as_read_on_view_label">Відмічати повідомлення як прочитане під час відкриття</string>
<string name="account_settings_mark_message_as_read_on_view_summary">Відмічати повідомлення як прочитане під час відкриття для перегляду</string>
<string name="account_settings_show_pictures_label">Завжди показувати зображення</string>
<string name="account_settings_show_pictures_never">Ні</string>
<string name="account_settings_show_pictures_only_from_contacts">Від контактів</string>
<string name="account_settings_show_pictures_always">Від кожного</string>
<string name="account_settings_composition">Написання повідомлень</string>
<string name="account_settings_default_quoted_text_shown_label">Цитувати ориґінальне повідомлення під час відповіді</string>
<string name="account_settings_default_quoted_text_shown_summary">Ориґінальне повідомлення вставляється у відповідь.</string>
<string name="account_settings_reply_after_quote_label">Відповідати після цитати</string>
<string name="account_settings_reply_after_quote_summary">У відповіді ориґінальне повідомлення буде вище самої відповіді.</string>
<string name="account_settings_strip_signature_label">Забирати підпис з цитати у відповіді</string>
<string name="account_settings_strip_signature_summary">При відповіді на повідомлення, підпис цитованого текст буде видалений</string>
<string name="account_settings_message_format_label">Формат повідомлення</string>
<string name="account_settings_message_format_text">Звичайний текст (не зберігати зображення та форматування)</string>
<string name="account_settings_message_format_html">HTML (зберігати зображення та форматування)</string>
<string name="account_settings_message_format_auto">Автоматичний (plain text unless replying to an HTML message)</string>
<string name="account_settings_always_show_cc_bcc_label">Завжди показувати Cc/Bcc</string>
<string name="account_settings_message_read_receipt_label">Повідомлення про прочитання</string>
<string name="account_settings_message_read_receipt_summary">Завжди запитувати повідомлення про прочитання</string>
<string name="account_settings_quote_style_label">Стиль цитування</string>
<string name="account_settings_quote_style_prefix">Префікс (наприклад Gmail, Pine)</string>
<string name="account_settings_quote_style_header">Заголовок (наприклад Outlook, Yahoo!, Hotmail)</string>
<string name="account_settings_general_title">Загальні налаштування</string>
<string name="account_settings_reading_mail">Читання повідомлення</string>
<string name="account_settings_sync">Синхронізація пошти</string>
<string name="account_settings_folders">Папки</string>
<string name="account_settings_quote_prefix_label">Префікс цитованого тексту</string>
<string name="account_settings_crypto">Шифрування</string>
<string name="account_settings_crypto_app">OpenPGP</string>
<string name="account_settings_crypto_app_none">Ні</string>
<string name="account_settings_crypto_auto_signature">Автопідпис</string>
<string name="account_settings_crypto_auto_signature_summary">Використовувати електронну адресу для формування ключа підпису.</string>
<string name="account_settings_crypto_auto_encrypt">Автошифрування</string>
<string name="account_settings_crypto_auto_encrypt_summary">Автоматична установка шифрування, якщо співпадає відкритий ключ одержувача.</string>
<string name="account_settings_crypto_apg_not_installed">APG не встановлено</string>
<string name="account_settings_mail_check_frequency_label">Частота опитування папок</string>
<string name="account_settings_storage_title">Пам’ять</string>
<string name="account_settings_color_label">Колір облікового запису</string>
<string name="account_settings_color_summary">Виберіть колір облікового запису для папок та списку облікових записів</string>
<string name="account_settings_led_color_label">Колір для сповіщень блиманням</string>
<string name="account_settings_led_color_summary">Виберіть колір блимання вашого телефону для цього облікового запису</string>
<string name="account_settings_mail_display_count_label">Кількість відображуваних повідомлень</string>
<string name="account_settings_autodownload_message_size_label">Завантажувати повідомлення до </string>
<string name="account_settings_autodownload_message_size_1">1Кб</string>
<string name="account_settings_autodownload_message_size_2">2Кб</string>
<string name="account_settings_autodownload_message_size_4">4Кб</string>
<string name="account_settings_autodownload_message_size_8">8Кб</string>
<string name="account_settings_autodownload_message_size_16">16Кб</string>
<string name="account_settings_autodownload_message_size_32">32Кб</string>
<string name="account_settings_autodownload_message_size_64">64Кб</string>
<string name="account_settings_autodownload_message_size_128">128Кб</string>
<string name="account_settings_autodownload_message_size_256">256Кб</string>
<string name="account_settings_autodownload_message_size_512">512Кб</string>
<string name="account_settings_autodownload_message_size_1024">1Мб</string>
<string name="account_settings_autodownload_message_size_2048">2Мб</string>
<string name="account_settings_autodownload_message_size_5120">5Мб</string>
<string name="account_settings_autodownload_message_size_10240">10Мб</string>
<string name="account_settings_autodownload_message_size_any">будь-якого розміру (без обмежень)</string>
<string name="account_settings_message_age_label">Синхронізувати повідомлення за</string>
<string name="account_settings_message_age_any">датою (без обмежень) </string>
<string name="account_settings_message_age_0">сьогодні</string>
<string name="account_settings_message_age_1">останні 2 дні</string>
<string name="account_settings_message_age_2">останні 3 дні</string>
<string name="account_settings_message_age_7">останній тиждень</string>
<string name="account_settings_message_age_14">останні 2 тижні</string>
<string name="account_settings_message_age_21">останні 3 тижні</string>
<string name="account_settings_message_age_1_month">останній місяць</string>
<string name="account_settings_message_age_2_months">останні 2 місяці</string>
<string name="account_settings_message_age_3_months">останні 3 місяці</string>
<string name="account_settings_message_age_6_months">останні 6 місяців</string>
<string name="account_settings_message_age_1_year">останній рік</string>
<string name="account_settings_folder_display_mode_label">Вибір папок для відображення</string>
<string name="account_settings_folder_display_mode_all">Усі</string>
<string name="account_settings_folder_display_mode_first_class">Тільки папки 1-го класу</string>
<string name="account_settings_folder_display_mode_first_and_second_class">Папки 1-го та 2-го класу</string>
<string name="account_settings_folder_display_mode_not_second_class">Усе крім папок другого класу</string>
<string name="account_settings_folder_sync_mode_label">Вибір папок для сихронізації</string>
<string name="account_settings_folder_sync_mode_all">Усі</string>
<string name="account_settings_folder_sync_mode_first_class">Тільки папки 1-го класу</string>
<string name="account_settings_folder_sync_mode_first_and_second_class">Папки 1-го та 2-го класу</string>
<string name="account_settings_folder_sync_mode_not_second_class">Усе крім папок другого класу</string>
<string name="account_settings_folder_sync_mode_none">Нічого</string>
<string name="account_settings_folder_push_mode_label">Вибір папок для push</string>
<string name="account_settings_folder_push_mode_all">Усі</string>
<string name="account_settings_folder_push_mode_first_class">Тільки папки 1-го класу</string>
<string name="account_settings_folder_push_mode_first_and_second_class">Папки 1-го та 2-го класу</string>
<string name="account_settings_folder_push_mode_not_second_class">Усе крім папок другого класу</string>
<string name="account_settings_folder_push_mode_none">Нічого</string>
<string name="account_settings_folder_target_mode_label">Перемістити/копіювати папки призначення</string>
<string name="account_settings_folder_target_mode_all">Усі</string>
<string name="account_settings_folder_target_mode_first_class">Тільки папки 1-го класу</string>
<string name="account_settings_folder_target_mode_first_and_second_class">Папки 1-го та 2-го класу</string>
<string name="account_settings_folder_target_mode_not_second_class">Усе крім папок другого класу</string>
<string name="account_settings_sync_remote_deletetions_label">Синхронізація вилучень на сервері</string>
<string name="account_settings_sync_remote_deletetions_summary">Видалити повідомлення, якщо видалено на сервері</string>
<string name="folder_settings_title">Налаштування папок</string>
<string name="folder_settings_in_top_group_label">Показувати у верхній групі</string>
<string name="folder_settings_in_top_group_summary">Показувати у верхній частині списку папок</string>
<string name="folder_settings_folder_display_mode_label">Клас відображення папки</string>
<string name="folder_settings_folder_display_mode_normal">Жодний</string>
<string name="folder_settings_folder_display_mode_first_class">1-ий клас</string>
<string name="folder_settings_folder_display_mode_second_class">2-ий клас</string>
<string name="folder_settings_folder_sync_mode_label">Клас синхронізації папки</string>
<string name="folder_settings_folder_sync_mode_normal">Жодний</string>
<string name="folder_settings_folder_sync_mode_first_class">1-ий клас</string>
<string name="folder_settings_folder_sync_mode_second_class">2-ий клас</string>
<string name="folder_settings_folder_sync_mode_inherited">Такий самий як і клас відображення</string>
<string name="folder_settings_folder_push_mode_label">Клас папки для push</string>
<string name="folder_settings_folder_push_mode_normal">Жодний</string>
<string name="folder_settings_folder_push_mode_first_class">1-ий клас</string>
<string name="folder_settings_folder_push_mode_second_class">2-ий клас</string>
<string name="folder_settings_folder_push_mode_inherited">Такий самий як і клас синхронізації</string>
<string name="account_settings_incoming_label">Сервер вхідної пошти</string>
<string name="account_settings_incoming_summary">Налаштування сервера вхідної погти</string>
<string name="account_settings_outgoing_label">Сервер вихідної пошти</string>
<string name="account_settings_outgoing_summary">Налаштування сервера вихідної пошти (SMTP)</string>
<string name="account_settings_description_label">Ім’я облікового запису</string>
<string name="account_settings_name_label">Ваше ім’я</string>
<string name="notifications_title">Сповіщення</string>
<string name="account_settings_vibrate_enable">Вібрація</string>
<string name="account_settings_vibrate_summary">Вібрація при нових повідомленнях</string>
<string name="account_settings_vibrate_pattern_label">Шаблони для вібрації</string>
<string name="account_settings_vibrate_pattern_default">типовий</string>
<string name="account_settings_vibrate_pattern_1">Вібрація 1</string>
<string name="account_settings_vibrate_pattern_2">Вібрація 2</string>
<string name="account_settings_vibrate_pattern_3">Вібрація 3</string>
<string name="account_settings_vibrate_pattern_4">Вібрація 4</string>
<string name="account_settings_vibrate_pattern_5">Вібрація 5</string>
<string name="account_settings_vibrate_times">Повторити вібрацію</string>
<string name="account_settings_ringtone">Вибір мелодії для нової пошти</string>
<string name="account_settings_led_label">Блимання</string>
<string name="account_settings_led_summary">Блимання при нових повідомленнях</string>
<string name="account_settings_composition_title">Параметри створення повідомлень</string>
<string name="account_settings_composition_label">За замовчуванням</string>
<string name="account_settings_composition_summary">Встановити типові Від, Прихована та підпис</string>
<string name="account_settings_identities_label">Управління особами</string>
<string name="account_settings_identities_summary">Встановити альтернативні адреси „Від“ та підписи</string>
<string name="manage_identities_title">Управління особами</string>
<string name="manage_identities_context_menu_title">Управління особою</string>
<string name="edit_identity_title">Редагувати особу</string>
<string name="new_identity_action">Нова особа</string>
<string name="account_settings_always_bcc_label">Прихована копія усіх повідомлень до </string>
<string name="manage_identities_edit_action">Редагувати</string>
<string name="manage_identities_move_up_action">Пересунути вище</string>
<string name="manage_identities_move_down_action">Пересунути нижче</string>
<string name="manage_identities_move_top_action">Пересунути на початок/ зробити типовою</string>
<string name="manage_identities_remove_action">Видалити</string>
<string name="edit_identity_description_label">Опис особи</string>
<string name="edit_identity_description_hint">(Необов’язково)</string>
<string name="edit_identity_name_label">Ваше ім’я</string>
<string name="edit_identity_name_hint">(Необов’язково)</string>
<string name="edit_identity_email_label">Адреса електронної пошти</string>
<string name="edit_identity_email_hint">(Обов’язково)</string>
<string name="edit_identity_reply_to_label">Відповідати на адресу</string>
<string name="edit_identity_reply_to_hint">(Необов’язково)</string>
<string name="edit_identity_signature_label">Підпис</string>
<string name="edit_identity_signature_hint">(Обов’язково)</string>
<string name="account_settings_signature_use_label">Використовувати підпис</string>
<string name="account_settings_signature_label">Підпис</string>
<string name="default_identity_description">Первісна особа</string>
<string name="choose_identity_title">Вибрати особу</string>
<string name="send_as">Надіслати як</string>
<string name="no_removable_identity">Не можна видалити єдину особу</string>
<string name="identity_has_no_email">Не можна використовувати особу без електронної пошти</string>
<string name="sort_earliest_first">Спершу старі повідомлення</string>
<string name="sort_latest_first">Спершу нові повідомлення</string>
<string name="sort_subject_alpha">Тема за алфавітом</string>
<string name="sort_subject_re_alpha">Тема за алфавітом у зворотньому порядку</string>
<string name="sort_sender_alpha">Відправники за алфавітом</string>
<string name="sort_sender_re_alpha">Відправники в зворотньому порядку за алфавітом</string>
<string name="sort_flagged_first">Спершу повідомлення із зірочками</string>
<string name="sort_flagged_last">Спершу повідомлення без зірочок</string>
<string name="sort_unread_first">Спершу непрочитані повідомлення</string>
<string name="sort_unread_last">Спершу прочитані повідомлення</string>
<string name="sort_attach_first">Спершу повідомлення з вкладеннями</string>
<string name="sort_unattached_first">Спершу повідомлення без вкладень</string>
<string name="sort_by">Упорядкувати за…</string>
<string name="sort_by_date">датою</string>
<string name="sort_by_arrival">Надходженням</string>
<string name="sort_by_subject">Темою</string>
<string name="sort_by_sender">Відправник</string>
<string name="sort_by_flag">Зірочкою</string>
<string name="sort_by_unread">Прочитані/непрочитані</string>
<string name="sort_by_attach">Вкладенням</string>
<string name="account_delete_dlg_title">Видалити обліковий запис</string>
<string name="account_recreate_dlg_title">Створити наново обліковий запис</string>
<string name="account_clear_dlg_title">Очистити обліковий запис</string>
<string name="provider_note_auonejp">Якщо ви хочете використовувати IMAP або POP3 для цього постачальника, ви маєте дозволити використання IMAP або POP3 на сторінці налаштувань пошти.</string>
<string name="provider_note_naver">Якщо ви хочете використовувати IMAP або POP3 для цього постачальника, ви маєте дозволити використання IMAP або POP3 на сторінці налаштувань пошти Naver.</string>
<string name="provider_note_hanmail">Якщо ви хочете використовувати IMAP або POP3 для цього постачальника, ви маєте дозволити використання IMAP або POP3 на сторінці налаштувань пошти Hanmail(Daum).</string>
<string name="account_setup_failed_dlg_invalid_certificate_title">Сертифікат невизнано</string>
<string name="account_setup_failed_dlg_invalid_certificate_accept">Прийняти сертифікат</string>
<string name="account_setup_failed_dlg_invalid_certificate_reject">Відхилити сертифікат</string>
<string name="folder_list_filter_hint">ім’я папки містить</string>
<string name="folder_list_display_mode_label">Папки</string>
<string name="folder_list_display_mode_all">Відображати усі папки</string>
<string name="folder_list_display_mode_first_class">Відображати тільки папки 1-го класу</string>
<string name="folder_list_display_mode_first_and_second_class">Відображати папки 1-го і 2-го класу</string>
<string name="folder_list_display_mode_not_second_class">Відображати усі, крім папок 2-го класу</string>
<string name="account_settings_signature__location_label">Розташування підпису</string>
<string name="account_settings_signature__location_before_quoted_text">перед цитатою</string>
<string name="account_settings_signature__location_after_quoted_text">після цитати</string>
<string name="setting_theme_global">Використовувати тему додатку</string>
<string name="setting_theme_dark">Темно</string>
<string name="setting_theme_light">Світло</string>
<string name="display_preferences">Екран</string>
<string name="global_preferences">Глобальні</string>
<string name="debug_preferences">Відлагодження</string>
<string name="privacy_preferences">Конфіденційність</string>
<string name="network_preferences">Мережа</string>
<string name="interaction_preferences">Взаємодія</string>
<string name="accountlist_preferences">Список облікових записів</string>
<string name="messagelist_preferences">Список повідомлень</string>
<string name="messageview_preferences">Повідомлення</string>
<string name="folderlist_preferences">Список папок</string>
<string name="settings_theme_label">Тема</string>
<string name="settings_message_theme_label">Перегляд теми повідомлень</string>
<string name="settings_compose_theme_label">Написати тему</string>
<string name="settings_language_label">Мова</string>
<string name="settings_message_theme_selection_label">Встановити тему повідомлення</string>
<string name="settings_message_theme_selection_summary_off">Виберіть перегляд теми повідомлення під час перегляду повідомлення</string>
<string name="setting_language_system">Системна по замовчуванню</string>
<string name="background_ops_label">Фонова синхронізація</string>
<string name="background_ops_never">Ніколи</string>
<string name="background_ops_always">Завжди</string>
<string name="background_ops_auto_sync_only">Коли \"Автосинхронізація\" увімкнена</string>
<string name="batch_select_all">Вибрати усе</string>
<string name="account_setup_push_limit_label">Найбільша кількість папок для перевірки з push</string>
<string name="account_setup_push_limit_10">10 папок</string>
<string name="account_setup_push_limit_25">25 папок</string>
<string name="account_setup_push_limit_50">50 папок</string>
<string name="account_setup_push_limit_100">100 папок</string>
<string name="account_setup_push_limit_250">250 папок</string>
<string name="account_setup_push_limit_500">500 папок</string>
<string name="account_setup_push_limit_1000">1000 папок</string>
<string name="animations_title">Анімація</string>
<string name="animations_summary">Використовувати яскраві візуальні ефекти</string>
<string name="gestures_title">Жести</string>
<string name="gestures_summary">Приймати управління жестами</string>
<string name="volume_navigation_title">Використовувати управління гучністю для навігації</string>
<string name="volume_navigation_message">Перегляд повідомлень</string>
<string name="volume_navigation_list">Різноманітні списки елементів</string>
<string name="start_integrated_inbox_title">При запуску відкривати спільну папку „Вхідні“</string>
<string name="measure_accounts_title">Показувати розмір скриньки</string>
<string name="measure_accounts_summary">Вимкнути для швидкого відображення</string>
<string name="count_search_title">Рахувати результати пошуку</string>
<string name="count_search_summary">Вимкнути для швидкого відображення</string>
<string name="hide_special_accounts_title">Приховати спеціальні облікові записи</string>
<string name="hide_special_accounts_summary">Приховати спільну папку „Вхідні“ та всі облікові записи повідомлень</string>
<string name="search_title"><xliff:g id="search_name">%s</xliff:g> <xliff:g id="modifier">%s</xliff:g></string>
<string name="flagged_modifier"> - Відмічені зірочкою</string>
<string name="unread_modifier"> - Непрочитані</string>
<string name="search_all_messages_title">Всі повідомлення</string>
<string name="search_all_messages_detail">Всі повідомлення у папках для пошуку</string>
<string name="integrated_inbox_title">Спільна папка вхідної пошти</string>
<string name="integrated_inbox_detail">Усі повідомлення у об’єднаних папках</string>
<string name="tap_hint">Натисніть конверт або зірочку для непрочитаних або відмічених зірочкою повідомлень</string>
<string name="folder_settings_include_in_integrated_inbox_label">Об’єднати</string>
<string name="folder_settings_include_in_integrated_inbox_summary">Показувати усі повідомлення у спільній папці „Вхідні“</string>
<string name="account_settings_searchable_label">Папки для пошуку</string>
<string name="account_settings_searchable_all">Всі</string>
<string name="account_settings_searchable_displayable">Тільки у видимих</string>
<string name="account_settings_searchable_none">Нічого</string>
<string name="font_size_settings_title">Розмір шрифту</string>
<string name="font_size_settings_description">Налаштувати розмір шрифту</string>
<string name="font_size_account_list">Список облікових записів</string>
<string name="font_size_account_name">Ім’я облікового запису</string>
<string name="font_size_account_description">Опис облікового запису</string>
<string name="font_size_folder_list">Список папок</string>
<string name="font_size_folder_name">Ім’я папки</string>
<string name="font_size_folder_status">Статус папки</string>
<string name="font_size_message_list">Список повідомлень</string>
<string name="font_size_message_list_subject">Тема</string>
<string name="font_size_message_list_sender">Відправник</string>
<string name="font_size_message_list_date">Дата</string>
<string name="font_size_message_list_preview">Попередній перегляд</string>
<string name="font_size_message_view">Повідомлення</string>
<string name="font_size_message_view_sender">Відправник</string>
<string name="font_size_message_view_to">Кому</string>
<string name="font_size_message_view_cc">Копія</string>
<string name="font_size_message_view_additional_headers">Додаткові заголовки</string>
<string name="font_size_message_view_subject">Тема</string>
<string name="font_size_message_view_date">Час і дата</string>
<string name="font_size_message_view_content">Тіло повідомлення</string>
<string name="font_size_message_compose">Створення повідомлень</string>
<string name="font_size_message_compose_input">Поля для вводу тексту</string>
<string name="font_size_default">типовий</string>
<string name="font_size_tiniest">Найдрібніший</string>
<string name="font_size_tiny">Дрібний</string>
<string name="font_size_smaller">Менший</string>
<string name="font_size_small">Малий</string>
<string name="font_size_medium">Середній</string>
<string name="font_size_large">Великий</string>
<string name="font_size_larger">Найбільший</string>
<string name="miscellaneous_preferences">Різне</string>
<!--APG related-->
<string name="error_activity_not_found">Відсутня програма для цієї дії.</string>
<string name="error_apg_version_not_supported">Встановлена версія APG не підтримується.</string>
<string name="btn_crypto_sign">Підписати</string>
<string name="btn_encrypt">Зашифрувати</string>
<string name="btn_decrypt">Розшифрувати</string>
<string name="btn_verify">Перевірити</string>
<string name="unknown_crypto_signature_user_id"><невідомий></string>
<string name="key_id">id: %s</string>
<string name="pgp_mime_unsupported">PGP/MIME повідомлення ще не підтримуються.</string>
<string name="attachment_encryption_unsupported">Увага: вкладення ще не підписані та не зашифровані.</string>
<string name="send_aborted">Надсилання скасовано.</string>
<string name="save_or_discard_draft_message_dlg_title">Зберегти чернетку повідомлення?</string>
<string name="save_or_discard_draft_message_instructions_fmt">Зберегти чи відмінити це повідомлення?</string>
<string name="confirm_discard_draft_message_title">Відмінити повідомлення?</string>
<string name="confirm_discard_draft_message">Ви дійсно хочете відмінити це повідомлення?</string>
<string name="refuse_to_save_draft_marked_encrypted_dlg_title">Скасувати збереження чернетки повідомлення.</string>
<string name="refuse_to_save_draft_marked_encrypted_instructions_fmt">Скасувати збереження чернетки повідомлення, позначеного як зашифроване.</string>
<string name="continue_without_public_key_dlg_title">Продовжити без публічного ключа?</string>
<string name="continue_without_public_key_instructions_fmt">Один чи більше одержувачів не мають публічного ключа. Продовжити?</string>
<string name="select_text_now">Виберіть текст для копіювання.</string>
<string name="dialog_confirm_delete_title">Підтвердіть вилучення</string>
<string name="dialog_confirm_delete_message">Ви хочете вилучити це повідомлення?</string>
<string name="dialog_confirm_delete_confirm_button">Вилучати</string>
<string name="dialog_confirm_delete_cancel_button">Не вилучати</string>
<string name="dialog_confirm_spam_title">Підтвердіть перенесення у папку „Спам“</string>
<string name="dialog_confirm_spam_confirm_button">Так</string>
<string name="dialog_confirm_spam_cancel_button">Ні</string>
<string name="dialog_attachment_progress_title">Завантаження вкладення</string>
<string name="debug_logging_enabled">Включити запис у журнал відлагоджувальної інформації</string>
<string name="messagelist_sent_to_me_sigil">»</string>
<string name="messagelist_sent_cc_me_sigil">›</string>
<string name="error_unable_to_connect">Не вдається з’єднатися.</string>
<string name="import_export_action">Іморт і експорт налаштувань</string>
<string name="settings_export_account">Експортувати налаштування облікового запису</string>
<string name="settings_export_all">Експортувати налаштування та облікові записи</string>
<string name="settings_import_dialog_title">Імпорт</string>
<string name="settings_export_dialog_title">Експорт</string>
<string name="settings_import">Імпортувати налаштування</string>
<string name="settings_import_selection">Імпортувати вибране</string>
<string name="settings_import_global_settings">Глобальні налаштування</string>
<string name="settings_exporting">Експортуються налаштування…</string>
<string name="settings_importing">Імпортуються налаштування…</string>
<string name="settings_import_scanning_file">Сканується файл…</string>
<string name="settings_export_success">Налаштування були експортовані у <xliff:g id="filename">%s</xliff:g></string>
<string name="settings_import_global_settings_success">Глобальні налаштування були імпортовані з <xliff:g id="filename">%s</xliff:g></string>
<string name="settings_import_success">Імпортовано <xliff:g id="accounts">%s</xliff:g> з <xliff:g id="filename">%s</xliff:g></string>
<plurals name="settings_import_accounts">
<item quantity="one">1 обліковий запис</item>
<item quantity="few"><xliff:g id="numAccounts">%s</xliff:g> облікові записи</item>
<item quantity="other"><xliff:g id="numAccounts">%s</xliff:g> облікових записів</item>
</plurals>
<string name="settings_export_failure">Не вдалося експортувати налаштування</string>
<string name="settings_import_failure">Не вдалося імпортувати налаштування з <xliff:g id="filename">%s</xliff:g></string>
<string name="settings_export_success_header">Експорт успішний</string>
<string name="settings_export_failed_header">Експорт не вдався</string>
<string name="settings_import_success_header">Імпорт успішний</string>
<string name="settings_import_failed_header">Імпорт не вдався</string>
<string name="settings_import_activate_account_header">Активувати обліковий запис</string>
<string name="settings_import_activate_account_intro">Щоб використовувати обліковий запис \"<xliff:g id="account">%s</xliff:g>\" вам необхідно вказати <xliff:g id="server_passwords">%s</xliff:g>.</string>
<plurals name="settings_import_server_passwords">
<item quantity="one">пароль сервера</item>
<item quantity="few">паролі сервера</item>
<item quantity="other">паролів сервера</item>
</plurals>
<string name="settings_import_incoming_server">Сервер вхідної пошти (<xliff:g id="hostname">%s</xliff:g>):</string>
<string name="settings_import_outgoing_server">Сервер вихідної пошти (<xliff:g id="hostname">%s</xliff:g>):</string>
<string name="settings_import_use_incoming_server_password">Використовувати пароль сервера вхідної пошти</string>
<string name="activate_account_action">Активувати</string>
<string name="account_unavailable">Обліковий запис \"<xliff:g id="account">%s</xliff:g>\" недоступний; перевірте пам’ять</string>
<string name="settings_attachment_default_path">Зберегти вкладення до…</string>
<string name="attachment_save_title">Зюерегти вкладення</string>
<string name="attachment_save_desc">Не знайдено браузер файлів. Де ви хочете зберегти це вкладення?</string>
<string name="manage_accounts_move_up_action">Перемістити вгору</string>
<string name="manage_accounts_move_down_action">Перемістити вниз</string>
<string name="manage_accounts_moving_message">Переміщення облікового запису…</string>
<string name="unread_widget_select_account">Показати кількість непрочитаних для…</string>
<string name="import_dialog_error_title">Відсутній файловий менеджер</string>
<string name="close">Закрити</string>
<string name="webview_empty_message">Нема тексту</string>
<string name="webview_contextmenu_link_view_action">Відкрити для перегляду</string>
<string name="webview_contextmenu_link_share_action">Рекомендувати посилання</string>
<string name="webview_contextmenu_link_copy_action">Копіювати посилання до буфера обміну</string>
<string name="webview_contextmenu_link_clipboard_label">Посилання</string>
<string name="webview_contextmenu_image_title">Зображення</string>
<string name="webview_contextmenu_image_view_action">Перегляд зображеня</string>
<string name="webview_contextmenu_image_save_action">Зберегти зображення</string>
<string name="webview_contextmenu_image_download_action">Завантажити зображення</string>
<string name="webview_contextmenu_image_copy_action">Копіювати посилання на зображення до буфера обміну</string>
<string name="webview_contextmenu_image_clipboard_label">Посилання на зображення</string>
<string name="webview_contextmenu_phone_call_action">Подзвонити за номером</string>
<string name="webview_contextmenu_phone_save_action">Зберегти до контактів</string>
<string name="webview_contextmenu_phone_copy_action">Копіювати телефонний номер до буфера обміну</string>
<string name="webview_contextmenu_phone_clipboard_label">Телефонний номер</string>
<string name="webview_contextmenu_email_send_action">Надіслати пошту</string>
<string name="webview_contextmenu_email_save_action">Зберегти до контактів</string>
<string name="webview_contextmenu_email_copy_action">Копіювати електронну адресу до буфера обміну</string>
<string name="webview_contextmenu_email_clipboard_label">Електронна адреса</string>
<string name="image_saved_as">Зберегти зображеня як \"<xliff:g id="filename">%s</xliff:g>\"</string>
<string name="image_saving_failed">Збереження зображення скасовано.</string>
<string name="account_settings_remote_search_num_results_entries_all">Всі</string>
<string name="account_settings_remote_search_num_results_entries_10">10</string>
<string name="account_settings_remote_search_num_results_entries_25">25</string>
<string name="account_settings_remote_search_num_results_entries_50">50</string>
<string name="account_settings_remote_search_num_results_entries_100">100</string>
<string name="account_settings_remote_search_num_results_entries_250">250</string>
<string name="account_settings_remote_search_num_results_entries_500">500</string>
<string name="account_settings_remote_search_num_results_entries_1000">1000</string>
<string name="account_settings_remote_search_num_label">Межа серверу</string>
<string name="account_settings_remote_search_num_summary">Пошук зупинити після знаходження <xliff:g id="num_results">%s</xliff:g> результатів.</string>
<string name="account_settings_remote_search_full_text">Включити текст повідомлення в пошуку на сервері</string>
<string name="account_settings_remote_search_full_text_summary">Пошук повного тексту буде повільним</string>
<string name="remote_search_sending_query">Відправлення запиту до сервера</string>
<string name="remote_search_downloading">Відібрано %d результатів</string>
<string name="remote_search_downloading_limited">Відібрано %1$d з %2$d результатів</string>
<string name="remote_search_error">Віддалений пошук не вдався</string>
<string name="account_settings_search">Пошук</string>
<string name="account_settings_remote_search_enabled">Увімкнути пошук серверу</string>
<string name="account_settings_remote_search_enabled_summary">Шукати повідомлення на сервері додатково до тих, що у вас на пристрої</string>
<string name="action_remote_search">Шукати повідомлення на сервері</string>
<string name="pull_to_refresh_remote_search_from_local_search_pull">Потягніть для пошуку на сервері</string>
<string name="pull_to_refresh_remote_search_from_local_search_release">Відпустіть для пошуку на сервері</string>
<string name="remote_search_unavailable_no_network">Для пошуку на сервері необхідно приєднатись до мережі.</string>
<string name="global_settings_background_as_unread_indicator_summary">Затемнити повідомлення після прочитання</string>
<string name="global_settings_threaded_view_label">Режим перегляду</string>
<string name="global_settings_threaded_view_summary">Групувати повідомлення по розмові</string>
<string name="upgrade_databases_title">Поновити базу даних</string>
<string name="upgrade_databases_unspecified">Поновити базу даних…</string>
<string name="upgrade_database_format">Поновити базу даних з облікового запису \"<xliff:g id="account">%s</xliff:g>\" </string>
<string name="message_list_loading">Завантаження…</string>
<string name="global_settings_splitview_mode_label">Перегляд розділеного екрану</string>
<string name="global_settings_splitview_always">Завжди</string>
<string name="global_settings_splitview_never">Ніколи</string>
<string name="global_settings_splitview_when_in_landscape">Коли в альбомній орієнтації</string>
<string name="message_view_empty">Будь ласка, виберіть повідомлення зліва</string>
<string name="global_settings_show_contact_picture_label">Показувати зображення контактів</string>
<string name="global_settings_show_contact_picture_summary">Показувати зображення контактів в списку повідомлень</string>
<string name="last_refresh_time_format">Оновлення <xliff:g id="formatted_time">%s</xliff:g></string>
<string name="last_refresh_time_format_with_push">Оновлення <xliff:g id="time_with_preposition">%s</xliff:g> (Push активні)</string>
<string name="preposition_for_date">на <xliff:g id="date">%s</xliff:g></string>
<string name="mark_all_as_read">Помітити прочитаним</string>
<string name="global_settings_colorize_missing_contact_pictures_label">Кольорові зображення контактів</string>
<string name="global_settings_messageview_visible_refile_actions_title">Видимі дії повідомлення</string>
<string name="global_settings_messageview_visible_refile_actions_summary">Показувати вибрані дії в меню перегляду повідомлень</string>
<string name="loading_attachment">Завантаження вкладень…</string>
<string name="fetching_attachment_dialog_title_send">Збереження повідомлення</string>
<string name="fetching_attachment_dialog_title_save">Збереження чернетки</string>
<string name="fetching_attachment_dialog_message">Отримання вкладення…</string>
<!--=== OpenPGP specific ==================================================================-->
<!--=== Client certificates specific ==================================================================-->
</resources>
| {
"content_hash": "40803bd8a3861c3867c53cc28e9ad74b",
"timestamp": "",
"source": "github",
"line_count": 854,
"max_line_length": 234,
"avg_line_length": 82.99297423887587,
"alnum_prop": 0.7676787629098708,
"repo_name": "gnebsy/k-9",
"id": "8530cd3b8a9e4796090940303daa0fd9225196c6",
"size": "87400",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "res/values-uk/strings.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "HTML",
"bytes": "292"
},
{
"name": "Java",
"bytes": "3365761"
},
{
"name": "Makefile",
"bytes": "1890"
},
{
"name": "Shell",
"bytes": "2089"
}
],
"symlink_target": ""
} |
<?php
/*
* @package libSSE-php
* @author Licson Lee <[email protected]>
* @description A PHP library for handling Server-Sent Events (SSE)
*/
/*
* @class SSEData_MySQLi
* @description The MySQLi data mechnism
*/
class SSEData_MySQLi {
private $conn;
private $credinals;
/*
* @method SSEData_MySQLi::__construct
* @param $credinals the data needed to connect to a database
*/
public function __construct($credinals){
if($credinals !== null){
$this->credinals = $credinals;
if(!$this->connect()){
throw new Exception('Error establishing connection.');
}
$this->prepare();
}
else
{
throw new Exception('No credinals specified.');
}
}
/*
* @method SSEData_MySQLi::connect
* @description connect to the MySQL server
*/
private function connect(){
$host = $this->credinals['host'];
$user = $this->credinals['user'];
$pass = $this->credinals['password'];
$db = $this->credinals['db'];
$this->conn = mysqli_connect($host,$user,$pass,$db);
return (bool)$this->conn;
}
/*
* @method SSEData_MySQLi::check_reconnect
* @description check the connection is valid, if not then reconnect
*/
private function check_reconnect(){
if(!mysqli_ping($this->conn)){
if(!$this->connect()){
throw new Exception('Error reconnect.');
}
}
}
/*
* @method SSEData_MySQLi::escape
* @param $str the string to escape
* @description escape string to prevent SQL Injection
*/
private function escape($str){
return mysqli_real_escape_string($this->conn,$str);
}
/*
* @method SSEData_MySQLi::prepare
* @description prepare the table to store data
*/
private function prepare(){
return (bool)(mysqli_query($this->conn,'CREATE TABLE IF NOT EXISTS `sse_data_table` (`key` varchar(50) NOT NULL, `value` text, PRIMARY KEY (`key`) ) ENGINE=MEMORY DEFAULT CHARSET=utf8;'));
}
/*
* @method SSEData_MySQLi::get
* @param $key the ID of the data
* @description get the data by the key
*/
public function get($key){
$this->check_reconnect();
$query = mysqli_query($this->conn,sprintf('SELECT * FROM `sse_data_table` WHERE `key` = \'%s\'',$this->escape($key)));
$res = mysqli_fetch_assoc($query);
return $res['value'];
}
/*
* @method SSEData_MySQLi::set
* @param $key the ID of the data
* @param $value the data
* @description add data to the table
*/
public function set($key,$value){
if($this->get($key)){
return mysqli_query($this->conn,sprintf("UPDATE `sse_data_table` SET `value` = '%s' WHERE `key` = '%s'",$this->escape($value),$this->escape($key)));
}
else {
return mysqli_query($this->conn,sprintf("INSERT INTO `sse_data_table` SET `key` = '%s', `value` = '%s'",$this->escape($key),$this->escape($value)));
}
}
/*
* @method SSEData_MySQLi::delete
* @param $key the ID of the data
* @description delete the data with the same ID specified
*/
public function delete($key){
return mysqli_query($this->conn,sprintf('DELETE FROM `sse_data_table` WHERE `key` == \'%s\'',$this->escape($key)));
}
};
//register the module
SSEData::register('mysqli','SSEData_MySQLi'); | {
"content_hash": "5386889f643c9bee79b3f705f0e3106f",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 190,
"avg_line_length": 29.60747663551402,
"alnum_prop": 0.6360479797979798,
"repo_name": "pp-pacman/redezeit_wortmeldungen",
"id": "9ab37b2cbbac420410785ba3abfe9fa4f395b9ef",
"size": "3168",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "libs/libsse/data_mechnisms/mysqli.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "19200"
},
{
"name": "JavaScript",
"bytes": "6775"
},
{
"name": "PHP",
"bytes": "70253"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.viperfish.chatapplication.core;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.apache.lucene.search.Query;
import org.hibernate.search.jpa.FullTextEntityManager;
import org.hibernate.search.jpa.FullTextQuery;
import org.hibernate.search.jpa.Search;
import org.hibernate.search.query.dsl.QueryBuilder;
import org.springframework.beans.FatalBeanException;
import org.springframework.orm.jpa.EntityManagerProxy;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @author sdai
*/
public class UserDatabaseImpl implements SearchableDatabase<User> {
@PersistenceContext
private EntityManager entityManager;
private EntityManagerProxy proxy;
private FullTextEntityManager getFullTextEntityManager() {
return Search.getFullTextEntityManager(proxy.getTargetEntityManager());
}
@PostConstruct
public void init() {
if (!(this.entityManager instanceof EntityManagerProxy)) {
throw new FatalBeanException("Entity Manager" + this.entityManager + " is not a proxy");
}
this.proxy = (EntityManagerProxy) this.entityManager;
}
@Transactional
@Override
public Collection<User> search(String query) {
FullTextEntityManager manager = this.getFullTextEntityManager();
QueryBuilder builder = manager.getSearchFactory().buildQueryBuilder().forEntity(User.class).get();
Query luceneQuery = builder.keyword().fuzzy()
.onFields("username").matching(query)
.createQuery();
FullTextQuery q = manager.createFullTextQuery(luceneQuery, User.class);
q.setProjection(FullTextQuery.THIS, FullTextQuery.SCORE);
@SuppressWarnings("unchecked")
List<Object[]> result = q.getResultList();
List<User> fine = new LinkedList<>();
result.stream().forEach((i) -> {
fine.add((User) i[0]);
});
return fine;
}
}
| {
"content_hash": "e26405cef0a2450d281ff5ace7ec2e70",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 106,
"avg_line_length": 33.21739130434783,
"alnum_prop": 0.7203315881326352,
"repo_name": "shilongdai/LSChatServer",
"id": "4965395bca2c5190f3f3520f388d3f7839265887",
"size": "2292",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/viperfish/chatapplication/core/UserDatabaseImpl.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "117345"
}
],
"symlink_target": ""
} |
module ChefZero
module Solr
module Query
class RegexpableQuery
def initialize(regexp_string, literal_string)
@regexp_string = regexp_string
# Surround the regexp with word boundaries
@regexp = Regexp.new("(^|#{NON_WORD_CHARACTER})#{regexp_string}($|#{NON_WORD_CHARACTER})", true)
@literal_string = literal_string
end
attr_reader :literal_string
attr_reader :regexp_string
attr_reader :regexp
def matches_doc?(doc)
matches_values?(doc[DEFAULT_FIELD])
end
def matches_values?(values)
values.any? { |value| [email protected](value).nil? }
end
DEFAULT_FIELD = "text"
WORD_CHARACTER = "[A-Za-z0-9@._':]"
NON_WORD_CHARACTER = "[^A-Za-z0-9@._':]"
end
end
end
end
| {
"content_hash": "ee54a65139b73308ea59c27025592075",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 106,
"avg_line_length": 28.82758620689655,
"alnum_prop": 0.5729665071770335,
"repo_name": "lazyval/chef-zero",
"id": "241e675ebc60e9a6d4adf9244362497d3aca6a56",
"size": "836",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "lib/chef_zero/solr/query/regexpable_query.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "51"
},
{
"name": "Ruby",
"bytes": "213740"
}
],
"symlink_target": ""
} |
(function(Pert, chrome) {
'use strict';
window.Pertext = (function() {
var ACTIVE_WM,
ACTIVE_SD,
STANDARD_DEVIATION,
WEIGHTED_MEAN,
currentStrategy,
storage,
getById,
getByClass,
strategyHandler,
isValid,
execute,
calculate,
persist,
restore,
copyToClipboard,
setStrategy,
activateStrategy,
activateWeightedMean,
activateStandardDeviation,
addClassAttr,
removeClassAttr,
standardDeviation,
weightedMean,
optimistic,
realistic,
pessimistic,
estimate,
clipboard;
ACTIVE_WM = 'active-wm';
ACTIVE_SD = 'active-sd';
STANDARD_DEVIATION = 'standard-deviation';
WEIGHTED_MEAN = 'weighted-mean';
currentStrategy = Pert.STANDARD_DEVIATION;
storage = chrome.storage.local;
getById = function(id) {
return document.getElementById(id);
};
getByClass = function(klass) {
return document.getElementsByClassName(klass);
};
setStrategy = function(e) {
var className = e.srcElement.className;
if (className.match(STANDARD_DEVIATION)) {
currentStrategy = Pert.STANDARD_DEVIATION;
} else if (className.match(WEIGHTED_MEAN)) {
currentStrategy = Pert.WEIGHTED_MEAN;
}
};
isValid = function(o, r, p) {
if (o === "" || r === "" || p === "") {
return false;
}
return (+o >= 0 && +r >= 0 +p >= 0);
};
execute = function() {
persist();
calculate();
};
calculate = function() {
var pert,
o = optimistic.value,
r = realistic.value,
p = pessimistic.value,
e;
if (isValid(o, r, p)) {
try {
pert = Pert.initialize(currentStrategy);
estimate.value = (pert.calculate(o, r, p)).toFixed(2);
} catch(e) {}
} else {
estimate.value = '';
}
};
persist = function() {
storage.set({
strategy : currentStrategy
});
};
restore = function() {
storage.get(null, function(object) {
if (object.strategy) {
currentStrategy = object.strategy;
activateStrategy(currentStrategy)();
}
});
};
copyToClipboard = function() {
estimate.select();
document.execCommand('copy');
};
activateStrategy = function(strategy) {
if (strategy === Pert.STANDARD_DEVIATION) {
return activateStandardDeviation;
} else if (strategy === Pert.WEIGHTED_MEAN) {
return activateWeightedMean;
}
};
activateStandardDeviation = function() {
addClassAttr(standardDeviation, ACTIVE_SD);
removeClassAttr(weightedMean, ACTIVE_WM);
};
activateWeightedMean = function() {
addClassAttr(weightedMean, ACTIVE_WM);
removeClassAttr(standardDeviation, ACTIVE_SD);
};
addClassAttr = function(el, classToAdd) {
if (!el.className.match(classToAdd)) {
el.className += ' ' + classToAdd;
}
};
removeClassAttr = function(el, classToRemove) {
var className = el.className.replace(classToRemove, '');
el.className = className;
};
strategyHandler = function(strategy) {
var fn = activateStrategy(strategy);
return function(e) {
setStrategy(e);
fn();
execute();
};
};
return {
initialize: function() {
standardDeviation = getByClass(STANDARD_DEVIATION)[0];
weightedMean = getByClass(WEIGHTED_MEAN)[0];
optimistic = getById('optimistic');
realistic = getById('realistic');
pessimistic = getById('pessimistic');
estimate = getById('estimate');
clipboard = getById('clipboard');
standardDeviation.addEventListener(
'click', strategyHandler(Pert.STANDARD_DEVIATION)
);
weightedMean.addEventListener(
'click', strategyHandler(Pert.WEIGHTED_MEAN)
);
optimistic.addEventListener('click', execute);
optimistic.addEventListener('keyup', execute);
optimistic.addEventListener('keydown', execute);
realistic.addEventListener('click', execute);
realistic.addEventListener('keyup', execute);
realistic.addEventListener('keydown', execute);
pessimistic.addEventListener('click', execute);
pessimistic.addEventListener('keyup', execute);
pessimistic.addEventListener('keydown', execute);
clipboard.addEventListener('click', copyToClipboard);
restore();
},
getCurrentStrategy : function() {
return currentStrategy;
},
setCurrentStrategy : function(value) {
currentStrategy = value;
},
execute : execute,
restore : restore
};
}());
}(window.Pert, window.chrome));
| {
"content_hash": "6b2c26475fe9f5abbb055e1d609f66f3",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 64,
"avg_line_length": 26.24867724867725,
"alnum_prop": 0.5764966740576497,
"repo_name": "sl4m/pertext",
"id": "7fb23452f7786198eb2fa2732607174415db8ebd",
"size": "4961",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/pertext.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "119886"
},
{
"name": "Ruby",
"bytes": "1713"
}
],
"symlink_target": ""
} |
package com.baeldung.spring.cloud.aws.sns;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.aws.messaging.core.NotificationMessagingTemplate;
import org.springframework.stereotype.Component;
@Component
public class SNSMessageSender {
@Autowired
NotificationMessagingTemplate notificationMessagingTemplate;
public void send(String topicName, Object message, String subject) {
notificationMessagingTemplate.sendNotification(topicName, message, subject);
}
}
| {
"content_hash": "4bdce6085e147dd4fb9f3ae5ce00a5f5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 84,
"avg_line_length": 33.1875,
"alnum_prop": 0.815442561205273,
"repo_name": "csc19601128/misc-examples",
"id": "58cb03644bce994032a720b148e9a05f11d1b549",
"size": "531",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "baeldung-tutorial/spring-cloud/spring-cloud-aws/src/main/java/com/baeldung/spring/cloud/aws/sns/SNSMessageSender.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "17973"
},
{
"name": "CSS",
"bytes": "137172"
},
{
"name": "Dockerfile",
"bytes": "4886"
},
{
"name": "Go",
"bytes": "8864"
},
{
"name": "Groovy",
"bytes": "745"
},
{
"name": "HCL",
"bytes": "470"
},
{
"name": "HTML",
"bytes": "27741"
},
{
"name": "Java",
"bytes": "965152"
},
{
"name": "JavaScript",
"bytes": "2304210"
},
{
"name": "Perl",
"bytes": "1432"
},
{
"name": "Python",
"bytes": "13020"
},
{
"name": "Rich Text Format",
"bytes": "810"
},
{
"name": "Roff",
"bytes": "2683772"
},
{
"name": "Ruby",
"bytes": "9372"
},
{
"name": "Scala",
"bytes": "276"
},
{
"name": "Shell",
"bytes": "96991"
},
{
"name": "TSQL",
"bytes": "15572"
},
{
"name": "TypeScript",
"bytes": "14500"
}
],
"symlink_target": ""
} |
package com.deepoove.poi.tl.render;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.NumberingRenderData;
import com.deepoove.poi.data.Numberings;
import com.deepoove.poi.data.Pictures;
import com.deepoove.poi.data.RowRenderData;
import com.deepoove.poi.data.Rows;
import com.deepoove.poi.data.TableRenderData;
import com.deepoove.poi.data.Tables;
import com.deepoove.poi.data.Texts;
@DisplayName("Foreach basic example")
public class IterableRenderBasicExample {
TableRenderData table;
NumberingRenderData numbering;
@BeforeEach
public void init() {
// create table
RowRenderData header = Rows.of("Word处理方案", "是否跨平台", "易用性").textColor("FFFFFF").bgColor("ff9800").center()
.rowHeight(2.5f).create();
RowRenderData row0 = Rows.of("Poi-tl", "纯Java组件,跨平台", "简单:模板引擎功能,并对POI进行了一些封装").create();
RowRenderData row1 = Rows.of("Apache Poi", "纯Java组件,跨平台", "简单,缺少一些功能的封装").create();
RowRenderData row2 = Rows.of("Freemarker", "XML操作,跨平台", "复杂,需要理解XML结构").create();
RowRenderData row3 = Rows.of("OpenOffice", "需要安装OpenOffice软件", "复杂,需要了解OpenOffice的API").create();
RowRenderData row4 = Rows.of("Jacob、winlib", "Windows平台", "复杂,不推荐使用").create();
table = Tables.of(header, row0, row1, row2, row3, row4).create();
// create numbering
numbering = Numberings.of("Plug-in grammar, add new grammar by yourself",
"Supports word text, local pictures, web pictures, table, list, header, footer...",
"Templates, not just templates, but also style templates").create();
}
@SuppressWarnings("serial")
@Test
public void testRenderIterable() throws Exception {
Map<String, Object> data = new HashMap<String, Object>();
data.put("header", "Deeply love what you love.");
data.put("name", "Poi-tl");
data.put("word", "模板引擎");
data.put("time", "2020-08-31");
data.put("what",
"Java Word模板引擎: Minimal Microsoft word(docx) templating with {{template}} in Java. It works by expanding tags in a template using values provided in a JavaMap or JavaObject.");
data.put("author", Texts.of("Sayi卅一").color("000000").create());
data.put("introduce", Texts.of("http://www.deepoove.com").link("http://www.deepoove.com").create());
data.put("portrait", Pictures.ofLocal("src/test/resources/sayi.png").size(60, 60).create());
data.put("solution_compare", table);
data.put("feature", numbering);
List<Map<String, Object>> mores = new ArrayList<Map<String, Object>>();
mores.add(data);
mores.add(data);
XWPFTemplate template = XWPFTemplate.compile("src/test/resources/template/iterable_basic.docx");
template.render(new HashMap<String, Object>() {
{
put("mores", mores);
}
}).writeToFile("target/out_iterable_basic.docx");
}
}
| {
"content_hash": "2b5fc784827a80f5e297aac6ea4fb043",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 192,
"avg_line_length": 42.45333333333333,
"alnum_prop": 0.6617462311557789,
"repo_name": "Sayi/poi-tl",
"id": "cf038cae320be7f33ff3a59586906bde73f0fd11",
"size": "3400",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "poi-tl/src/test/java/com/deepoove/poi/tl/render/IterableRenderBasicExample.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "646"
},
{
"name": "HTML",
"bytes": "651"
},
{
"name": "Java",
"bytes": "1247577"
}
],
"symlink_target": ""
} |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.synapse.models;
import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/** What is this?. */
@Fluent
public final class OperationMetaServiceSpecification {
/*
* Service metric specifications
*/
@JsonProperty(value = "metricSpecifications")
private List<OperationMetaMetricSpecification> metricSpecifications;
/*
* Service log specifications
*/
@JsonProperty(value = "logSpecifications")
private List<OperationMetaLogSpecification> logSpecifications;
/**
* Get the metricSpecifications property: Service metric specifications.
*
* @return the metricSpecifications value.
*/
public List<OperationMetaMetricSpecification> metricSpecifications() {
return this.metricSpecifications;
}
/**
* Set the metricSpecifications property: Service metric specifications.
*
* @param metricSpecifications the metricSpecifications value to set.
* @return the OperationMetaServiceSpecification object itself.
*/
public OperationMetaServiceSpecification withMetricSpecifications(
List<OperationMetaMetricSpecification> metricSpecifications) {
this.metricSpecifications = metricSpecifications;
return this;
}
/**
* Get the logSpecifications property: Service log specifications.
*
* @return the logSpecifications value.
*/
public List<OperationMetaLogSpecification> logSpecifications() {
return this.logSpecifications;
}
/**
* Set the logSpecifications property: Service log specifications.
*
* @param logSpecifications the logSpecifications value to set.
* @return the OperationMetaServiceSpecification object itself.
*/
public OperationMetaServiceSpecification withLogSpecifications(
List<OperationMetaLogSpecification> logSpecifications) {
this.logSpecifications = logSpecifications;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (metricSpecifications() != null) {
metricSpecifications().forEach(e -> e.validate());
}
if (logSpecifications() != null) {
logSpecifications().forEach(e -> e.validate());
}
}
}
| {
"content_hash": "1573e32ed33551d41012ab2106053041",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 76,
"avg_line_length": 31.962962962962962,
"alnum_prop": 0.697566628041715,
"repo_name": "Azure/azure-sdk-for-java",
"id": "62d7c7bfa5cea2327019cbd9bb2984e00c0ed9fa",
"size": "2589",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/models/OperationMetaServiceSpecification.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8762"
},
{
"name": "Bicep",
"bytes": "15055"
},
{
"name": "CSS",
"bytes": "7676"
},
{
"name": "Dockerfile",
"bytes": "2028"
},
{
"name": "Groovy",
"bytes": "3237482"
},
{
"name": "HTML",
"bytes": "42090"
},
{
"name": "Java",
"bytes": "432409546"
},
{
"name": "JavaScript",
"bytes": "36557"
},
{
"name": "Jupyter Notebook",
"bytes": "95868"
},
{
"name": "PowerShell",
"bytes": "737517"
},
{
"name": "Python",
"bytes": "240542"
},
{
"name": "Scala",
"bytes": "1143898"
},
{
"name": "Shell",
"bytes": "18488"
},
{
"name": "XSLT",
"bytes": "755"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<sem:triples uri="http://www.lds.org/vrl/people/religious-affiliation/general-authorities-wives" xmlns:sem="http://marklogic.com/semantics">
<sem:triple>
<sem:subject>http://www.lds.org/vrl/people/religious-affiliation/general-authorities-wives</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#prefLabel</sem:predicate>
<sem:object datatype="xsd:string" xml:lang="eng">General Authorities' Wives</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/vrl/people/religious-affiliation/general-authorities-wives</sem:subject>
<sem:predicate>http://www.w3.org/2004/02/skos/core#inScheme</sem:predicate>
<sem:object datatype="sem:iri">http://www.lds.org/concept-scheme/vrl</sem:object>
</sem:triple>
<sem:triple>
<sem:subject>http://www.lds.org/vrl/people/religious-affiliation/general-authorities-wives</sem:subject>
<sem:predicate>http://www.lds.org/core#entityType</sem:predicate>
<sem:object datatype="sem:iri">http://www.schema.org/Place</sem:object>
</sem:triple>
</sem:triples>
| {
"content_hash": "4de99a3ec92256363fe1147f0ebf351e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 140,
"avg_line_length": 61.166666666666664,
"alnum_prop": 0.7302452316076294,
"repo_name": "freshie/ml-taxonomies",
"id": "da5107cf7be4979cc155f258fea9a00006528a1f",
"size": "1101",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "roxy/data/gospel-topical-explorer-v2/taxonomies/vrl/people/religious-affiliation/general-authorities-wives.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4422"
},
{
"name": "CSS",
"bytes": "38665"
},
{
"name": "HTML",
"bytes": "356"
},
{
"name": "JavaScript",
"bytes": "411651"
},
{
"name": "Ruby",
"bytes": "259121"
},
{
"name": "Shell",
"bytes": "7329"
},
{
"name": "XQuery",
"bytes": "857170"
},
{
"name": "XSLT",
"bytes": "13753"
}
],
"symlink_target": ""
} |
exports.Recorder = require('./lib/recorder').Recorder;
var Answer = exports.Answer = require('./lib/answer').Answer;
| {
"content_hash": "e39c4b0c18e3498120d56b36ef9e3dab",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 61,
"avg_line_length": 58.5,
"alnum_prop": 0.7264957264957265,
"repo_name": "letsface/socket-io-faker",
"id": "425410d1945b9792ac231c9dfa0e3c62d3ec2797",
"size": "117",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "7995"
}
],
"symlink_target": ""
} |
<!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="Content-Type" content="text/html; charset=UTF-8" />
<title>Smart Buttons for GitHub</title>
<link href="styles/smart_buttons.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/jquery.smartButtons.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Smart Buttons
$('#sbuttons').smartButtons({user: 'techlab',repo:'SmartCart',size:'small'});
$('#sbuttons2').smartButtons({user: 'techlab',repo:'SmartTab',size:'medium'});
$('#sbuttons3').smartButtons({user: 'techlab',repo:'SmartWizard',size:'large',
forkButton: {'show':true, 'count':true, 'text':'Fork'},
starButton: {'show':true, 'count':true, 'text':'Star'},
followButton: {'show':true, 'count':true, 'text':'Follow'}
});
});
</script>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0">
<tr><td>
<!-- Smart Buttons -->
<h2>Small size</h2>
<div id="sbuttons"></div>
<br /><br />
<h2>Medium size</h2>
<div id="sbuttons2"></div>
<br /><br />
<h2>Large size</h2>
<div id="sbuttons3"></div>
</td></tr>
</table>
</body>
</html> | {
"content_hash": "1b3b292b837480f74e2758bdbf05e4ac",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 121,
"avg_line_length": 40.166666666666664,
"alnum_prop": 0.5240071132187315,
"repo_name": "techlab/SmartButtons",
"id": "d179e5107d6bd4e80b587c51017713a057559286",
"size": "1687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4788"
},
{
"name": "HTML",
"bytes": "1687"
},
{
"name": "JavaScript",
"bytes": "9703"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "e648eb277108302352bde37dc7a144ec",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "57c74da5652451b8c8f56365f10dcd12bf119746",
"size": "181",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Bromus/Bromus arvensis/ Syn. Serrafalcus duvalii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package jk.cloud.app.presenter;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import org.json.JSONObject;
import java.util.HashMap;
import jk.cloud.app.model.domain.Login;
import jk.cloud.app.model.http.OkHttpManager;
import jk.cloud.app.model.http.URLProviderUtil;
import jk.cloud.app.model.http.callback.StringCallBack;
import okhttp3.Call;
import okhttp3.FormBody;
import okhttp3.RequestBody;
/**
* 登陆
* Created by liuyongfeng on 2017/5/22.
*/
public class LoginPresenter implements LoginContract.Presenter {
private LoginContract.View mView;
public LoginPresenter(LoginContract.View view) {
this.mView = view;
mView.setPresenter(this);
}
@Override
public void getData(HashMap<String, String> hashMap) {
FormBody.Builder builder = new FormBody.Builder();
for (String key : hashMap.keySet()) {
builder.add(key, hashMap.get(key));
}
RequestBody requestBody = builder.build();
OkHttpManager.getOkHttpManager().asyncPost(URLProviderUtil.URL_LOGIN,
requestBody, new StringCallBack() {
@Override
public void onError(Call call, Exception e) {
mView.setError(e.getLocalizedMessage());
}
@Override
public void onResponse(String response) {
//创建一个jsonParser
JsonParser parser = new JsonParser();
//通过jsonParser可以将json格式的字符串解析成一个jsonElement对象
JsonElement jsonElement;
try {
JSONObject jsonObject = new JSONObject(response);
boolean IsSuccess = jsonObject.optBoolean("Success");
if (IsSuccess) {
String data = jsonObject.optString("Data");
jsonElement = parser.parse(data);
Login login = new Gson().fromJson(jsonElement, Login.class);
mView.setData(login);
} else {
String Msg = jsonObject.optString("Message");
mView.setError(Msg);
}
} catch (Exception e) {
e.printStackTrace();
mView.setError(e.getLocalizedMessage());
}
}
});
}
}
| {
"content_hash": "ba748cf143540a542d74fcd5a62fb3e9",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 92,
"avg_line_length": 36.31944444444444,
"alnum_prop": 0.5326959847036329,
"repo_name": "liuyongfeng90/JKCloud",
"id": "d4d55b8eb9213f41001d5dc8520360b020c8d367",
"size": "2663",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/jk/cloud/app/presenter/LoginPresenter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "485843"
}
],
"symlink_target": ""
} |
package main
import "fmt"
func init() {
fmt.Print("Content-Type: text/plain;charset=utf-8\n\n");
}
func main() {
fmt.Println("hello!!!!")
}
| {
"content_hash": "6ea04722c5b2cc417e7e7d3e07d66a27",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 57,
"avg_line_length": 13.181818181818182,
"alnum_prop": 0.6344827586206897,
"repo_name": "wiloon/golang-x",
"id": "8e4a2e14803d38472625dd18e8c37e56dcda72e9",
"size": "145",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "network/httpx/cgi/cgi_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "89888"
},
{
"name": "Groovy",
"bytes": "291"
}
],
"symlink_target": ""
} |
<jqxGrid #myGrid
[width]="850" [source]="dataAdapter" [columns]="columns"
[filterable]="true" [selectionmode]="'multiplecellsextended'" [showfilterrow]="true">
</jqxGrid>
<br />
<jqxButton (onClick)="clearFiltering()"
[width]="120" [height]="30">
Remove Filter
</jqxButton> | {
"content_hash": "683e17da3dfbaa1338b0756740626007",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 89,
"avg_line_length": 26.545454545454547,
"alnum_prop": 0.660958904109589,
"repo_name": "juannelisalde/holter",
"id": "eb972df85439ff6f60861252269662bbefdf677a",
"size": "294",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "assets/jqwidgets/demos/angular/app/grid/filterrow/app.component.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "1327"
},
{
"name": "Batchfile",
"bytes": "802"
},
{
"name": "C#",
"bytes": "374733"
},
{
"name": "CSS",
"bytes": "882785"
},
{
"name": "HTML",
"bytes": "18898187"
},
{
"name": "Java",
"bytes": "12788"
},
{
"name": "JavaScript",
"bytes": "9712220"
},
{
"name": "PHP",
"bytes": "2051144"
},
{
"name": "TypeScript",
"bytes": "3437214"
}
],
"symlink_target": ""
} |
#ifndef DOMTokenList_h
#define DOMTokenList_h
#include "bindings/core/v8/Iterable.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/dom/SpaceSplitString.h"
#include "platform/heap/Handle.h"
#include "wtf/Vector.h"
#include "wtf/text/AtomicString.h"
namespace blink {
class Element;
class ExceptionState;
class CORE_EXPORT DOMTokenListObserver : public WillBeGarbageCollectedMixin {
public:
// Called when the value property is set, even if the tokens in
// the set have not changed.
virtual void valueWasSet() = 0;
DEFINE_INLINE_VIRTUAL_TRACE() { }
};
class CORE_EXPORT DOMTokenList : public RefCountedWillBeGarbageCollectedFinalized<DOMTokenList>,
public ScriptWrappable, public ValueIterable<String> {
DEFINE_WRAPPERTYPEINFO();
USING_FAST_MALLOC_WILL_BE_REMOVED(DOMTokenList);
WTF_MAKE_NONCOPYABLE(DOMTokenList);
public:
static PassRefPtrWillBeRawPtr<DOMTokenList> create(DOMTokenListObserver* observer = nullptr)
{
return adoptRefWillBeNoop(new DOMTokenList(observer));
}
virtual ~DOMTokenList() { }
#if !ENABLE(OILPAN)
virtual void ref() { RefCounted<DOMTokenList>::ref(); }
virtual void deref() { RefCounted<DOMTokenList>::deref(); }
#endif
virtual unsigned length() const { return m_tokens.size(); }
virtual const AtomicString item(unsigned index) const;
bool contains(const AtomicString&, ExceptionState&) const;
virtual void add(const Vector<String>&, ExceptionState&);
void add(const AtomicString&, ExceptionState&);
virtual void remove(const Vector<String>&, ExceptionState&);
void remove(const AtomicString&, ExceptionState&);
bool toggle(const AtomicString&, ExceptionState&);
bool toggle(const AtomicString&, bool force, ExceptionState&);
bool supports(const AtomicString&, ExceptionState&);
virtual const AtomicString& value() const { return m_value; }
virtual void setValue(const AtomicString&);
const SpaceSplitString& tokens() const { return m_tokens; }
void setObserver(DOMTokenListObserver* observer) { m_observer = observer; }
const AtomicString& toString() const { return value(); }
virtual Element* element() { return 0; }
DEFINE_INLINE_VIRTUAL_TRACE() {
visitor->trace(m_observer);
}
protected:
DOMTokenList(DOMTokenListObserver* observer)
: m_observer(observer)
{
}
virtual void addInternal(const AtomicString&);
virtual bool containsInternal(const AtomicString&) const;
virtual void removeInternal(const AtomicString&);
bool validateToken(const String&, ExceptionState&) const;
bool validateTokens(const Vector<String>&, ExceptionState&) const;
virtual bool validateTokenValue(const AtomicString&, ExceptionState&) const;
static AtomicString addToken(const AtomicString&, const AtomicString&);
static AtomicString addTokens(const AtomicString&, const Vector<String>&);
static AtomicString removeToken(const AtomicString&, const AtomicString&);
static AtomicString removeTokens(const AtomicString&, const Vector<String>&);
private:
IterationSource* startIteration(ScriptState*, ExceptionState&) override;
SpaceSplitString m_tokens;
AtomicString m_value;
RawPtrWillBeWeakMember<DOMTokenListObserver> m_observer;
};
} // namespace blink
#endif // DOMTokenList_h
| {
"content_hash": "7430ddcbc8b61b56afaf6798170b018a",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 96,
"avg_line_length": 34.09183673469388,
"alnum_prop": 0.737503741394792,
"repo_name": "ds-hwang/chromium-crosswalk",
"id": "e93e20c43d3e5e9b82d1ff641aafc39cd483684d",
"size": "4698",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "third_party/WebKit/Source/core/dom/DOMTokenList.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>W30775_text</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div style="margin-left: auto; margin-right: auto; width: 800px; overflow: hidden;">
<div style="float: left;">
<a href="page2.html">«</a>
</div>
<div style="float: right;">
</div>
</div>
<hr/>
<div style="position: absolute; margin-left: 1072px; margin-top: 1210px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Field: County: State: </p>
</div>
<div style="position: absolute; margin-left: 880px; margin-top: 1539px;">
<p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Date: <br/>Well Location: UWl/API Number: Proposal Number: <br/>Contact: Made Bv: </p>
</div>
<div style="position: absolute; margin-left: 824px; margin-top: 1980px;">
<p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Service from District: </p>
</div>
<div style="position: absolute; margin-left: 1256px; margin-top: 2007px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Williston, ND </p>
</div>
<div style="position: absolute; margin-left: 1017px; margin-top: 2090px;">
<p class="styleSans9.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Objective: </p>
</div>
<div style="position: absolute; margin-left: 1260px; margin-top: 2090px;">
<p class="styleSans10.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">30 stage plug and perf with YF128FIexD, 20/40 white sand, and18/40 VersaProp. Final additives based on the lab testing using location water. 15% HCL will be pumped as needed. </p>
</div>
<div style="position: absolute; margin-left: 1622px; margin-top: 2860px;">
<p class="styleSans29.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Sclllumlleruer </p>
</div>
<div style="position: absolute; margin-left: 247px; margin-top: 302px;">
<p class="styleSans145.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">Propped Frac Treatment <br/>Company: WHITING OIL 81 GAS CORPORATION Well Name: <br/> </p>
</div>
<div style="position: absolute; margin-left: 1567px; margin-top: 1430px;">
<p class="styleSans15.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">EXAMPLE </p>
</div>
<div style="position: absolute; margin-left: 1567px; margin-top: 1595px;">
<p class="styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">EXAMPLE </p>
</div>
<div style="position: absolute; margin-left: 1567px; margin-top: 1760px;">
<p class="styleSans16.0000<enum PANGO_WEIGHT_NORMAL of type PangoWeight><enum PANGO_STYLE_NORMAL of type PangoStyle>">EXAMPLE </p>
</div>
</body>
</html>
| {
"content_hash": "1779aecfa03fb635b915c087131ad273",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 301,
"avg_line_length": 52.55555555555556,
"alnum_prop": 0.6949562065841136,
"repo_name": "datamade/elpc_bakken",
"id": "c013e6126320ee7cf6cb533d7c7340a22e5e9e29",
"size": "3312",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ocr_extracted/W30775_text/page3.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "17512999"
},
{
"name": "HTML",
"bytes": "421900941"
},
{
"name": "Makefile",
"bytes": "991"
},
{
"name": "Python",
"bytes": "7186"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding='UTF-8'?>
<resources>
<string name="donations__button_close">Chiudi</string>
<string name="donations__flattr">Flattr</string>
<string name="donations__description">Pensi che questa applicazione sia utile?\nSupporta il suo sviluppo mandando una donazione allo sviluppatore!</string>
<string name="donations__flattr_description">Flattr riceve il 10% come canone mensile!</string>
<string name="donations__google_android_market">Google Play Store</string>
<string name="donations__google_android_market_not_supported_title">Le donazioni in-app non sono supportate.</string>
<string name="donations__google_android_market_not_supported">Donazioni In-App non supportate. Google Play Store è installato correttamente?</string>
<string name="donations__google_android_market_description">Google riceve il 30% di ogni donazione!</string>
<string name="donations__google_android_market_donate_button">Dona!</string>
<string name="donations__google_android_market_text">Quanto?</string>
<string name="donations__paypal">PayPal</string>
<string name="donations__paypal_description">Puoi scegliere quanto donare dopo aver premuto il pulsante!</string>
<string name="donations__thanks_dialog_title">Grazie!</string>
<string name="donations__thanks_dialog">Grazie per la donazione!\nLo apprezzo molto!</string>
<string name="donations__alert_dialog_title">Si è verificato un errore</string>
<string name="donations__alert_dialog_no_browser">Non è stato trovato un browser per aprire un sito internet!</string>
</resources>
| {
"content_hash": "ce26aee48bc86b4d11ac4431d126e752",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 157,
"avg_line_length": 82.63157894736842,
"alnum_prop": 0.7668789808917198,
"repo_name": "kzganesan/donations",
"id": "a7c141fa7f128da917b20321387352e1b391a51e",
"size": "1573",
"binary": false,
"copies": "11",
"ref": "refs/heads/master",
"path": "Donations/src/main/res/values-it/donations__strings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "115001"
}
],
"symlink_target": ""
} |
My Personal Website built with Node.js
View the website here (Note Heroku takes a minute to start up): https://develonaut.herokuapp.com/
| {
"content_hash": "86f514255a5bc44e37e720e757770ebe",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 97,
"avg_line_length": 46,
"alnum_prop": 0.782608695652174,
"repo_name": "Develonaut/Develonaut",
"id": "ca680eb9e492cb91044ae39ce5c7947e42372bd3",
"size": "151",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "8372"
},
{
"name": "HTML",
"bytes": "3704"
},
{
"name": "JavaScript",
"bytes": "10841"
}
],
"symlink_target": ""
} |
1. [](#improved)
* Support for multiple forms and fields in the same page
1. [](#bugfix)
* Fix typo in `SEARCH_FIELD_MINIUMUM_CHARACTERS` translation string
* Fixed validation and JS submission
* Separated JS from inline to file
* Fixed issue with min query length always enforced. It is now possible to have no minimum length by setting to `false` or `0`
# v1.12.0
## 05/31/2017
1. [](#new)
* Added option to switch between Rendered HTML and Raw Markdown content searching. Raw Markdown is faster than default.
# v1.11.0
## 05/29/2017
1. [](#new)
* Allow to use "@none"/"none@" in the "Category filter" in Admin to allow removing the filter
# v1.10.2
## 04/19/2017
1. [](#bugfix)
* Only check ACL if the Login plugin is installed [#112](https://github.com/getgrav/grav-plugin-simplesearch/pull/112)
# v1.10.1
## 04/11/2017
1. [](#new)
* Added Portuguese translation
* Add hint when the minimum search field length is not matched
1. [](#bugfix)
* Default `ignore_accented_characters` to false
* Fallback to regular search if searching with `ignore_accented_characters` on an unsupported charset raises an exception [#107](https://github.com/getgrav/grav-plugin-simplesearch/issues/107)
* Check ACL before listing a page in the search results [#102](https://github.com/getgrav/grav-plugin-simplesearch/pull/102)
* Fix with ignoring `min_query_length` when using the button [#99](https://github.com/getgrav/grav-plugin-simplesearch/issues/99)
# v1.10.0
## 01/23/2017
1. [](#new)
* Added spanish translation
* Added japanese translation
* Added persian translation
1. [](#improved)
* Added option to switch between Rendered HTML and Raw Markdown content searching. Raw Markdown is faster than default.
* Removed jQuery dependency, fixes issue when jQuery is loaded in the footer [#57](https://github.com/getgrav/grav-plugin-simplesearch/pull/57)
* Added option to ignore accents when searching [#89](https://github.com/getgrav/grav-plugin-simplesearch/pull/89)
1. [](#bugfix)
* Remove unpublished and un-routable pages from the result set
* Fixed issue when using @self as route
* Fix overloaded property issue when searching on a page with simplesearch header [#80](https://github.com/getgrav/grav-plugin-simplesearch/issues/80)
* Fix issue with empty string and leading commas [#71](https://github.com/getgrav/grav-plugin-simplesearch/issues/71)
# v1.9.3
## 10/19/2016
1. [](#bugfix)
* Fixed an issue with invalid syntax in `route: @self` logic
# v1.9.2
## 09/19/2016
1. [](#bugfix)
* Reverted change in events - causing problems
* Reverted fix for `route: @self`, breaking `filter: @self` (used in getgrav.org)
# v1.9.1
## 09/08/2016
1. [](#bugfix)
* Fixed logic to use `onPageInitialized` event
# v1.9.0
## 09/06/2016
1. [](#new)
* Multiple search boxes support [#52](https://github.com/getgrav/grav-plugin-simplesearch/pull/52)
* Added Croatian and Russian translation
1. [](#improved)
* Added support for Grav's autoescape twig setting
1. [](#bugfix)
* Fix searching on `@self
`[#53](https://github.com/getgrav/grav-plugin-simplesearch/pull/53)
# v1.8.0
## 07/14/2016
1. [](#new)
* Added dutch and romanian
1. [](#bugfix)
* Fix translating the search input placeholder
# v1.7.1
## 05/03/2016
1. [](#new)
* Added configurable `min length` option for how many characters needed before you can search
# v1.7.0
## 04/30/2016
1. [](#new)
* Added support for taxonomy searching in regular searches (not just on-page searches as was the case previously)
* Added support for `route: '@self'` to use the route of the current page without specifying it.
* Added display search button option - #33
* Refactored code for clarity
# v1.6.2
## 01/06/2016
1. [](#improved)
* Improved the README instructions on how to save all pages
# v1.6.1
## 11/11/2015
1. [](#improved)
* Strip HTML tags from title and content before searching
# v1.6.0
## 11/11/2015
1. [](#new)
* Removing `filter:` from configuration will search **ALL** pages
# v1.5.1
## 10/15/2015
1. [](#improved)
* Minor performance fix
* Updated README.md with more help
1. [](#bugfix)
* Fix for special character searches
# v1.5.0
## 10/07/2015
1. [](#new)
* Allow simplesearch to work with on-page collections
# v1.4.1
## 08/31/2015
1. [](#improved)
* Fixed some blueprint issues
# v1.4.0
## 08/25/2015
1. [](#improved)
* Added blueprints for Grav Admin plugin
* Added results sorting
# v1.3.0
## 07/21/2015
1. [](#new)
* Added support for modular pages in results
# v1.2.7
## 07/17/2015
1. [](#bugfix)
* Fixed "Undefined index: extension" error
# v1.2.6
## 07/14/2015
1. [](#bugfix)
* Fixed URL issue that showed up with multi-languages
# v1.2.5
## 04/24/2015
1. [](#bugfix)
* Fixed issue with broken image
# v1.2.4
## 02/19/2015
2. [](#improved)
* Implemented new `param_sep` variable from Grav 0.9.18
# v1.2.3
## 01/06/2015
1. [](#improved)
* Improved `README.md` file with more information
# v1.2.2
## 12/21/2014
1. [](#bugfix)
* Fix for invalid base_url in some instances
# v1.2.1
## 11/30/2014
1. [](#new)
* ChangeLog started...
| {
"content_hash": "d8ac9c497789d9d1dc61f3ed4bfc1832",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 196,
"avg_line_length": 26.07920792079208,
"alnum_prop": 0.6778663629460896,
"repo_name": "nicholasnbg/nbgdev",
"id": "434f2ffba0a30dd48c32864d297d414e46d9f595",
"size": "5295",
"binary": false,
"copies": "14",
"ref": "refs/heads/master",
"path": "user/plugins/simplesearch/CHANGELOG.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "550842"
},
{
"name": "HTML",
"bytes": "286322"
},
{
"name": "JavaScript",
"bytes": "243732"
},
{
"name": "Logos",
"bytes": "831"
},
{
"name": "PHP",
"bytes": "1326397"
},
{
"name": "Shell",
"bytes": "596"
},
{
"name": "XSLT",
"bytes": "827"
}
],
"symlink_target": ""
} |
add_executable(ot-cli
main.c
cli_readline.cpp
cli_stdio.cpp
)
target_include_directories(ot-cli PRIVATE ${COMMON_INCLUDES})
if (READLINE)
target_compile_definitions(ot-cli PRIVATE
$<$<BOOL:${READLINE}>:HAVE_LIB$<UPPER_CASE:${OT_READLINE}>=1>)
endif()
target_compile_options(ot-cli PRIVATE
${OT_CFLAGS}
)
target_link_libraries(ot-cli
openthread-cli-ftd
openthread-posix
openthread-ftd
openthread-posix
openthread-cli-ftd
openthread-hdlc
openthread-spinel-rcp
${OT_MBEDTLS}
${READLINE_LINK_LIBRARIES}
ot-config-ftd
ot-config
)
install(TARGETS ot-cli DESTINATION bin)
| {
"content_hash": "1989397cdeadce1f93330976247fce69",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 66,
"avg_line_length": 18.705882352941178,
"alnum_prop": 0.6949685534591195,
"repo_name": "jwhui/openthread",
"id": "4354374d2db75192700ebe910230f4c15b9fecf5",
"size": "2218",
"binary": false,
"copies": "4",
"ref": "refs/heads/main",
"path": "src/posix/cli.cmake",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "2610"
},
{
"name": "C",
"bytes": "1589998"
},
{
"name": "C++",
"bytes": "8359457"
},
{
"name": "CMake",
"bytes": "109816"
},
{
"name": "Dockerfile",
"bytes": "10410"
},
{
"name": "M4",
"bytes": "32369"
},
{
"name": "Makefile",
"bytes": "192208"
},
{
"name": "Python",
"bytes": "4622817"
},
{
"name": "Shell",
"bytes": "165383"
}
],
"symlink_target": ""
} |
'use strict';
describe('Controller: AuthenticationCtrl', function () {
// load the controller's module
beforeEach(module('promomemxApp'));
var AuthenticationCtrl,
scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
AuthenticationCtrl = $controller('AuthenticationCtrl', {
$scope: scope
});
}));
it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
| {
"content_hash": "30ebfae2b9cfc620208d2b93aca9df77",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 24.90909090909091,
"alnum_prop": 0.6751824817518248,
"repo_name": "epool/promome.mx",
"id": "3404be224e9c18f85a93472372556cc5688b71a3",
"size": "548",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/spec/controllers/authentication.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2483"
},
{
"name": "JavaScript",
"bytes": "31629"
}
],
"symlink_target": ""
} |
// *****************************************************************************
//
// © Component Factory Pty Ltd 2012. All rights reserved.
// The software and associated documentation supplied hereunder are the
// proprietary information of Component Factory Pty Ltd, 17/267 Nepean Hwy,
// Seaford, Vic 3198, Australia and are supplied subject to licence terms.
//
// Version 4.4.1.0 www.ComponentFactory.com
// *****************************************************************************
using System;
using System.Text;
using System.Drawing;
using System.Drawing.Text;
using System.ComponentModel;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Diagnostics;
namespace ComponentFactory.Krypton.Toolkit
{
/// <summary>
/// Implement storage for palette border,background and separator padding.
/// </summary>
public class PaletteSeparatorPaddingRedirect : PaletteDoubleMetricRedirect
{
#region Instance Fields
private PaletteRedirect _redirect;
private Padding _separatorPadding;
#endregion
#region Identity
/// <summary>
/// Initialize a new instance of the PaletteSeparatorPaddingRedirect class.
/// </summary>
/// <param name="redirect">Inheritence redirection instance.</param>
/// <param name="backStyle">Initial background style.</param>
/// <param name="borderStyle">Initial border style.</param>
/// <param name="needPaint">Delegate for notifying paint requests.</param>
public PaletteSeparatorPaddingRedirect(PaletteRedirect redirect,
PaletteBackStyle backStyle,
PaletteBorderStyle borderStyle,
NeedPaintHandler needPaint)
: base(redirect, backStyle, borderStyle, needPaint)
{
Debug.Assert(redirect != null);
// Remember the redirect reference
_redirect = redirect;
// Set default value for padding property
_separatorPadding = CommonHelper.InheritPadding;
}
#endregion
#region IsDefault
/// <summary>
/// Gets a value indicating if all values are default.
/// </summary>
[Browsable(false)]
public override bool IsDefault
{
get
{
return (base.IsDefault &&
Padding.Equals(CommonHelper.InheritPadding));
}
}
#endregion
#region Padding
/// <summary>
/// Gets the padding used to position the separator.
/// </summary>
[KryptonPersist(false)]
[Category("Visuals")]
[Description("Padding used to position the separator.")]
[DefaultValue(typeof(Padding), "-1,-1,-1,-1")]
[RefreshPropertiesAttribute(RefreshProperties.All)]
public Padding Padding
{
get { return _separatorPadding; }
set
{
if (_separatorPadding != value)
{
_separatorPadding = value;
PerformNeedPaint(true);
}
}
}
/// <summary>
/// Reset the Padding to the default value.
/// </summary>
public void ResetPadding()
{
Padding = CommonHelper.InheritPadding;
}
#endregion
#region IPaletteMetric
/// <summary>
/// Gets an integer metric value.
/// </summary>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <param name="metric">Requested metric.</param>
/// <returns>Integer value.</returns>
public override int GetMetricInt(PaletteState state, PaletteMetricInt metric)
{
// Pass onto the inheritance
return _redirect.GetMetricInt(state, metric);
}
/// <summary>
/// Gets a boolean metric value.
/// </summary>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <param name="metric">Requested metric.</param>
/// <returns>InheritBool value.</returns>
public override InheritBool GetMetricBool(PaletteState state, PaletteMetricBool metric)
{
// Pass onto the inheritance
return _redirect.GetMetricBool(state, metric);
}
/// <summary>
/// Gets a padding metric value.
/// </summary>
/// <param name="state">Palette value should be applicable to this state.</param>
/// <param name="metric">Requested metric.</param>
/// <returns>Padding value.</returns>
public override Padding GetMetricPadding(PaletteState state, PaletteMetricPadding metric)
{
// Is this the metric we provide?
if ((metric == PaletteMetricPadding.SeparatorPaddingLowProfile) ||
(metric == PaletteMetricPadding.SeparatorPaddingHighProfile) ||
(metric == PaletteMetricPadding.SeparatorPaddingHighInternalProfile) ||
(metric == PaletteMetricPadding.SeparatorPaddingCustom1))
{
// If the user has defined an actual value to use
if (!Padding.Equals(CommonHelper.InheritPadding))
return Padding;
}
// Pass onto the inheritance
return _redirect.GetMetricPadding(state, metric);
}
#endregion
}
}
| {
"content_hash": "42a2e8f347e51963994c2898bb3d4d0f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 97,
"avg_line_length": 34.28104575163399,
"alnum_prop": 0.6062917063870352,
"repo_name": "Cocotteseb/Krypton",
"id": "95147475943f2f597b6abc46ecfc7cd38678f6c9",
"size": "5248",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Krypton Components/ComponentFactory.Krypton.Toolkit/Palette Controls/PaletteSeparatorPaddingRedirect.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "20059021"
}
],
"symlink_target": ""
} |
import * as path from "path";
import * as fs from "fs";
import * as program from "commander";
import { ILogService, LogService } from "./logService";
export interface IFileService {
saveFile(destination: string, content: string): void;
fileExists(fileName: string): boolean;
getManifestFile(filePath: string): string;
getFileExtension(directory: string): string;
removeFile(filePath: string): void;
readFile(filePath: string): string;
getStyleFormat(extension: string): string;
addFileToManifest(fileName: string, manifestFile: string, sort: boolean): void;
removeFileFromManifest(fileName: string, manifestFile: string): void;
getImportExtension(extension: string): string;
}
export class FileService implements IFileService {
_logger: ILogService = new LogService();
saveFile(destination: string, content: string): void {
try {
destination = destination.replace('//', '/');
fs.writeFileSync(destination, content);
this._logger.success(`Saved file: ${destination}`);
} catch (error) {
this._logger.error(`There was an error saving this file: ${destination} \n${error}`);
}
}
fileExists(fileName: string): boolean {
try {
return fs.statSync(fileName).isFile();
} catch (err) {
return false;
}
}
getManifestFile(filePath: string): string {
if (!filePath) return undefined;
let manifestFile;
fs.readdirSync(filePath).forEach(file => {
if (file.startsWith('index') || file.startsWith('style'))
manifestFile = file;
});
return manifestFile;
}
getFileExtension(directory: string): string {
switch (true) {
case program.sass:
return '.sass';
case program.scss:
return '.scss';
case program.less:
return '.less';
default:
return this.getManifestExtension(directory);
}
}
getManifestExtension(directory: string): string {
let manifest = this.getManifestFile(directory);
return manifest ? path.extname(manifest).replace('.', '') : 'scss';
}
addFileToManifest(fileName: string, manifestFile: string, sort: boolean): void {
if(sort) {
var data = fs.readFileSync(manifestFile, 'utf8');
let importStatements = data.split('\n').filter(String);
importStatements.push(fileName);
importStatements.sort();
this.saveFile(manifestFile, importStatements.join('\n'));
} else {
fs.appendFileSync(manifestFile, `@import '${fileName}';\n`);
}
this._logger.success(`Saved file: ${fileName} was added to the manifest.`);
}
removeFileFromManifest(fileName: string, manifestFile: string): void {
let importStatements = this.readFile(manifestFile).split('\n');
let fileIndex = importStatements.indexOf(`@import '${fileName}';`);
if (fileIndex < 0) {
this._logger.warning('File to be removed was not found in your manifest.');
} else {
importStatements.splice(fileIndex, 1);
let formattedImportStatements = importStatements.join('\n');
this.saveFile(manifestFile, formattedImportStatements);
}
}
removeFile(filePath: string): void {
try {
if (this.fileExists(filePath)) {
fs.unlinkSync(filePath);
this._logger.success(`File removed: ${filePath}`);
} else {
this._logger.warning(filePath + ' was not found');
}
} catch (error) {
this._logger.error(`There was an error removing this file: ${filePath} \n${error}`);
}
}
readFile(filePath: string): string {
return this.fileExists(filePath) ? fs.readFileSync(filePath).toString() : '';
}
getStyleFormat(extension: string): string {
return extension.replace('.', '') === 'less' ? 'less' : 'sass';
}
getImportExtension(extension: string): string {
return `${extension !== 'sass' && extension !== 'scss' ? '.' + extension : ''}${extension === 'sass' ? '\'' : '\';'}`;
}
} | {
"content_hash": "f1b98b215b77790a44e3646c727c0f20",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 126,
"avg_line_length": 35.04838709677419,
"alnum_prop": 0.5855959502991256,
"repo_name": "break-stuff/clarion",
"id": "a1824c20c6c14f105fff97129715e277a38a31f7",
"size": "4346",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/services/fileService.ts",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "97857"
},
{
"name": "TypeScript",
"bytes": "99958"
}
],
"symlink_target": ""
} |
/*-------------------------------------------------------------------------
Copyright 2011 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkOrderStatistics - A class for univariate order statistics
//
// .SECTION Description
// Given a selection of columns of interest in an input data table, this
// class provides the following functionalities, depending on the
// execution mode it is executed in:
// * Learn: calculate histogram.
// * Derive: calculate PDFs and arbitrary quantiles. Provide specific names when 5-point
// statistics (minimum, 1st quartile, median, third quartile, maximum) requested.
// * Assess: given an input data set and a set of q-quantiles, label each datum
// either with the quantile interval to which it belongs, or 0 if it is smaller
// than smaller quantile, or q if it is larger than largest quantile.
// * Test: calculate Kolmogorov-Smirnov goodness-of-fit statistic between CDF based on
// model quantiles, and empirical CDF
//
// .SECTION Thanks
// Thanks to Philippe Pebay and David Thompson from Sandia National Laboratories
// for implementing this class.
// Updated by Philippe Pebay, Kitware SAS 2012
#ifndef vtkOrderStatistics_h
#define vtkOrderStatistics_h
#include "vtkFiltersStatisticsModule.h" // For export macro
#include "vtkStatisticsAlgorithm.h"
class vtkMultiBlockDataSet;
class vtkStringArray;
class vtkTable;
class vtkVariant;
class VTKFILTERSSTATISTICS_EXPORT vtkOrderStatistics : public vtkStatisticsAlgorithm
{
public:
vtkTypeMacro(vtkOrderStatistics, vtkStatisticsAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkOrderStatistics* New();
//BTX
// Description:
// The type of quantile definition.
enum QuantileDefinitionType {
InverseCDF = 0, // Identical to method 1 of R
InverseCDFAveragedSteps = 1, // Identical to method 2 of R, ignored for non-numeric types
NearestObservation = 2 // Identical to method 3 of R
};
//ETX
// Description:
// Set/Get the number of quantiles (with uniform spacing).
vtkSetMacro( NumberOfIntervals, vtkIdType );
vtkGetMacro( NumberOfIntervals, vtkIdType );
// Description:
// Set the quantile definition.
vtkSetMacro( QuantileDefinition, QuantileDefinitionType );
void SetQuantileDefinition ( int );
// Description:
// Set/Get whether quantization will be allowed to enforce maximum histogram size.
vtkSetMacro( Quantize, bool );
vtkGetMacro( Quantize, bool );
// Description:
// Set/Get the maximum histogram size.
// This maximum size is enforced only when Quantize is TRUE.
vtkSetMacro( MaximumHistogramSize, vtkIdType );
vtkGetMacro( MaximumHistogramSize, vtkIdType );
// Description:
// Get the quantile definition.
vtkIdType GetQuantileDefinition() { return static_cast<vtkIdType>( this->QuantileDefinition ); }
// Description:
// A convenience method (in particular for access from other applications) to
// set parameter values.
// Return true if setting of requested parameter name was excuted, false otherwise.
virtual bool SetParameter( const char* parameter,
int index,
vtkVariant value );
// Description:
// Given a collection of models, calculate aggregate model
// NB: not implemented
virtual void Aggregate( vtkDataObjectCollection*,
vtkMultiBlockDataSet* ) { return; };
protected:
vtkOrderStatistics();
~vtkOrderStatistics();
// Description:
// Execute the calculations required by the Learn option.
virtual void Learn( vtkTable*,
vtkTable*,
vtkMultiBlockDataSet* );
// Description:
// Execute the calculations required by the Derive option.
virtual void Derive( vtkMultiBlockDataSet* );
// Description:
// Execute the calculations required by the Test option.
virtual void Test( vtkTable*,
vtkMultiBlockDataSet*,
vtkTable* );
// Description:
// Execute the calculations required by the Assess option.
virtual void Assess( vtkTable* inData,
vtkMultiBlockDataSet* inMeta,
vtkTable* outData )
{ this->Superclass::Assess( inData, inMeta, outData, 1 ); }
//BTX
// Description:
// Provide the appropriate assessment functor.
virtual void SelectAssessFunctor( vtkTable* outData,
vtkDataObject* inMeta,
vtkStringArray* rowNames,
AssessFunctor*& dfunc );
//ETX
vtkIdType NumberOfIntervals;
QuantileDefinitionType QuantileDefinition;
bool Quantize;
vtkIdType MaximumHistogramSize;
private:
vtkOrderStatistics(const vtkOrderStatistics&); // Not implemented
void operator=(const vtkOrderStatistics&); // Not implemented
};
#endif
| {
"content_hash": "bdfceecb3e4bf2123916f4ead7dbe959",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 98,
"avg_line_length": 36.08571428571429,
"alnum_prop": 0.681908155186065,
"repo_name": "sumedhasingla/VTK",
"id": "4836d3670a4505f033e8ac1e8a73f5e24cf0983a",
"size": "5615",
"binary": false,
"copies": "10",
"ref": "refs/heads/master",
"path": "Filters/Statistics/vtkOrderStatistics.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "37444"
},
{
"name": "Batchfile",
"bytes": "106"
},
{
"name": "C",
"bytes": "46626621"
},
{
"name": "C++",
"bytes": "68896127"
},
{
"name": "CMake",
"bytes": "1593338"
},
{
"name": "CSS",
"bytes": "186729"
},
{
"name": "Cuda",
"bytes": "29062"
},
{
"name": "D",
"bytes": "2081"
},
{
"name": "GAP",
"bytes": "14120"
},
{
"name": "GLSL",
"bytes": "216632"
},
{
"name": "Groff",
"bytes": "65394"
},
{
"name": "HTML",
"bytes": "292104"
},
{
"name": "Java",
"bytes": "147449"
},
{
"name": "JavaScript",
"bytes": "1131891"
},
{
"name": "Lex",
"bytes": "45341"
},
{
"name": "Objective-C",
"bytes": "22264"
},
{
"name": "Objective-C++",
"bytes": "190908"
},
{
"name": "Perl",
"bytes": "173168"
},
{
"name": "Prolog",
"bytes": "4406"
},
{
"name": "Python",
"bytes": "15749508"
},
{
"name": "Shell",
"bytes": "74255"
},
{
"name": "Slash",
"bytes": "1476"
},
{
"name": "Smarty",
"bytes": "1325"
},
{
"name": "Tcl",
"bytes": "1406812"
},
{
"name": "Yacc",
"bytes": "174577"
}
],
"symlink_target": ""
} |
package com.quantityandconversion.hackernews.screens.topitems;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import com.quantityandconversion.hackernews.R;
import com.quantityandconversion.hackernews.app.QacActivity;
public class TopItemsActivity extends QacActivity implements TopItemsActivityBridge.UiView{
private final TopItemsActivityBridge topItemsActivityBridge;
private TopItemsRecyclerView topItemsRecyclerView;
public TopItemsActivity(){
topItemsActivityBridge = new TopItemsActivityBridge(this);
}
public TopItemsActivity(final TopItemsActivityBridge topItemsActivityBridge,
final TopItemsRecyclerView topItemsRecyclerView) {
this.topItemsActivityBridge = topItemsActivityBridge;
this.topItemsRecyclerView = topItemsRecyclerView;
}
@Override
protected void onCreateFunctionality() {
setContentView(R.layout.top_stories_activity);
bindViews();
loadData();
}
/* package */ void loadData() {
topItemsActivityBridge.loadData();
}
/* package */ void bindViews() {
topItemsRecyclerView = new TopItemsRecyclerView(
(RecyclerView)findViewById(R.id.rv_top_stories),
topItemsActivityBridge.createTopStoriesAdapter());
}
@Override
public void notifyTopStoriesChanged(){
topItemsRecyclerView.notifyTopStoriesChanged();
}
@Override
public void notifyTopStoryChanged(final int position){
topItemsRecyclerView.notifyTopStoryChanged(position);
}
@Override
public Context asContext() {
return this;
}
}
| {
"content_hash": "f7969b50d4da6f882964f3effe3bbdb4",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 91,
"avg_line_length": 29.56140350877193,
"alnum_prop": 0.7163204747774481,
"repo_name": "Fyzxs/HackerNewsReader",
"id": "a0afc0825fd2adf03e3a37fec2d8b827d48eedcf",
"size": "1685",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "HackerNewsReader/src/main/java/com/quantityandconversion/hackernews/screens/topitems/TopItemsActivity.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "151489"
},
{
"name": "Shell",
"bytes": "2942"
}
],
"symlink_target": ""
} |
// Copyright 2020 Google LLC
//
// 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.
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
//
// ----------------------------------------------------------------------------
//
// This file is automatically generated by Config Connector and manual
// changes will be clobbered when the file is regenerated.
//
// ----------------------------------------------------------------------------
// *** DISCLAIMER ***
// Config Connector's go-client for CRDs is currently in ALPHA, which means
// that future versions of the go-client may include breaking changes.
// Please try it out and give us feedback!
package v1beta1
import (
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/clients/generated/apis/k8s/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type ComputeTargetHTTPSProxySpec struct {
/* Only the `external` field is supported to configure the reference.
A reference to the CertificateMap resource uri that identifies a
certificate map associated with the given target proxy. This field
can only be set for global target proxies. */
// +optional
CertificateMapRef *v1alpha1.ResourceRef `json:"certificateMapRef,omitempty"`
/* Immutable. An optional description of this resource. */
// +optional
Description *string `json:"description,omitempty"`
/* Location represents the geographical location of the ComputeTargetHTTPSProxy. Specify a region name or "global" for global resources. Reference: GCP definition of regions/zones (https://cloud.google.com/compute/docs/regions-zones/) */
Location string `json:"location"`
/* Immutable. This field only applies when the forwarding rule that references
this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED. */
// +optional
ProxyBind *bool `json:"proxyBind,omitempty"`
/* Specifies the QUIC override policy for this resource. This determines
whether the load balancer will attempt to negotiate QUIC with clients
or not. Can specify one of NONE, ENABLE, or DISABLE. If NONE is
specified, uses the QUIC policy with no user overrides, which is
equivalent to DISABLE. Default value: "NONE" Possible values: ["NONE", "ENABLE", "DISABLE"]. */
// +optional
QuicOverride *string `json:"quicOverride,omitempty"`
/* Immutable. Optional. The name of the resource. Used for creation and acquisition. When unset, the value of `metadata.name` is used as the default. */
// +optional
ResourceID *string `json:"resourceID,omitempty"`
/* */
// +optional
SslCertificates []v1alpha1.ResourceRef `json:"sslCertificates,omitempty"`
/* A reference to the ComputeSSLPolicy resource that will be
associated with the ComputeTargetHTTPSProxy resource. If not set,
the ComputeTargetHTTPSProxy resource will not have any SSL policy
configured. */
// +optional
SslPolicyRef *v1alpha1.ResourceRef `json:"sslPolicyRef,omitempty"`
/* A reference to the ComputeURLMap resource that defines the mapping
from URL to the BackendService. */
UrlMapRef v1alpha1.ResourceRef `json:"urlMapRef"`
}
type ComputeTargetHTTPSProxyStatus struct {
/* Conditions represent the latest available observations of the
ComputeTargetHTTPSProxy's current state. */
Conditions []v1alpha1.Condition `json:"conditions,omitempty"`
/* Creation timestamp in RFC3339 text format. */
CreationTimestamp string `json:"creationTimestamp,omitempty"`
/* ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. */
ObservedGeneration int `json:"observedGeneration,omitempty"`
/* The unique identifier for the resource. */
ProxyId int `json:"proxyId,omitempty"`
/* */
SelfLink string `json:"selfLink,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ComputeTargetHTTPSProxy is the Schema for the compute API
// +k8s:openapi-gen=true
type ComputeTargetHTTPSProxy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ComputeTargetHTTPSProxySpec `json:"spec,omitempty"`
Status ComputeTargetHTTPSProxyStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ComputeTargetHTTPSProxyList contains a list of ComputeTargetHTTPSProxy
type ComputeTargetHTTPSProxyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ComputeTargetHTTPSProxy `json:"items"`
}
func init() {
SchemeBuilder.Register(&ComputeTargetHTTPSProxy{}, &ComputeTargetHTTPSProxyList{})
}
| {
"content_hash": "bc141686aada4d65c14d606cc253e2ba",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 273,
"avg_line_length": 42.584,
"alnum_prop": 0.7302273154236333,
"repo_name": "GoogleCloudPlatform/k8s-config-connector",
"id": "ec0f1e7dd2156a752b5f314dbda9e10273cdd397",
"size": "5323",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pkg/clients/generated/apis/compute/v1beta1/computetargethttpsproxy_types.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "13767"
},
{
"name": "Go",
"bytes": "5700747"
},
{
"name": "HTML",
"bytes": "1246"
},
{
"name": "Makefile",
"bytes": "9799"
},
{
"name": "Python",
"bytes": "31671"
},
{
"name": "Shell",
"bytes": "25436"
}
],
"symlink_target": ""
} |
package openblocks.enchantments.flimflams;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Enchantments;
import net.minecraft.item.ItemStack;
import openblocks.api.IFlimFlamAction;
public class BaneFlimFlam implements IFlimFlamAction {
@Override
public boolean execute(EntityPlayerMP target) {
for (ItemStack stack : target.inventory.mainInventory) {
if (stack != null && stack.getMaxStackSize() == 1 && !stack.isItemEnchantable() && !stack.isItemEnchanted()) {
stack.addEnchantment(Enchantments.BANE_OF_ARTHROPODS, 5);
return true;
}
}
return false;
}
}
| {
"content_hash": "20ae2f214d12383a5e9c28b5a0a007a5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 113,
"avg_line_length": 29.095238095238095,
"alnum_prop": 0.7610474631751227,
"repo_name": "TheSilkMiner/OpenBlocks",
"id": "85c81eae584d0cf1e8d42fbe6bd740ad4748c1d7",
"size": "611",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/openblocks/enchantments/flimflams/BaneFlimFlam.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "GLSL",
"bytes": "1414"
},
{
"name": "Java",
"bytes": "1212967"
}
],
"symlink_target": ""
} |
<!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="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>RelianceCore: RelianceCore API</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="PTI_LOGO_300.jpg"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">RelianceCore
 <span id="projectnumber">1.4.0</span>
</div>
<div id="projectbrief">Reliance Thermal Printer API</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> |
<a href="#typedef-members">Typedefs</a> |
<a href="#enum-members">Enumerations</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">RelianceCore API</div> </div>
</div><!--header-->
<div class="contents">
<p>Required header for integration into your project.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="class_reliance_h_i_d.html">RelianceHID</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Primary interface for interacting with Reliance Thermal Printer. <a href="class_reliance_h_i_d.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_reliance_h_i_d_1_1_revision.html">RelianceHID::Revision</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Describes a firmware revision levels using semver syntax. <a href="struct_reliance_h_i_d_1_1_revision.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_reliance_h_i_d_1_1_result.html">RelianceHID::Result</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Describes response from all <a class="el" href="class_reliance_h_i_d.html" title="Primary interface for interacting with Reliance Thermal Printer. ">RelianceHID</a> printer commands. <a href="struct_reliance_h_i_d_1_1_result.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_reliance_h_i_d_1_1_reliance_status.html">RelianceHID::RelianceStatus</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Status response from Reliance printer. <a href="struct_reliance_h_i_d_1_1_reliance_status.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:ga9186a39218ffab69b1c1ba4432a98291"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga9186a39218ffab69b1c1ba4432a98291">RelianceHID::ArgList</a> = std::vector< std::string ></td></tr>
<tr class="memdesc:ga9186a39218ffab69b1c1ba4432a98291"><td class="mdescLeft"> </td><td class="mdescRight">List of string arguments. <a href="#ga9186a39218ffab69b1c1ba4432a98291">More...</a><br /></td></tr>
<tr class="separator:ga9186a39218ffab69b1c1ba4432a98291"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga4f87ac0fa2a630056fe5dc39d68cfc5a"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga4f87ac0fa2a630056fe5dc39d68cfc5a">RelianceHID::RelianceStatus::hasSensorFlag</a> (SensorStatus flag)</td></tr>
<tr class="memdesc:ga4f87ac0fa2a630056fe5dc39d68cfc5a"><td class="mdescLeft"> </td><td class="mdescRight">Helper function to check if specified flag is set. <a href="#ga4f87ac0fa2a630056fe5dc39d68cfc5a">More...</a><br /></td></tr>
<tr class="separator:ga4f87ac0fa2a630056fe5dc39d68cfc5a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9770d78b101eefa30b604562206635a3"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga9770d78b101eefa30b604562206635a3">RelianceHID::RelianceStatus::hasErrorFlag</a> (ErrorStatus flag)</td></tr>
<tr class="memdesc:ga9770d78b101eefa30b604562206635a3"><td class="mdescLeft"> </td><td class="mdescRight">Helper function to check if specified flag is set. <a href="#ga9770d78b101eefa30b604562206635a3">More...</a><br /></td></tr>
<tr class="separator:ga9770d78b101eefa30b604562206635a3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga76a600d38ea72da090919fa6f30699ff"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga76a600d38ea72da090919fa6f30699ff">RelianceHID::RelianceStatus::hasSensorFlag</a> (SensorStatus flag) const </td></tr>
<tr class="memdesc:ga76a600d38ea72da090919fa6f30699ff"><td class="mdescLeft"> </td><td class="mdescRight">Const function method to check if specified flag is set. <a href="#ga76a600d38ea72da090919fa6f30699ff">More...</a><br /></td></tr>
<tr class="separator:ga76a600d38ea72da090919fa6f30699ff"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga76b49fab3583edc13006191a15e33e8e"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga76b49fab3583edc13006191a15e33e8e">RelianceHID::RelianceStatus::hasErrorFlag</a> (ErrorStatus flag) const </td></tr>
<tr class="memdesc:ga76b49fab3583edc13006191a15e33e8e"><td class="mdescLeft"> </td><td class="mdescRight">Const function method to check if specified flag is set. <a href="#ga76b49fab3583edc13006191a15e33e8e">More...</a><br /></td></tr>
<tr class="separator:ga76b49fab3583edc13006191a15e33e8e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gae8cffa492622a28dfc2b6da5876b157f"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gae8cffa492622a28dfc2b6da5876b157f">RelianceHID::RelianceStatus::isPaperLow</a> ()</td></tr>
<tr class="memdesc:gae8cffa492622a28dfc2b6da5876b157f"><td class="mdescLeft"> </td><td class="mdescRight">Helper function returns true if status report indicates paper low. <a href="#gae8cffa492622a28dfc2b6da5876b157f">More...</a><br /></td></tr>
<tr class="separator:gae8cffa492622a28dfc2b6da5876b157f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga3e787a74e48e78e0a45e42858a93ef46"><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga3e787a74e48e78e0a45e42858a93ef46">RelianceHID::RelianceStatus::isPaperOut</a> ()</td></tr>
<tr class="memdesc:ga3e787a74e48e78e0a45e42858a93ef46"><td class="mdescLeft"> </td><td class="mdescRight">Helper function returns true if status report indicates paper is out. <a href="#ga3e787a74e48e78e0a45e42858a93ef46">More...</a><br /></td></tr>
<tr class="separator:ga3e787a74e48e78e0a45e42858a93ef46"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa23b5e0f44b11f458cd46c7b7f4324f9"><td class="memItemLeft" align="right" valign="top">static float </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaa23b5e0f44b11f458cd46c7b7f4324f9">RelianceHID::RelianceStatus::adc2Voltage</a> (uint16_t adc)</td></tr>
<tr class="memdesc:gaa23b5e0f44b11f458cd46c7b7f4324f9"><td class="mdescLeft"> </td><td class="mdescRight">Returns the voltage given a raw ADC reading. This assumes a 12-bit ADC. <a href="#gaa23b5e0f44b11f458cd46c7b7f4324f9">More...</a><br /></td></tr>
<tr class="separator:gaa23b5e0f44b11f458cd46c7b7f4324f9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga1cc86588eac1c83a3649c57bc8a7d3f0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga1cc86588eac1c83a3649c57bc8a7d3f0">RelianceHID::initialize</a> ()</td></tr>
<tr class="memdesc:ga1cc86588eac1c83a3649c57bc8a7d3f0"><td class="mdescLeft"> </td><td class="mdescRight">Attempt to connect to device. <a href="#ga1cc86588eac1c83a3649c57bc8a7d3f0">More...</a><br /></td></tr>
<tr class="separator:ga1cc86588eac1c83a3649c57bc8a7d3f0"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga152a7fe50a178b65a32dce96849a7df2"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga152a7fe50a178b65a32dce96849a7df2">RelianceHID::getRevision</a> (Revision *rev)</td></tr>
<tr class="memdesc:ga152a7fe50a178b65a32dce96849a7df2"><td class="mdescLeft"> </td><td class="mdescRight">Read firmware revision from target. <a href="#ga152a7fe50a178b65a32dce96849a7df2">More...</a><br /></td></tr>
<tr class="separator:ga152a7fe50a178b65a32dce96849a7df2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaaa6d2b27d5210d7954df2f94177f5b6f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaaa6d2b27d5210d7954df2f94177f5b6f">RelianceHID::ping</a> ()</td></tr>
<tr class="memdesc:gaaa6d2b27d5210d7954df2f94177f5b6f"><td class="mdescLeft"> </td><td class="mdescRight">Side effect free command to test for presence of printer. <a href="#gaaa6d2b27d5210d7954df2f94177f5b6f">More...</a><br /></td></tr>
<tr class="separator:gaaa6d2b27d5210d7954df2f94177f5b6f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga9e558f47980247f4de67ef0241623274"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga9e558f47980247f4de67ef0241623274">RelianceHID::reboot</a> ()</td></tr>
<tr class="memdesc:ga9e558f47980247f4de67ef0241623274"><td class="mdescLeft"> </td><td class="mdescRight">Immediately perform a hard reboot of the printer. <a href="#ga9e558f47980247f4de67ef0241623274">More...</a><br /></td></tr>
<tr class="separator:ga9e558f47980247f4de67ef0241623274"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga009b17604c59463520bec8615652ea8f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga009b17604c59463520bec8615652ea8f">RelianceHID::getStatus</a> (RelianceStatus *status)</td></tr>
<tr class="memdesc:ga009b17604c59463520bec8615652ea8f"><td class="mdescLeft"> </td><td class="mdescRight">Get the current status of Reliance printer. <a href="#ga009b17604c59463520bec8615652ea8f">More...</a><br /></td></tr>
<tr class="separator:ga009b17604c59463520bec8615652ea8f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaebdddf8abd0418682f7fca676353779b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaebdddf8abd0418682f7fca676353779b">RelianceHID::getVirtualCommsEnabled</a> ()</td></tr>
<tr class="memdesc:gaebdddf8abd0418682f7fca676353779b"><td class="mdescLeft"> </td><td class="mdescRight">Gets the state of the USB virtual comm port feature. <a href="#gaebdddf8abd0418682f7fca676353779b">More...</a><br /></td></tr>
<tr class="separator:gaebdddf8abd0418682f7fca676353779b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab9fa57f295264debd64ddf5eb50c9d9a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gab9fa57f295264debd64ddf5eb50c9d9a">RelianceHID::setVirtualCommsEnabled</a> (bool enabled)</td></tr>
<tr class="memdesc:gab9fa57f295264debd64ddf5eb50c9d9a"><td class="mdescLeft"> </td><td class="mdescRight">Enable or disable the USB virtual comm port feature. <a href="#gab9fa57f295264debd64ddf5eb50c9d9a">More...</a><br /></td></tr>
<tr class="separator:gab9fa57f295264debd64ddf5eb50c9d9a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga28e59ad7c1803792ab723bacab8e59e7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga28e59ad7c1803792ab723bacab8e59e7">RelianceHID::getStartupTicketEnabled</a> ()</td></tr>
<tr class="memdesc:ga28e59ad7c1803792ab723bacab8e59e7"><td class="mdescLeft"> </td><td class="mdescRight">Gets the state of the startup ticket feature. <a href="#ga28e59ad7c1803792ab723bacab8e59e7">More...</a><br /></td></tr>
<tr class="separator:ga28e59ad7c1803792ab723bacab8e59e7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga84ab3954bc5045a7d74feb7f9c4c9ff6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga84ab3954bc5045a7d74feb7f9c4c9ff6">RelianceHID::setStartupTicketEnabled</a> (bool enabled)</td></tr>
<tr class="memdesc:ga84ab3954bc5045a7d74feb7f9c4c9ff6"><td class="mdescLeft"> </td><td class="mdescRight">Sets the state of the startup ticket feature. <a href="#ga84ab3954bc5045a7d74feb7f9c4c9ff6">More...</a><br /></td></tr>
<tr class="separator:ga84ab3954bc5045a7d74feb7f9c4c9ff6"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gac05d26fb3bc53afd2d9c05240d8cdfc3"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gac05d26fb3bc53afd2d9c05240d8cdfc3">RelianceHID::getUnknownCommands</a> (std::vector< int > &dst)</td></tr>
<tr class="memdesc:gac05d26fb3bc53afd2d9c05240d8cdfc3"><td class="mdescLeft"> </td><td class="mdescRight">Returns a list of ESC/POS commands the Reliance does not understand. <a href="#gac05d26fb3bc53afd2d9c05240d8cdfc3">More...</a><br /></td></tr>
<tr class="separator:gac05d26fb3bc53afd2d9c05240d8cdfc3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga12ce6c2c2f07542c77d9032abe2908fa"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga12ce6c2c2f07542c77d9032abe2908fa">RelianceHID::getPaperWidth</a> ()</td></tr>
<tr class="memdesc:ga12ce6c2c2f07542c77d9032abe2908fa"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current configured paper roll width. <a href="#ga12ce6c2c2f07542c77d9032abe2908fa">More...</a><br /></td></tr>
<tr class="separator:ga12ce6c2c2f07542c77d9032abe2908fa"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gab1fea40550e7976406ab79556a5161da"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gab1fea40550e7976406ab79556a5161da">RelianceHID::setPaperWidth</a> (int width)</td></tr>
<tr class="memdesc:gab1fea40550e7976406ab79556a5161da"><td class="mdescLeft"> </td><td class="mdescRight">Change the paper roll width configuration. <a href="#gab1fea40550e7976406ab79556a5161da">More...</a><br /></td></tr>
<tr class="separator:gab1fea40550e7976406ab79556a5161da"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga2f75b71f0f3dfce230599a4820ffa76e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga2f75b71f0f3dfce230599a4820ffa76e">RelianceHID::getMotorGen</a> ()</td></tr>
<tr class="memdesc:ga2f75b71f0f3dfce230599a4820ffa76e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current motor configuration. <a href="#ga2f75b71f0f3dfce230599a4820ffa76e">More...</a><br /></td></tr>
<tr class="separator:ga2f75b71f0f3dfce230599a4820ffa76e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gaa39c944036e2a227d53f7404e495a04e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gaa39c944036e2a227d53f7404e495a04e">RelianceHID::setMotorGen</a> (int gen)</td></tr>
<tr class="memdesc:gaa39c944036e2a227d53f7404e495a04e"><td class="mdescLeft"> </td><td class="mdescRight">Change the motor configuration to another gen. <a href="#gaa39c944036e2a227d53f7404e495a04e">More...</a><br /></td></tr>
<tr class="separator:gaa39c944036e2a227d53f7404e495a04e"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ga6d675c7d07ca2d20bf20ca2cc966ab7c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#ga6d675c7d07ca2d20bf20ca2cc966ab7c">RelianceHID::getMotorCurrent</a> ()</td></tr>
<tr class="memdesc:ga6d675c7d07ca2d20bf20ca2cc966ab7c"><td class="mdescLeft"> </td><td class="mdescRight">Returns the current motor current in milliamps. <a href="#ga6d675c7d07ca2d20bf20ca2cc966ab7c">More...</a><br /></td></tr>
<tr class="separator:ga6d675c7d07ca2d20bf20ca2cc966ab7c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:gabfe3e9038487978900639045552cfa11"><td class="memItemLeft" align="right" valign="top"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result </td><td class="memItemRight" valign="bottom"><a class="el" href="group___a_p_i.html#gabfe3e9038487978900639045552cfa11">RelianceHID::setMotorCurrent</a> (int current)</td></tr>
<tr class="memdesc:gabfe3e9038487978900639045552cfa11"><td class="mdescLeft"> </td><td class="mdescRight">Change the motor current. <a href="#gabfe3e9038487978900639045552cfa11">More...</a><br /></td></tr>
<tr class="separator:gabfe3e9038487978900639045552cfa11"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Required header for integration into your project. </p>
<dl class="section copyright"><dt>Copyright</dt><dd>Pyramid Technologies Inc. 2017</dd></dl>
<dl class="section author"><dt>Author</dt><dd>Cory Todd </dd></dl>
<dl class="section date"><dt>Date</dt><dd>9/19/2017 </dd></dl>
<h2 class="groupheader">Typedef Documentation</h2>
<a class="anchor" id="ga9186a39218ffab69b1c1ba4432a98291"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">using <a class="el" href="group___a_p_i.html#ga9186a39218ffab69b1c1ba4432a98291">RelianceHID::ArgList</a> = std::vector<std::string></td>
</tr>
</table>
</div><div class="memdoc">
<p>List of string arguments. </p>
</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group___a_p_i.html#ga43d788c26757a36ddb018dca88c88d39">RelianceHID::RelianceStatus::ErrorStatus</a> : uint8_t</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Bit enumberation describes each error state that can be reported by Reliance. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39aeb738eb0caeb5ea2bffaf2df6b23db69"></a>isJammed </td><td class="fielddoc">
<ul>
<li>0: No jam, - 1: Jam has disabled printer </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39aa31f9d0d74e08f6d5d09da259a2b3283"></a>isOverheated </td><td class="fielddoc">
<ul>
<li>0: Normal system temp, - 1: Printer is overheated and disabled </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39a35e561cffddf738ee5c57ee082389c9e"></a>isCutterErr </td><td class="fielddoc">
<ul>
<li>0: Cutter is okay, - 1: Cutter is in an error staes (e.g. stuck up) </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39ab8e2620f84d2697eca6c64d96cc90cbf"></a>isOverVoltage </td><td class="fielddoc">
<ul>
<li>0: System voltage okay, - 1: System over voltage </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39acd9a8860dc65fb35ac07ef67cc905c52"></a>isUnderVoltage </td><td class="fielddoc">
<ul>
<li>0: System voltage okay, - 1: System under voltage </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39a30a46b5e3f973685cf8c5f11efafdd09"></a>isPlatenOpen </td><td class="fielddoc">
<ul>
<li>0: Platen (head) is closed, - 1: Platen (head) open </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39a873117b65e971bf4f5563a9adf6bdbf3"></a>_reserved </td><td class="fielddoc">
<p>Reserved. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga43d788c26757a36ddb018dca88c88d39a35d3400084e8c6a1c61d98d44c1d39fb"></a>isUnknownErr </td><td class="fielddoc">
<ul>
<li>0: No unknown error, -1: Has an error, we don't know what </li>
</ul>
</td></tr>
</table>
</div>
</div>
<a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group___a_p_i.html#gaea5bc0cd9f02957c4f285ca634f9bd17">RelianceHID::ReturnCode</a></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Quick return code. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17a26b63f278101527e06a5547719568bb5"></a>Okay </td><td class="fielddoc">
<p>Successful command. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17ac85a251cc457840f1e032f1b733e9398"></a>Timeout </td><td class="fielddoc">
<p>No response within timeout period. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17a6fa6cc1e0dde443564f5bbccb73705ea"></a>BadResp </td><td class="fielddoc">
<p>Response received but it was corrupt. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17afdc7a87c8b137a29ee47022b3509e23f"></a>BadArg </td><td class="fielddoc">
<p>Invalid argument provided to command builder. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17a8171e5989ec366b416464efebe21bb9c"></a>DeviceNXE </td><td class="fielddoc">
<p>No device found. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaea5bc0cd9f02957c4f285ca634f9bd17ae09852169ccad80a04037ba89fa0a581"></a>NoInit </td><td class="fielddoc">
<p>Device is not initialized. </p>
</td></tr>
</table>
</div>
</div>
<a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group___a_p_i.html#ga60eda984bceb8679b63253b55a1811f1">RelianceHID::RelianceStatus::SensorStatus</a> : uint8_t</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Bit enumeration describes the state of each sensor. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1a8bef987fce4f874890a972de6da6e39e"></a>platenOn </td><td class="fielddoc">
<ul>
<li>0: Platen off, - 1: Platen on </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1a5de8ca03eaefcc7fd3447449aff53921"></a>cutterHome </td><td class="fielddoc">
<ul>
<li>0: Cuter not home, - 1: Cutter home </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1a6a2cc5c368b645f2a1eb42ea6f8ff6ab"></a>tachOk </td><td class="fielddoc">
<ul>
<li>0: Tach okay, - 1: Tach error (ALWAYS 0) </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1a1bb6e846f2e0d6b39b864dcdf7db2e1e"></a>presenterPaperPres </td><td class="fielddoc">
<ul>
<li>0: Paper not present - 1: Paper present </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1adaa7f787fa5b8692e93ad738d7f04292"></a>pathPaperPres </td><td class="fielddoc">
<ul>
<li>0: Paper not present - 1: Paper present </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1a89060999e3fdbba12cf494ecbb0cd7ad"></a>paperPaperPres </td><td class="fielddoc">
<ul>
<li>0: Paper not present - 1: Paper present </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1aed7c8230810057959b17a1b8aca9248a"></a>notchPres </td><td class="fielddoc">
<ul>
<li>0: Notch not present - 1: Notch present/detected </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ga60eda984bceb8679b63253b55a1811f1ac35a0397447d711c50a1b7351d9af030"></a>armPaperPres </td><td class="fielddoc">
<ul>
<li>0: Paper arm not installed - 1: Paper arm installed </li>
</ul>
</td></tr>
</table>
</div>
</div>
<a class="anchor" id="gaedb5420b1702b911426f25b76a53f9db"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="group___a_p_i.html#gaedb5420b1702b911426f25b76a53f9db">RelianceHID::RelianceStatus::TicketState</a> : uint8_t</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">strong</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Reliance will always be in one of these states. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="gaedb5420b1702b911426f25b76a53f9dbae599161956d626eda4cb0a5ffb85271c"></a>Idle </td><td class="fielddoc">
<p>Printer is not moving paper, no ticket in bezel. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaedb5420b1702b911426f25b76a53f9dbab002a564ceda05dbdf012a48a145d0d3"></a>Printing </td><td class="fielddoc">
<p>Printer is actively printing on paper. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaedb5420b1702b911426f25b76a53f9dba026aa4496bc465447e55112c82b66e21"></a>Presenting </td><td class="fielddoc">
<p>Printing is complete and paper is in transit. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="gaedb5420b1702b911426f25b76a53f9dba260f0c7a37a9008d7d12e442a53ff348"></a>Presented </td><td class="fielddoc">
<p>Printing is complete, transit is complete, paper is at bezel. </p>
</td></tr>
</table>
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaa23b5e0f44b11f458cd46c7b7f4324f9"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static float RelianceHID::RelianceStatus::adc2Voltage </td>
<td>(</td>
<td class="paramtype">uint16_t </td>
<td class="paramname"><em>adc</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the voltage given a raw ADC reading. This assumes a 12-bit ADC. </p>
</div>
</div>
<a class="anchor" id="ga6d675c7d07ca2d20bf20ca2cc966ab7c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getMotorCurrent </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the current motor current in milliamps. </p>
<p>This is the current that is applied to printer motor.</p>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information. <a class="el" href="struct_reliance_h_i_d_1_1_result.html#a9b0640dfbf141ab17c2c25d472f131e7" title="Used for commands that return integer values. ">Result::value</a> set to motor current value </dd></dl>
</div>
</div>
<a class="anchor" id="ga2f75b71f0f3dfce230599a4820ffa76e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getMotorGen </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the current motor configuration. </p>
<p>There are currently two motors, gen1 and gen2. The returned result will populate the value field with 0, 1, etc. which represent these motor gens.</p>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information. <a class="el" href="struct_reliance_h_i_d_1_1_result.html#a9b0640dfbf141ab17c2c25d472f131e7" title="Used for commands that return integer values. ">Result::value</a> set to motor generation code </dd></dl>
</div>
</div>
<a class="anchor" id="ga12ce6c2c2f07542c77d9032abe2908fa"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getPaperWidth </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the current configured paper roll width. </p>
<p>Reliance supports paper rolls width from 58mm though 80mm. This setting enables proper print margins for your chosen roll width.</p>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information. <a class="el" href="struct_reliance_h_i_d_1_1_result.html#a9b0640dfbf141ab17c2c25d472f131e7" title="Used for commands that return integer values. ">Result::value</a> set to paper width in mm </dd></dl>
</div>
</div>
<a class="anchor" id="ga152a7fe50a178b65a32dce96849a7df2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getRevision </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_reliance_h_i_d_1_1_revision.html">Revision</a> * </td>
<td class="paramname"><em>rev</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read firmware revision from target. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">rev</td><td>out parameter</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="ga28e59ad7c1803792ab723bacab8e59e7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getStartupTicketEnabled </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the state of the startup ticket feature. </p>
<p>When enabled, Reliance will print its configuration to a ticket on every power up. When disabled, this behavior is disabled.</p>
<dl class="section note"><dt>Note</dt><dd>This only controls the startup ticket. The ticket that is printed when you feed in paper cannot be disabled.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="ga009b17604c59463520bec8615652ea8f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getStatus </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_reliance_h_i_d_1_1_reliance_status.html">RelianceStatus</a> * </td>
<td class="paramname"><em>status</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the current status of Reliance printer. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">status</td><td>will be written with current status</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gac05d26fb3bc53afd2d9c05240d8cdfc3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getUnknownCommands </td>
<td>(</td>
<td class="paramtype">std::vector< int > & </td>
<td class="paramname"><em>dst</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a list of ESC/POS commands the Reliance does not understand. </p>
<p>The list will be written to dst in the order cmd:arg where cmd is a known ESC/POS prefix such as ESC, FS, or GS (1B, 1C, 1D) and the arg is the first given parmeter. This is useful for legacy applications that send uncommon or customer ESC/POS commands to their printers.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">dst</td><td>vector to write log to</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gaebdddf8abd0418682f7fca676353779b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::getVirtualCommsEnabled </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the state of the USB virtual comm port feature. </p>
<p>When enabled, Reliance will enumerate an additional USB interface as a CDC comm port. Check device manager or /dev/tty* to find the OS assigned port name.</p>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="struct_reliance_h_i_d_1_1_result.html#a9b0640dfbf141ab17c2c25d472f131e7" title="Used for commands that return integer values. ">Result.value</a> - 0 - Off (disabled) 1 - On (enabled) </dd></dl>
</div>
</div>
<a class="anchor" id="ga9770d78b101eefa30b604562206635a3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RelianceHID::RelianceStatus::hasErrorFlag </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group___a_p_i.html#ga43d788c26757a36ddb018dca88c88d39">ErrorStatus</a> </td>
<td class="paramname"><em>flag</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function to check if specified flag is set. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">flag</td><td>to check</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if current ErrorStatus contains flag </dd></dl>
</div>
</div>
<a class="anchor" id="ga76b49fab3583edc13006191a15e33e8e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RelianceHID::RelianceStatus::hasErrorFlag </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group___a_p_i.html#ga43d788c26757a36ddb018dca88c88d39">ErrorStatus</a> </td>
<td class="paramname"><em>flag</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Const function method to check if specified flag is set. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">flag</td><td>to check</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if current ErrorStatus contains flag </dd></dl>
</div>
</div>
<a class="anchor" id="ga4f87ac0fa2a630056fe5dc39d68cfc5a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RelianceHID::RelianceStatus::hasSensorFlag </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group___a_p_i.html#ga60eda984bceb8679b63253b55a1811f1">SensorStatus</a> </td>
<td class="paramname"><em>flag</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function to check if specified flag is set. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">flag</td><td>to check</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if current SensorStatus contains flag </dd></dl>
</div>
</div>
<a class="anchor" id="ga76a600d38ea72da090919fa6f30699ff"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RelianceHID::RelianceStatus::hasSensorFlag </td>
<td>(</td>
<td class="paramtype"><a class="el" href="group___a_p_i.html#ga60eda984bceb8679b63253b55a1811f1">SensorStatus</a> </td>
<td class="paramname"><em>flag</em></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Const function method to check if specified flag is set. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">flag</td><td>to check</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if current SensorStatus contains flag </dd></dl>
</div>
</div>
<a class="anchor" id="ga1cc86588eac1c83a3649c57bc8a7d3f0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::initialize </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Attempt to connect to device. </p>
<dl class="section warning"><dt>Warning</dt><dd>This must be called before executing any commands</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gae8cffa492622a28dfc2b6da5876b157f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RelianceHID::RelianceStatus::isPaperLow </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function returns true if status report indicates paper low. </p>
<dl class="section warning"><dt>Warning</dt><dd>If no arm is attached to Reliance, the response will always be true regardless of paper level.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>true if paper low. If false, no paper low warnings are present </dd></dl>
</div>
</div>
<a class="anchor" id="ga3e787a74e48e78e0a45e42858a93ef46"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool RelianceHID::RelianceStatus::isPaperOut </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function returns true if status report indicates paper is out. </p>
<dl class="section return"><dt>Returns</dt><dd>true if there is no paper. If false, paper is present </dd></dl>
</div>
</div>
<a class="anchor" id="gaaa6d2b27d5210d7954df2f94177f5b6f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::ping </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Side effect free command to test for presence of printer. </p>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="ga9e558f47980247f4de67ef0241623274"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::reboot </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Immediately perform a hard reboot of the printer. </p>
<dl class="section warning"><dt>Warning</dt><dd>You must call initialize after a reboot</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gabfe3e9038487978900639045552cfa11"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::setMotorCurrent </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>current</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the motor current. </p>
<dl class="section warning"><dt>Warning</dt><dd>This function should not be called under normal conditions. This is for service technicians that may be replacing motors in older units.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">current</td><td>milliamps to apply to printer motor (min: 50, max: 1500)</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gaa39c944036e2a227d53f7404e495a04e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::setMotorGen </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>gen</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the motor configuration to another gen. </p>
<dl class="section warning"><dt>Warning</dt><dd>This function should not be called under normal conditions. This is for service technicians that may be replacing motors in older units.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">gen</td><td>0 for gen1, 1 for gen 2</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gab1fea40550e7976406ab79556a5161da"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::setPaperWidth </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Change the paper roll width configuration. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">width</td><td>value between 58 and 80, inclusive</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="ga84ab3954bc5045a7d74feb7f9c4c9ff6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::setStartupTicketEnabled </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>enabled</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the state of the startup ticket feature. </p>
<dl class="section note"><dt>Note</dt><dd>When enabled, Reliance will print its configuration to a ticket on every power up. When disabled, this behavior is disabled.</dd>
<dd>
This only controls the startup ticket. The ticket that is printed when</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">enabled</td><td>true or false</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
<a class="anchor" id="gab9fa57f295264debd64ddf5eb50c9d9a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_reliance_h_i_d_8hpp.html#a0db16387f726b963f8b2805ee930189a">RELIANCECORE_EXPORT</a> Result RelianceHID::setVirtualCommsEnabled </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>enabled</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable or disable the USB virtual comm port feature. </p>
<p>When enabled, Reliance will enumerate an additional USB interface as a CDC comm port. Check device manager or /dev/tty* to find the OS assigned port name.</p>
<dl class="section note"><dt>Note</dt><dd>A reboot of the printer is required in order for this to take effect</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group___a_p_i.html#ga9e558f47980247f4de67ef0241623274" title="Immediately perform a hard reboot of the printer. ">RelianceHID::reboot</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">enabled</td><td>true or false</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ret and message fields will be set with additional information </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
| {
"content_hash": "5a58e4dec1112f937b3d9779f5bcfe06",
"timestamp": "",
"source": "github",
"line_count": 948,
"max_line_length": 425,
"avg_line_length": 58.11286919831224,
"alnum_prop": 0.6920186600352145,
"repo_name": "PyramidTechnologies/pyramidtechnologies.github.io",
"id": "a7bd5a4d6d897e1fb9e1fecfc0965c0073e6295d",
"size": "55091",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api_reliance/group___a_p_i.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "99084"
},
{
"name": "HTML",
"bytes": "2010356"
},
{
"name": "JavaScript",
"bytes": "142865"
},
{
"name": "Ruby",
"bytes": "1322"
}
],
"symlink_target": ""
} |
using namespace std;
using namespace boost;
//
// Global state
//
CCriticalSection cs_setpwalletRegistered;
set<CWallet*> setpwalletRegistered;
CCriticalSection cs_main;
CTxMemPool mempool;
unsigned int nTransactionsUpdated = 0;
map<uint256, CBlockIndex*> mapBlockIndex;
uint256 hashGenesisBlock("0x");
static CBigNum bnProofOfWorkLimit(~uint256(0) >> 20); // starting difficulty is 1 / 2^12
CBlockIndex* pindexGenesisBlock = NULL;
int nBestHeight = -1;
CBigNum bnBestChainWork = 0;
CBigNum bnBestInvalidWork = 0;
uint256 hashBestChain = 0;
CBlockIndex* pindexBest = NULL;
int64 nTimeBestReceived = 0;
CMedianFilter<int> cPeerBlockCounts(5, 0); // Amount of blocks that other nodes claim to have
map<uint256, CBlock*> mapOrphanBlocks;
multimap<uint256, CBlock*> mapOrphanBlocksByPrev;
map<uint256, CDataStream*> mapOrphanTransactions;
map<uint256, map<uint256, CDataStream*> > mapOrphanTransactionsByPrev;
// Constant stuff for coinbase transactions we create:
CScript COINBASE_FLAGS;
const string strMessageMagic = "FooCoin Signed Message:\n";
double dHashesPerSec;
int64 nHPSTimerStart;
// Settings
int64 nTransactionFee = 0;
int64 nMinimumInputValue = CENT / 100;
//////////////////////////////////////////////////////////////////////////////
//
// dispatching functions
//
// These functions dispatch to one or all registered wallets
void RegisterWallet(CWallet* pwalletIn)
{
{
LOCK(cs_setpwalletRegistered);
setpwalletRegistered.insert(pwalletIn);
}
}
void UnregisterWallet(CWallet* pwalletIn)
{
{
LOCK(cs_setpwalletRegistered);
setpwalletRegistered.erase(pwalletIn);
}
}
// check whether the passed transaction is from us
bool static IsFromMe(CTransaction& tx)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
if (pwallet->IsFromMe(tx))
return true;
return false;
}
// get the wallet transaction with the given hash (if it exists)
bool static GetTransaction(const uint256& hashTx, CWalletTx& wtx)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
if (pwallet->GetTransaction(hashTx,wtx))
return true;
return false;
}
// erases transaction with the given hash from all wallets
void static EraseFromWallets(uint256 hash)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->EraseFromWallet(hash);
}
// make sure all wallets know about the given transaction, in the given block
void SyncWithWallets(const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->AddToWalletIfInvolvingMe(tx, pblock, fUpdate);
}
// notify wallets about a new best chain
void static SetBestChain(const CBlockLocator& loc)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->SetBestChain(loc);
}
// notify wallets about an updated transaction
void static UpdatedTransaction(const uint256& hashTx)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->UpdatedTransaction(hashTx);
}
// dump all wallets
void static PrintWallets(const CBlock& block)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->PrintWallet(block);
}
// notify wallets about an incoming inventory (for request counts)
void static Inventory(const uint256& hash)
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->Inventory(hash);
}
// ask wallets to resend their transactions
void static ResendWalletTransactions()
{
BOOST_FOREACH(CWallet* pwallet, setpwalletRegistered)
pwallet->ResendWalletTransactions();
}
//////////////////////////////////////////////////////////////////////////////
//
// mapOrphanTransactions
//
bool AddOrphanTx(const CDataStream& vMsg)
{
CTransaction tx;
CDataStream(vMsg) >> tx;
uint256 hash = tx.GetHash();
if (mapOrphanTransactions.count(hash))
return false;
CDataStream* pvMsg = new CDataStream(vMsg);
// Ignore big transactions, to avoid a
// send-big-orphans memory exhaustion attack. If a peer has a legitimate
// large transaction with a missing parent then we assume
// it will rebroadcast it later, after the parent transaction(s)
// have been mined or received.
// 10,000 orphans, each of which is at most 5,000 bytes big is
// at most 500 megabytes of orphans:
if (pvMsg->size() > 5000)
{
printf("ignoring large orphan tx (size: %u, hash: %s)\n", pvMsg->size(), hash.ToString().substr(0,10).c_str());
delete pvMsg;
return false;
}
mapOrphanTransactions[hash] = pvMsg;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapOrphanTransactionsByPrev[txin.prevout.hash].insert(make_pair(hash, pvMsg));
printf("stored orphan tx %s (mapsz %u)\n", hash.ToString().substr(0,10).c_str(),
mapOrphanTransactions.size());
return true;
}
void static EraseOrphanTx(uint256 hash)
{
if (!mapOrphanTransactions.count(hash))
return;
const CDataStream* pvMsg = mapOrphanTransactions[hash];
CTransaction tx;
CDataStream(*pvMsg) >> tx;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
mapOrphanTransactionsByPrev[txin.prevout.hash].erase(hash);
if (mapOrphanTransactionsByPrev[txin.prevout.hash].empty())
mapOrphanTransactionsByPrev.erase(txin.prevout.hash);
}
delete pvMsg;
mapOrphanTransactions.erase(hash);
}
unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans)
{
unsigned int nEvicted = 0;
while (mapOrphanTransactions.size() > nMaxOrphans)
{
// Evict a random orphan:
uint256 randomhash = GetRandHash();
map<uint256, CDataStream*>::iterator it = mapOrphanTransactions.lower_bound(randomhash);
if (it == mapOrphanTransactions.end())
it = mapOrphanTransactions.begin();
EraseOrphanTx(it->first);
++nEvicted;
}
return nEvicted;
}
//////////////////////////////////////////////////////////////////////////////
//
// CTransaction and CTxIndex
//
bool CTransaction::ReadFromDisk(CTxDB& txdb, COutPoint prevout, CTxIndex& txindexRet)
{
SetNull();
if (!txdb.ReadTxIndex(prevout.hash, txindexRet))
return false;
if (!ReadFromDisk(txindexRet.pos))
return false;
if (prevout.n >= vout.size())
{
SetNull();
return false;
}
return true;
}
bool CTransaction::ReadFromDisk(CTxDB& txdb, COutPoint prevout)
{
CTxIndex txindex;
return ReadFromDisk(txdb, prevout, txindex);
}
bool CTransaction::ReadFromDisk(COutPoint prevout)
{
CTxDB txdb("r");
CTxIndex txindex;
return ReadFromDisk(txdb, prevout, txindex);
}
bool CTransaction::IsStandard() const
{
if (nVersion > CTransaction::CURRENT_VERSION)
return false;
BOOST_FOREACH(const CTxIn& txin, vin)
{
// Biggest 'standard' txin is a 3-signature 3-of-3 CHECKMULTISIG
// pay-to-script-hash, which is 3 ~80-byte signatures, 3
// ~65-byte public keys, plus a few script ops.
if (txin.scriptSig.size() > 500)
return false;
if (!txin.scriptSig.IsPushOnly())
return false;
}
BOOST_FOREACH(const CTxOut& txout, vout)
if (!::IsStandard(txout.scriptPubKey))
return false;
return true;
}
//
// Check transaction inputs, and make sure any
// pay-to-script-hash transactions are evaluating IsStandard scripts
//
// Why bother? To avoid denial-of-service attacks; an attacker
// can submit a standard HASH... OP_EQUAL transaction,
// which will get accepted into blocks. The redemption
// script can be anything; an attacker could use a very
// expensive-to-check-upon-redemption script like:
// DUP CHECKSIG DROP ... repeated 100 times... OP_1
//
bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const
{
if (IsCoinBase())
return true; // Coinbases don't use vin normally
for (unsigned int i = 0; i < vin.size(); i++)
{
const CTxOut& prev = GetOutputFor(vin[i], mapInputs);
vector<vector<unsigned char> > vSolutions;
txnouttype whichType;
// get the scriptPubKey corresponding to this input:
const CScript& prevScript = prev.scriptPubKey;
if (!Solver(prevScript, whichType, vSolutions))
return false;
int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions);
if (nArgsExpected < 0)
return false;
// Transactions with extra stuff in their scriptSigs are
// non-standard. Note that this EvalScript() call will
// be quick, because if there are any operations
// beside "push data" in the scriptSig the
// IsStandard() call returns false
vector<vector<unsigned char> > stack;
if (!EvalScript(stack, vin[i].scriptSig, *this, i, 0))
return false;
if (whichType == TX_SCRIPTHASH)
{
if (stack.empty())
return false;
CScript subscript(stack.back().begin(), stack.back().end());
vector<vector<unsigned char> > vSolutions2;
txnouttype whichType2;
if (!Solver(subscript, whichType2, vSolutions2))
return false;
if (whichType2 == TX_SCRIPTHASH)
return false;
int tmpExpected;
tmpExpected = ScriptSigArgsExpected(whichType2, vSolutions2);
if (tmpExpected < 0)
return false;
nArgsExpected += tmpExpected;
}
if (stack.size() != (unsigned int)nArgsExpected)
return false;
}
return true;
}
unsigned int
CTransaction::GetLegacySigOpCount() const
{
unsigned int nSigOps = 0;
BOOST_FOREACH(const CTxIn& txin, vin)
{
nSigOps += txin.scriptSig.GetSigOpCount(false);
}
BOOST_FOREACH(const CTxOut& txout, vout)
{
nSigOps += txout.scriptPubKey.GetSigOpCount(false);
}
return nSigOps;
}
int CMerkleTx::SetMerkleBranch(const CBlock* pblock)
{
if (fClient)
{
if (hashBlock == 0)
return 0;
}
else
{
CBlock blockTmp;
if (pblock == NULL)
{
// Load the block this tx is in
CTxIndex txindex;
if (!CTxDB("r").ReadTxIndex(GetHash(), txindex))
return 0;
if (!blockTmp.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos))
return 0;
pblock = &blockTmp;
}
// Update the tx's hashBlock
hashBlock = pblock->GetHash();
// Locate the transaction
for (nIndex = 0; nIndex < (int)pblock->vtx.size(); nIndex++)
if (pblock->vtx[nIndex] == *(CTransaction*)this)
break;
if (nIndex == (int)pblock->vtx.size())
{
vMerkleBranch.clear();
nIndex = -1;
printf("ERROR: SetMerkleBranch() : couldn't find tx in block\n");
return 0;
}
// Fill in merkle branch
vMerkleBranch = pblock->GetMerkleBranch(nIndex);
}
// Is the tx in a block that's in the main chain
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi == mapBlockIndex.end())
return 0;
CBlockIndex* pindex = (*mi).second;
if (!pindex || !pindex->IsInMainChain())
return 0;
return pindexBest->nHeight - pindex->nHeight + 1;
}
bool CTransaction::CheckTransaction() const
{
// Basic checks that don't depend on any context
if (vin.empty())
return DoS(10, error("CTransaction::CheckTransaction() : vin empty"));
if (vout.empty())
return DoS(10, error("CTransaction::CheckTransaction() : vout empty"));
// Size limits
if (::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE)
return DoS(100, error("CTransaction::CheckTransaction() : size limits failed"));
// Check for negative or overflow output values
int64 nValueOut = 0;
BOOST_FOREACH(const CTxOut& txout, vout)
{
if (txout.nValue < 0)
return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue negative"));
if (txout.nValue > MAX_MONEY)
return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue too high"));
nValueOut += txout.nValue;
if (!MoneyRange(nValueOut))
return DoS(100, error("CTransaction::CheckTransaction() : txout total out of range"));
}
// Check for duplicate inputs
set<COutPoint> vInOutPoints;
BOOST_FOREACH(const CTxIn& txin, vin)
{
if (vInOutPoints.count(txin.prevout))
return false;
vInOutPoints.insert(txin.prevout);
}
if (IsCoinBase())
{
if (vin[0].scriptSig.size() < 2 || vin[0].scriptSig.size() > 100)
return DoS(100, error("CTransaction::CheckTransaction() : coinbase script size"));
}
else
{
BOOST_FOREACH(const CTxIn& txin, vin)
if (txin.prevout.IsNull())
return DoS(10, error("CTransaction::CheckTransaction() : prevout is null"));
}
return true;
}
bool CTxMemPool::accept(CTxDB& txdb, CTransaction &tx, bool fCheckInputs,
bool* pfMissingInputs)
{
if (pfMissingInputs)
*pfMissingInputs = false;
if (!tx.CheckTransaction())
return error("CTxMemPool::accept() : CheckTransaction failed");
// Coinbase is only valid in a block, not as a loose transaction
if (tx.IsCoinBase())
return tx.DoS(100, error("CTxMemPool::accept() : coinbase as individual tx"));
// To help v0.1.5 clients who would see it as a negative number
if ((int64)tx.nLockTime > std::numeric_limits<int>::max())
return error("CTxMemPool::accept() : not accepting nLockTime beyond 2038 yet");
// Rather not work on nonstandard transactions (unless -testnet)
if (!fTestNet && !tx.IsStandard())
return error("CTxMemPool::accept() : nonstandard transaction type");
// Do we already have it?
uint256 hash = tx.GetHash();
{
LOCK(cs);
if (mapTx.count(hash))
return false;
}
if (fCheckInputs)
if (txdb.ContainsTx(hash))
return false;
// Check for conflicts with in-memory transactions
CTransaction* ptxOld = NULL;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
if (mapNextTx.count(outpoint))
{
// Disable replacement feature for now
return false;
// Allow replacing with a newer version of the same transaction
if (i != 0)
return false;
ptxOld = mapNextTx[outpoint].ptx;
if (ptxOld->IsFinal())
return false;
if (!tx.IsNewerThan(*ptxOld))
return false;
for (unsigned int i = 0; i < tx.vin.size(); i++)
{
COutPoint outpoint = tx.vin[i].prevout;
if (!mapNextTx.count(outpoint) || mapNextTx[outpoint].ptx != ptxOld)
return false;
}
break;
}
}
if (fCheckInputs)
{
MapPrevTx mapInputs;
map<uint256, CTxIndex> mapUnused;
bool fInvalid = false;
if (!tx.FetchInputs(txdb, mapUnused, false, false, mapInputs, fInvalid))
{
if (fInvalid)
return error("CTxMemPool::accept() : FetchInputs found invalid tx %s", hash.ToString().substr(0,10).c_str());
if (pfMissingInputs)
*pfMissingInputs = true;
return false;
}
// Check for non-standard pay-to-script-hash in inputs
if (!tx.AreInputsStandard(mapInputs) && !fTestNet)
return error("CTxMemPool::accept() : nonstandard transaction input");
// Note: if you modify this code to accept non-standard transactions, then
// you should add code here to check that the transaction does a
// reasonable number of ECDSA signature verifications.
int64 nFees = tx.GetValueIn(mapInputs)-tx.GetValueOut();
unsigned int nSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
// Don't accept it if it can't get into a block
if (nFees < tx.GetMinFee(1000, true, GMF_RELAY))
return error("CTxMemPool::accept() : not enough fees");
// Continuously rate-limit free transactions
// This mitigates 'penny-flooding' -- sending thousands of free transactions just to
// be annoying or make other's transactions take longer to confirm.
if (nFees < MIN_RELAY_TX_FEE)
{
static CCriticalSection cs;
static double dFreeCount;
static int64 nLastTime;
int64 nNow = GetTime();
{
LOCK(cs);
// Use an exponentially decaying ~10-minute window:
dFreeCount *= pow(1.0 - 1.0/600.0, (double)(nNow - nLastTime));
nLastTime = nNow;
// -limitfreerelay unit is thousand-bytes-per-minute
// At default rate it would take over a month to fill 1GB
if (dFreeCount > GetArg("-limitfreerelay", 15)*10*1000 && !IsFromMe(tx))
return error("CTxMemPool::accept() : free transaction rejected by rate limiter");
if (fDebug)
printf("Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;
}
}
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!tx.ConnectInputs(mapInputs, mapUnused, CDiskTxPos(1,1,1), pindexBest, false, false))
{
return error("CTxMemPool::accept() : ConnectInputs failed %s", hash.ToString().substr(0,10).c_str());
}
}
// Store transaction in memory
{
LOCK(cs);
if (ptxOld)
{
printf("CTxMemPool::accept() : replacing tx %s with new version\n", ptxOld->GetHash().ToString().c_str());
remove(*ptxOld);
}
addUnchecked(hash, tx);
}
///// are we sure this is ok when loading transactions or restoring block txes
// If updated, erase old tx from wallet
if (ptxOld)
EraseFromWallets(ptxOld->GetHash());
printf("CTxMemPool::accept() : accepted %s (poolsz %u)\n",
hash.ToString().substr(0,10).c_str(),
mapTx.size());
return true;
}
bool CTransaction::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs, bool* pfMissingInputs)
{
return mempool.accept(txdb, *this, fCheckInputs, pfMissingInputs);
}
bool CTxMemPool::addUnchecked(const uint256& hash, CTransaction &tx)
{
// Add to memory pool without checking anything. Don't call this directly,
// call CTxMemPool::accept to properly check the transaction first.
{
mapTx[hash] = tx;
for (unsigned int i = 0; i < tx.vin.size(); i++)
mapNextTx[tx.vin[i].prevout] = CInPoint(&mapTx[hash], i);
nTransactionsUpdated++;
}
return true;
}
bool CTxMemPool::remove(CTransaction &tx)
{
// Remove transaction from memory pool
{
LOCK(cs);
uint256 hash = tx.GetHash();
if (mapTx.count(hash))
{
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapNextTx.erase(txin.prevout);
mapTx.erase(hash);
nTransactionsUpdated++;
}
}
return true;
}
void CTxMemPool::queryHashes(std::vector<uint256>& vtxid)
{
vtxid.clear();
LOCK(cs);
vtxid.reserve(mapTx.size());
for (map<uint256, CTransaction>::iterator mi = mapTx.begin(); mi != mapTx.end(); ++mi)
vtxid.push_back((*mi).first);
}
int CMerkleTx::GetDepthInMainChain(CBlockIndex* &pindexRet) const
{
if (hashBlock == 0 || nIndex == -1)
return 0;
// Find the block it claims to be in
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock);
if (mi == mapBlockIndex.end())
return 0;
CBlockIndex* pindex = (*mi).second;
if (!pindex || !pindex->IsInMainChain())
return 0;
// Make sure the merkle branch connects to this block
if (!fMerkleVerified)
{
if (CBlock::CheckMerkleBranch(GetHash(), vMerkleBranch, nIndex) != pindex->hashMerkleRoot)
return 0;
fMerkleVerified = true;
}
pindexRet = pindex;
return pindexBest->nHeight - pindex->nHeight + 1;
}
int CMerkleTx::GetBlocksToMaturity() const
{
if (!IsCoinBase())
return 0;
return max(0, (COINBASE_MATURITY+15) - GetDepthInMainChain());
}
bool CMerkleTx::AcceptToMemoryPool(CTxDB& txdb, bool fCheckInputs)
{
if (fClient)
{
if (!IsInMainChain() && !ClientConnectInputs())
return false;
return CTransaction::AcceptToMemoryPool(txdb, false);
}
else
{
return CTransaction::AcceptToMemoryPool(txdb, fCheckInputs);
}
}
bool CMerkleTx::AcceptToMemoryPool()
{
CTxDB txdb("r");
return AcceptToMemoryPool(txdb);
}
bool CWalletTx::AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs)
{
{
LOCK(mempool.cs);
// Add previous supporting transactions first
BOOST_FOREACH(CMerkleTx& tx, vtxPrev)
{
if (!tx.IsCoinBase())
{
uint256 hash = tx.GetHash();
if (!mempool.exists(hash) && !txdb.ContainsTx(hash))
tx.AcceptToMemoryPool(txdb, fCheckInputs);
}
}
return AcceptToMemoryPool(txdb, fCheckInputs);
}
return false;
}
bool CWalletTx::AcceptWalletTransaction()
{
CTxDB txdb("r");
return AcceptWalletTransaction(txdb);
}
int CTxIndex::GetDepthInMainChain() const
{
// Read block header
CBlock block;
if (!block.ReadFromDisk(pos.nFile, pos.nBlockPos, false))
return 0;
// Find the block in the index
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(block.GetHash());
if (mi == mapBlockIndex.end())
return 0;
CBlockIndex* pindex = (*mi).second;
if (!pindex || !pindex->IsInMainChain())
return 0;
return 1 + nBestHeight - pindex->nHeight;
}
// Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock)
{
{
LOCK(cs_main);
{
LOCK(mempool.cs);
if (mempool.exists(hash))
{
tx = mempool.lookup(hash);
return true;
}
}
CTxDB txdb("r");
CTxIndex txindex;
if (tx.ReadFromDisk(txdb, COutPoint(hash, 0), txindex))
{
CBlock block;
if (block.ReadFromDisk(txindex.pos.nFile, txindex.pos.nBlockPos, false))
hashBlock = block.GetHash();
return true;
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////////
//
// CBlock and CBlockIndex
//
bool CBlock::ReadFromDisk(const CBlockIndex* pindex, bool fReadTransactions)
{
if (!fReadTransactions)
{
*this = pindex->GetBlockHeader();
return true;
}
if (!ReadFromDisk(pindex->nFile, pindex->nBlockPos, fReadTransactions))
return false;
if (GetHash() != pindex->GetBlockHash())
return error("CBlock::ReadFromDisk() : GetHash() doesn't match index");
return true;
}
uint256 static GetOrphanRoot(const CBlock* pblock)
{
// Work back to the first block in the orphan chain
while (mapOrphanBlocks.count(pblock->hashPrevBlock))
pblock = mapOrphanBlocks[pblock->hashPrevBlock];
return pblock->GetHash();
}
int64 static GetBlockValue(int nHeight, int64 nFees)
{
int64 nSubsidy = 1 * COIN;
return nSubsidy + nFees;
}
static const int64 nTargetTimespan = 1 * 24 * 60 * 60; // FooCoin: 1 days
static const int64 nTargetSpacing = 120; // FooCoin: 2 minute blocks
static const int64 nInterval = nTargetTimespan / nTargetSpacing;
// Thanks: Balthazar for suggesting the following fix
// https://bitcointalk.org/index.php?topic=182430.msg1904506#msg1904506
static const int64 nReTargetHistoryFact = 4; // look at 4 times the retarget
// interval into the block history
//
// minimum amount of work that could possibly be required nTime after
// minimum work required was nBase
//
unsigned int ComputeMinWork(unsigned int nBase, int64 nTime)
{
// Testnet has min-difficulty blocks
// after nTargetSpacing*2 time between blocks:
if (fTestNet && nTime > nTargetSpacing*2)
return bnProofOfWorkLimit.GetCompact();
CBigNum bnResult;
bnResult.SetCompact(nBase);
while (nTime > 0 && bnResult < bnProofOfWorkLimit)
{
// Maximum 400% adjustment...
bnResult *= 4;
// ... in best-case exactly 4-times-normal target time
nTime -= nTargetTimespan*4;
}
if (bnResult > bnProofOfWorkLimit)
bnResult = bnProofOfWorkLimit;
return bnResult.GetCompact();
}
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlock *pblock)
{
unsigned int nProofOfWorkLimit = bnProofOfWorkLimit.GetCompact();
// Genesis block
if (pindexLast == NULL)
return nProofOfWorkLimit;
// Only change once per interval
if ((pindexLast->nHeight+1) % nInterval != 0)
{
// Special difficulty rule for testnet:
if (fTestNet)
{
// If the new block's timestamp is more than 2* 10 minutes
// then allow mining of a min-difficulty block.
if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
return nProofOfWorkLimit;
else
{
// Return the last non-special-min-difficulty-rules-block
const CBlockIndex* pindex = pindexLast;
while (pindex->pprev && pindex->nHeight % nInterval != 0 && pindex->nBits == nProofOfWorkLimit)
pindex = pindex->pprev;
return pindex->nBits;
}
}
return pindexLast->nBits;
}
// Litecoin: This fixes an issue where a 51% attack can change difficulty at will.
// Go back the full period unless it's the first retarget after genesis. Code courtesy of Art Forz
int blockstogoback = nInterval-1;
if ((pindexLast->nHeight+1) != nInterval)
blockstogoback = nInterval;
if (pindexLast->nHeight > COINFIX1_BLOCK) {
blockstogoback = nReTargetHistoryFact * nInterval;
}
// Go back by what we want to be nReTargetHistoryFact*nInterval blocks
const CBlockIndex* pindexFirst = pindexLast;
for (int i = 0; pindexFirst && i < blockstogoback; i++)
pindexFirst = pindexFirst->pprev;
assert(pindexFirst);
// Limit adjustment step
int64 nActualTimespan = 0;
if (pindexLast->nHeight > COINFIX1_BLOCK)
// obtain average actual timespan
nActualTimespan = (pindexLast->GetBlockTime() - pindexFirst->GetBlockTime())/nReTargetHistoryFact;
else
nActualTimespan = pindexLast->GetBlockTime() - pindexFirst->GetBlockTime();
printf(" nActualTimespan = %"PRI64d" before bounds\n", nActualTimespan);
if (nActualTimespan < nTargetTimespan/4)
nActualTimespan = nTargetTimespan/4;
if (nActualTimespan > nTargetTimespan*4)
nActualTimespan = nTargetTimespan*4;
// Retarget
CBigNum bnNew;
bnNew.SetCompact(pindexLast->nBits);
bnNew *= nActualTimespan;
bnNew /= nTargetTimespan;
if (bnNew > bnProofOfWorkLimit)
bnNew = bnProofOfWorkLimit;
/// debug print
printf("GetNextWorkRequired RETARGET\n");
printf("nTargetTimespan = %"PRI64d" nActualTimespan = %"PRI64d"\n", nTargetTimespan, nActualTimespan);
printf("Before: %08x %s\n", pindexLast->nBits, CBigNum().SetCompact(pindexLast->nBits).getuint256().ToString().c_str());
printf("After: %08x %s\n", bnNew.GetCompact(), bnNew.getuint256().ToString().c_str());
return bnNew.GetCompact();
}
bool CheckProofOfWork(uint256 hash, unsigned int nBits)
{
CBigNum bnTarget;
bnTarget.SetCompact(nBits);
// Check range
if (bnTarget <= 0 || bnTarget > bnProofOfWorkLimit)
return error("CheckProofOfWork() : nBits below minimum work");
// Check proof of work matches claimed amount
if (hash > bnTarget.getuint256())
return error("CheckProofOfWork() : hash doesn't match nBits");
return true;
}
// Return maximum amount of blocks that other nodes claim to have
int GetNumBlocksOfPeers()
{
return std::max(cPeerBlockCounts.median(), Checkpoints::GetTotalBlocksEstimate());
}
bool IsInitialBlockDownload()
{
if (pindexBest == NULL || nBestHeight < Checkpoints::GetTotalBlocksEstimate())
return true;
static int64 nLastUpdate;
static CBlockIndex* pindexLastBest;
if (pindexBest != pindexLastBest)
{
pindexLastBest = pindexBest;
nLastUpdate = GetTime();
}
return (GetTime() - nLastUpdate < 10 &&
pindexBest->GetBlockTime() < GetTime() - 24 * 60 * 60);
}
void static InvalidChainFound(CBlockIndex* pindexNew)
{
if (pindexNew->bnChainWork > bnBestInvalidWork)
{
bnBestInvalidWork = pindexNew->bnChainWork;
CTxDB().WriteBestInvalidWork(bnBestInvalidWork);
uiInterface.NotifyBlocksChanged();
}
printf("InvalidChainFound: invalid block=%s height=%d work=%s date=%s\n",
pindexNew->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->nHeight,
pindexNew->bnChainWork.ToString().c_str(), DateTimeStrFormat("%x %H:%M:%S",
pindexNew->GetBlockTime()).c_str());
printf("InvalidChainFound: current best=%s height=%d work=%s date=%s\n",
hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(),
DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
printf("InvalidChainFound: WARNING: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n");
}
void CBlock::UpdateTime(const CBlockIndex* pindexPrev)
{
nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
// Updating time can change work required on testnet:
if (fTestNet)
nBits = GetNextWorkRequired(pindexPrev, this);
}
bool CTransaction::DisconnectInputs(CTxDB& txdb)
{
// Relinquish previous transactions' spent pointers
if (!IsCoinBase())
{
BOOST_FOREACH(const CTxIn& txin, vin)
{
COutPoint prevout = txin.prevout;
// Get prev txindex from disk
CTxIndex txindex;
if (!txdb.ReadTxIndex(prevout.hash, txindex))
return error("DisconnectInputs() : ReadTxIndex failed");
if (prevout.n >= txindex.vSpent.size())
return error("DisconnectInputs() : prevout.n out of range");
// Mark outpoint as not spent
txindex.vSpent[prevout.n].SetNull();
// Write back
if (!txdb.UpdateTxIndex(prevout.hash, txindex))
return error("DisconnectInputs() : UpdateTxIndex failed");
}
}
// Remove transaction from index
// This can fail if a duplicate of this transaction was in a chain that got
// reorganized away. This is only possible if this transaction was completely
// spent, so erasing it would be a no-op anway.
txdb.EraseTxIndex(*this);
return true;
}
bool CTransaction::FetchInputs(CTxDB& txdb, const map<uint256, CTxIndex>& mapTestPool,
bool fBlock, bool fMiner, MapPrevTx& inputsRet, bool& fInvalid)
{
// FetchInputs can return false either because we just haven't seen some inputs
// (in which case the transaction should be stored as an orphan)
// or because the transaction is malformed (in which case the transaction should
// be dropped). If tx is definitely invalid, fInvalid will be set to true.
fInvalid = false;
if (IsCoinBase())
return true; // Coinbase transactions have no inputs to fetch.
for (unsigned int i = 0; i < vin.size(); i++)
{
COutPoint prevout = vin[i].prevout;
if (inputsRet.count(prevout.hash))
continue; // Got it already
// Read txindex
CTxIndex& txindex = inputsRet[prevout.hash].first;
bool fFound = true;
if ((fBlock || fMiner) && mapTestPool.count(prevout.hash))
{
// Get txindex from current proposed changes
txindex = mapTestPool.find(prevout.hash)->second;
}
else
{
// Read txindex from txdb
fFound = txdb.ReadTxIndex(prevout.hash, txindex);
}
if (!fFound && (fBlock || fMiner))
return fMiner ? false : error("FetchInputs() : %s prev tx %s index entry not found", GetHash().ToString().substr(0,10).c_str(), prevout.hash.ToString().substr(0,10).c_str());
// Read txPrev
CTransaction& txPrev = inputsRet[prevout.hash].second;
if (!fFound || txindex.pos == CDiskTxPos(1,1,1))
{
// Get prev tx from single transactions in memory
{
LOCK(mempool.cs);
if (!mempool.exists(prevout.hash))
return error("FetchInputs() : %s mempool Tx prev not found %s", GetHash().ToString().substr(0,10).c_str(), prevout.hash.ToString().substr(0,10).c_str());
txPrev = mempool.lookup(prevout.hash);
}
if (!fFound)
txindex.vSpent.resize(txPrev.vout.size());
}
else
{
// Get prev tx from disk
if (!txPrev.ReadFromDisk(txindex.pos))
return error("FetchInputs() : %s ReadFromDisk prev tx %s failed", GetHash().ToString().substr(0,10).c_str(), prevout.hash.ToString().substr(0,10).c_str());
}
}
// Make sure all prevout.n's are valid:
for (unsigned int i = 0; i < vin.size(); i++)
{
const COutPoint prevout = vin[i].prevout;
assert(inputsRet.count(prevout.hash) != 0);
const CTxIndex& txindex = inputsRet[prevout.hash].first;
const CTransaction& txPrev = inputsRet[prevout.hash].second;
if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size())
{
// Revisit this if/when transaction replacement is implemented and allows
// adding inputs:
fInvalid = true;
return DoS(100, error("FetchInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str()));
}
}
return true;
}
const CTxOut& CTransaction::GetOutputFor(const CTxIn& input, const MapPrevTx& inputs) const
{
MapPrevTx::const_iterator mi = inputs.find(input.prevout.hash);
if (mi == inputs.end())
throw std::runtime_error("CTransaction::GetOutputFor() : prevout.hash not found");
const CTransaction& txPrev = (mi->second).second;
if (input.prevout.n >= txPrev.vout.size())
throw std::runtime_error("CTransaction::GetOutputFor() : prevout.n out of range");
return txPrev.vout[input.prevout.n];
}
int64 CTransaction::GetValueIn(const MapPrevTx& inputs) const
{
if (IsCoinBase())
return 0;
int64 nResult = 0;
for (unsigned int i = 0; i < vin.size(); i++)
{
nResult += GetOutputFor(vin[i], inputs).nValue;
}
return nResult;
}
unsigned int CTransaction::GetP2SHSigOpCount(const MapPrevTx& inputs) const
{
if (IsCoinBase())
return 0;
unsigned int nSigOps = 0;
for (unsigned int i = 0; i < vin.size(); i++)
{
const CTxOut& prevout = GetOutputFor(vin[i], inputs);
if (prevout.scriptPubKey.IsPayToScriptHash())
nSigOps += prevout.scriptPubKey.GetSigOpCount(vin[i].scriptSig);
}
return nSigOps;
}
bool CTransaction::ConnectInputs(MapPrevTx inputs,
map<uint256, CTxIndex>& mapTestPool, const CDiskTxPos& posThisTx,
const CBlockIndex* pindexBlock, bool fBlock, bool fMiner, bool fStrictPayToScriptHash)
{
// Take over previous transactions' spent pointers
// fBlock is true when this is called from AcceptBlock when a new best-block is added to the blockchain
// fMiner is true when called from the internal foocoin miner
// ... both are false when called from CTransaction::AcceptToMemoryPool
if (!IsCoinBase())
{
int64 nValueIn = 0;
int64 nFees = 0;
for (unsigned int i = 0; i < vin.size(); i++)
{
COutPoint prevout = vin[i].prevout;
assert(inputs.count(prevout.hash) > 0);
CTxIndex& txindex = inputs[prevout.hash].first;
CTransaction& txPrev = inputs[prevout.hash].second;
if (prevout.n >= txPrev.vout.size() || prevout.n >= txindex.vSpent.size())
return DoS(100, error("ConnectInputs() : %s prevout.n out of range %d %d %d prev tx %s\n%s", GetHash().ToString().substr(0,10).c_str(), prevout.n, txPrev.vout.size(), txindex.vSpent.size(), prevout.hash.ToString().substr(0,10).c_str(), txPrev.ToString().c_str()));
// If prev is coinbase, check that it's matured
if (txPrev.IsCoinBase())
for (const CBlockIndex* pindex = pindexBlock; pindex && pindexBlock->nHeight - pindex->nHeight < COINBASE_MATURITY; pindex = pindex->pprev)
if (pindex->nBlockPos == txindex.pos.nBlockPos && pindex->nFile == txindex.pos.nFile)
return error("ConnectInputs() : tried to spend coinbase at depth %d", pindexBlock->nHeight - pindex->nHeight);
// Check for negative or overflow input values
nValueIn += txPrev.vout[prevout.n].nValue;
if (!MoneyRange(txPrev.vout[prevout.n].nValue) || !MoneyRange(nValueIn))
return DoS(100, error("ConnectInputs() : txin values out of range"));
}
// The first loop above does all the inexpensive checks.
// Only if ALL inputs pass do we perform expensive ECDSA signature checks.
// Helps prevent CPU exhaustion attacks.
for (unsigned int i = 0; i < vin.size(); i++)
{
COutPoint prevout = vin[i].prevout;
assert(inputs.count(prevout.hash) > 0);
CTxIndex& txindex = inputs[prevout.hash].first;
CTransaction& txPrev = inputs[prevout.hash].second;
// Check for conflicts (double-spend)
// This doesn't trigger the DoS code on purpose; if it did, it would make it easier
// for an attacker to attempt to split the network.
if (!txindex.vSpent[prevout.n].IsNull())
return fMiner ? false : error("ConnectInputs() : %s prev tx already used at %s", GetHash().ToString().substr(0,10).c_str(), txindex.vSpent[prevout.n].ToString().c_str());
// Skip ECDSA signature verification when connecting blocks (fBlock=true)
// before the last blockchain checkpoint. This is safe because block merkle hashes are
// still computed and checked, and any change will be caught at the next checkpoint.
if (!(fBlock && (nBestHeight < Checkpoints::GetTotalBlocksEstimate())))
{
// Verify signature
if (!VerifySignature(txPrev, *this, i, fStrictPayToScriptHash, 0))
{
// only during transition phase for P2SH: do not invoke anti-DoS code for
// potentially old clients relaying bad P2SH transactions
if (fStrictPayToScriptHash && VerifySignature(txPrev, *this, i, false, 0))
return error("ConnectInputs() : %s P2SH VerifySignature failed", GetHash().ToString().substr(0,10).c_str());
return DoS(100,error("ConnectInputs() : %s VerifySignature failed", GetHash().ToString().substr(0,10).c_str()));
}
}
// Mark outpoints as spent
txindex.vSpent[prevout.n] = posThisTx;
// Write back
if (fBlock || fMiner)
{
mapTestPool[prevout.hash] = txindex;
}
}
if (nValueIn < GetValueOut())
return DoS(100, error("ConnectInputs() : %s value in < value out", GetHash().ToString().substr(0,10).c_str()));
// Tally transaction fees
int64 nTxFee = nValueIn - GetValueOut();
if (nTxFee < 0)
return DoS(100, error("ConnectInputs() : %s nTxFee < 0", GetHash().ToString().substr(0,10).c_str()));
nFees += nTxFee;
if (!MoneyRange(nFees))
return DoS(100, error("ConnectInputs() : nFees out of range"));
}
return true;
}
bool CTransaction::ClientConnectInputs()
{
if (IsCoinBase())
return false;
// Take over previous transactions' spent pointers
{
LOCK(mempool.cs);
int64 nValueIn = 0;
for (unsigned int i = 0; i < vin.size(); i++)
{
// Get prev tx from single transactions in memory
COutPoint prevout = vin[i].prevout;
if (!mempool.exists(prevout.hash))
return false;
CTransaction& txPrev = mempool.lookup(prevout.hash);
if (prevout.n >= txPrev.vout.size())
return false;
// Verify signature
if (!VerifySignature(txPrev, *this, i, true, 0))
return error("ConnectInputs() : VerifySignature failed");
///// this is redundant with the mempool.mapNextTx stuff,
///// not sure which I want to get rid of
///// this has to go away now that posNext is gone
// // Check for conflicts
// if (!txPrev.vout[prevout.n].posNext.IsNull())
// return error("ConnectInputs() : prev tx already used");
//
// // Flag outpoints as used
// txPrev.vout[prevout.n].posNext = posThisTx;
nValueIn += txPrev.vout[prevout.n].nValue;
if (!MoneyRange(txPrev.vout[prevout.n].nValue) || !MoneyRange(nValueIn))
return error("ClientConnectInputs() : txin values out of range");
}
if (GetValueOut() > nValueIn)
return false;
}
return true;
}
bool CBlock::DisconnectBlock(CTxDB& txdb, CBlockIndex* pindex)
{
// Disconnect in reverse order
for (int i = vtx.size()-1; i >= 0; i--)
if (!vtx[i].DisconnectInputs(txdb))
return false;
// Update block index on disk without changing it in memory.
// The memory index structure will be changed after the db commits.
if (pindex->pprev)
{
CDiskBlockIndex blockindexPrev(pindex->pprev);
blockindexPrev.hashNext = 0;
if (!txdb.WriteBlockIndex(blockindexPrev))
return error("DisconnectBlock() : WriteBlockIndex failed");
}
return true;
}
bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex)
{
// Check it again in case a previous version let a bad block in
if (!CheckBlock())
return false;
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
// unless those are already completely spent.
// If such overwrites are allowed, coinbases and transactions depending upon those
// can be duplicated to remove the ability to spend the first instance -- even after
// being sent to another address.
// See BIP30 and http://r6.ca/blog/20120206T005236Z.html for more information.
// This logic is not necessary for memory pool transactions, as AcceptToMemoryPool
// already refuses previously-known transaction id's entirely.
// This rule applies to all blocks whose timestamp is after October 1, 2012, 0:00 UTC.
int64 nBIP30SwitchTime = 1349049600;
bool fEnforceBIP30 = (pindex->nTime > nBIP30SwitchTime);
// BIP16 didn't become active until October 1 2012
int64 nBIP16SwitchTime = 1349049600;
bool fStrictPayToScriptHash = (pindex->nTime >= nBIP16SwitchTime);
//// issue here: it doesn't know the version
unsigned int nTxPos = pindex->nBlockPos + ::GetSerializeSize(CBlock(), SER_DISK, CLIENT_VERSION) - 1 + GetSizeOfCompactSize(vtx.size());
map<uint256, CTxIndex> mapQueuedChanges;
int64 nFees = 0;
unsigned int nSigOps = 0;
BOOST_FOREACH(CTransaction& tx, vtx)
{
uint256 hashTx = tx.GetHash();
if (fEnforceBIP30) {
CTxIndex txindexOld;
if (txdb.ReadTxIndex(hashTx, txindexOld)) {
BOOST_FOREACH(CDiskTxPos &pos, txindexOld.vSpent)
if (pos.IsNull())
return false;
}
}
nSigOps += tx.GetLegacySigOpCount();
if (nSigOps > MAX_BLOCK_SIGOPS)
return DoS(100, error("ConnectBlock() : too many sigops"));
CDiskTxPos posThisTx(pindex->nFile, pindex->nBlockPos, nTxPos);
nTxPos += ::GetSerializeSize(tx, SER_DISK, CLIENT_VERSION);
MapPrevTx mapInputs;
if (!tx.IsCoinBase())
{
bool fInvalid;
if (!tx.FetchInputs(txdb, mapQueuedChanges, true, false, mapInputs, fInvalid))
return false;
if (fStrictPayToScriptHash)
{
// Add in sigops done by pay-to-script-hash inputs;
// this is to prevent a "rogue miner" from creating
// an incredibly-expensive-to-validate block.
nSigOps += tx.GetP2SHSigOpCount(mapInputs);
if (nSigOps > MAX_BLOCK_SIGOPS)
return DoS(100, error("ConnectBlock() : too many sigops"));
}
nFees += tx.GetValueIn(mapInputs)-tx.GetValueOut();
if (!tx.ConnectInputs(mapInputs, mapQueuedChanges, posThisTx, pindex, true, false, fStrictPayToScriptHash))
return false;
}
mapQueuedChanges[hashTx] = CTxIndex(posThisTx, tx.vout.size());
}
// Write queued txindex changes
for (map<uint256, CTxIndex>::iterator mi = mapQueuedChanges.begin(); mi != mapQueuedChanges.end(); ++mi)
{
if (!txdb.UpdateTxIndex((*mi).first, (*mi).second))
return error("ConnectBlock() : UpdateTxIndex failed");
}
if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees))
return false;
// Update block index on disk without changing it in memory.
// The memory index structure will be changed after the db commits.
if (pindex->pprev)
{
CDiskBlockIndex blockindexPrev(pindex->pprev);
blockindexPrev.hashNext = pindex->GetBlockHash();
if (!txdb.WriteBlockIndex(blockindexPrev))
return error("ConnectBlock() : WriteBlockIndex failed");
}
// Watch for transactions paying to me
BOOST_FOREACH(CTransaction& tx, vtx)
SyncWithWallets(tx, this, true);
return true;
}
bool static Reorganize(CTxDB& txdb, CBlockIndex* pindexNew)
{
printf("REORGANIZE\n");
// Find the fork
CBlockIndex* pfork = pindexBest;
CBlockIndex* plonger = pindexNew;
while (pfork != plonger)
{
while (plonger->nHeight > pfork->nHeight)
if (!(plonger = plonger->pprev))
return error("Reorganize() : plonger->pprev is null");
if (pfork == plonger)
break;
if (!(pfork = pfork->pprev))
return error("Reorganize() : pfork->pprev is null");
}
// List of what to disconnect
vector<CBlockIndex*> vDisconnect;
for (CBlockIndex* pindex = pindexBest; pindex != pfork; pindex = pindex->pprev)
vDisconnect.push_back(pindex);
// List of what to connect
vector<CBlockIndex*> vConnect;
for (CBlockIndex* pindex = pindexNew; pindex != pfork; pindex = pindex->pprev)
vConnect.push_back(pindex);
reverse(vConnect.begin(), vConnect.end());
printf("REORGANIZE: Disconnect %i blocks; %s..%s\n", vDisconnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexBest->GetBlockHash().ToString().substr(0,20).c_str());
printf("REORGANIZE: Connect %i blocks; %s..%s\n", vConnect.size(), pfork->GetBlockHash().ToString().substr(0,20).c_str(), pindexNew->GetBlockHash().ToString().substr(0,20).c_str());
// Disconnect shorter branch
vector<CTransaction> vResurrect;
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
{
CBlock block;
if (!block.ReadFromDisk(pindex))
return error("Reorganize() : ReadFromDisk for disconnect failed");
if (!block.DisconnectBlock(txdb, pindex))
return error("Reorganize() : DisconnectBlock %s failed", pindex->GetBlockHash().ToString().substr(0,20).c_str());
// Queue memory transactions to resurrect
BOOST_FOREACH(const CTransaction& tx, block.vtx)
if (!tx.IsCoinBase())
vResurrect.push_back(tx);
}
// Connect longer branch
vector<CTransaction> vDelete;
for (unsigned int i = 0; i < vConnect.size(); i++)
{
CBlockIndex* pindex = vConnect[i];
CBlock block;
if (!block.ReadFromDisk(pindex))
return error("Reorganize() : ReadFromDisk for connect failed");
if (!block.ConnectBlock(txdb, pindex))
{
// Invalid block
return error("Reorganize() : ConnectBlock %s failed", pindex->GetBlockHash().ToString().substr(0,20).c_str());
}
// Queue memory transactions to delete
BOOST_FOREACH(const CTransaction& tx, block.vtx)
vDelete.push_back(tx);
}
if (!txdb.WriteHashBestChain(pindexNew->GetBlockHash()))
return error("Reorganize() : WriteHashBestChain failed");
// Make sure it's successfully written to disk before changing memory structure
if (!txdb.TxnCommit())
return error("Reorganize() : TxnCommit failed");
// Disconnect shorter branch
BOOST_FOREACH(CBlockIndex* pindex, vDisconnect)
if (pindex->pprev)
pindex->pprev->pnext = NULL;
// Connect longer branch
BOOST_FOREACH(CBlockIndex* pindex, vConnect)
if (pindex->pprev)
pindex->pprev->pnext = pindex;
// Resurrect memory transactions that were in the disconnected branch
BOOST_FOREACH(CTransaction& tx, vResurrect)
tx.AcceptToMemoryPool(txdb, false);
// Delete redundant memory transactions that are in the connected branch
BOOST_FOREACH(CTransaction& tx, vDelete)
mempool.remove(tx);
printf("REORGANIZE: done\n");
return true;
}
// Called from inside SetBestChain: attaches a block to the new best chain being built
bool CBlock::SetBestChainInner(CTxDB& txdb, CBlockIndex *pindexNew)
{
uint256 hash = GetHash();
// Adding to current best branch
if (!ConnectBlock(txdb, pindexNew) || !txdb.WriteHashBestChain(hash))
{
txdb.TxnAbort();
InvalidChainFound(pindexNew);
return false;
}
if (!txdb.TxnCommit())
return error("SetBestChain() : TxnCommit failed");
// Add to current best branch
pindexNew->pprev->pnext = pindexNew;
// Delete redundant memory transactions
BOOST_FOREACH(CTransaction& tx, vtx)
mempool.remove(tx);
return true;
}
bool CBlock::SetBestChain(CTxDB& txdb, CBlockIndex* pindexNew)
{
uint256 hash = GetHash();
if (!txdb.TxnBegin())
return error("SetBestChain() : TxnBegin failed");
if (pindexGenesisBlock == NULL && hash == hashGenesisBlock)
{
txdb.WriteHashBestChain(hash);
if (!txdb.TxnCommit())
return error("SetBestChain() : TxnCommit failed");
pindexGenesisBlock = pindexNew;
}
else if (hashPrevBlock == hashBestChain)
{
if (!SetBestChainInner(txdb, pindexNew))
return error("SetBestChain() : SetBestChainInner failed");
}
else
{
// the first block in the new chain that will cause it to become the new best chain
CBlockIndex *pindexIntermediate = pindexNew;
// list of blocks that need to be connected afterwards
std::vector<CBlockIndex*> vpindexSecondary;
// Reorganize is costly in terms of db load, as it works in a single db transaction.
// Try to limit how much needs to be done inside
while (pindexIntermediate->pprev && pindexIntermediate->pprev->bnChainWork > pindexBest->bnChainWork)
{
vpindexSecondary.push_back(pindexIntermediate);
pindexIntermediate = pindexIntermediate->pprev;
}
if (!vpindexSecondary.empty())
printf("Postponing %i reconnects\n", vpindexSecondary.size());
// Switch to new best branch
if (!Reorganize(txdb, pindexIntermediate))
{
txdb.TxnAbort();
InvalidChainFound(pindexNew);
return error("SetBestChain() : Reorganize failed");
}
// Connect futher blocks
BOOST_REVERSE_FOREACH(CBlockIndex *pindex, vpindexSecondary)
{
CBlock block;
if (!block.ReadFromDisk(pindex))
{
printf("SetBestChain() : ReadFromDisk failed\n");
break;
}
if (!txdb.TxnBegin()) {
printf("SetBestChain() : TxnBegin 2 failed\n");
break;
}
// errors now are not fatal, we still did a reorganisation to a new chain in a valid way
if (!block.SetBestChainInner(txdb, pindex))
break;
}
}
// Update best block in wallet (so we can detect restored wallets)
bool fIsInitialDownload = IsInitialBlockDownload();
if (!fIsInitialDownload)
{
const CBlockLocator locator(pindexNew);
::SetBestChain(locator);
}
// New best block
hashBestChain = hash;
pindexBest = pindexNew;
nBestHeight = pindexBest->nHeight;
bnBestChainWork = pindexNew->bnChainWork;
nTimeBestReceived = GetTime();
nTransactionsUpdated++;
printf("SetBestChain: new best=%s height=%d work=%s date=%s\n",
hashBestChain.ToString().substr(0,20).c_str(), nBestHeight, bnBestChainWork.ToString().c_str(),
DateTimeStrFormat("%x %H:%M:%S", pindexBest->GetBlockTime()).c_str());
// Check the version of the last 100 blocks to see if we need to upgrade:
if (!fIsInitialDownload)
{
int nUpgraded = 0;
const CBlockIndex* pindex = pindexBest;
for (int i = 0; i < 100 && pindex != NULL; i++)
{
if (pindex->nVersion > CBlock::CURRENT_VERSION)
++nUpgraded;
pindex = pindex->pprev;
}
if (nUpgraded > 0)
printf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, CBlock::CURRENT_VERSION);
// if (nUpgraded > 100/2)
// strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
// strMiscWarning = _("Warning: this version is obsolete, upgrade required");
}
std::string strCmd = GetArg("-blocknotify", "");
if (!fIsInitialDownload && !strCmd.empty())
{
boost::replace_all(strCmd, "%s", hashBestChain.GetHex());
boost::thread t(runCommand, strCmd); // thread runs free
}
return true;
}
bool CBlock::AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos)
{
// Check for duplicate
uint256 hash = GetHash();
if (mapBlockIndex.count(hash))
return error("AddToBlockIndex() : %s already exists", hash.ToString().substr(0,20).c_str());
// Construct new block index object
CBlockIndex* pindexNew = new CBlockIndex(nFile, nBlockPos, *this);
if (!pindexNew)
return error("AddToBlockIndex() : new CBlockIndex failed");
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.insert(make_pair(hash, pindexNew)).first;
pindexNew->phashBlock = &((*mi).first);
map<uint256, CBlockIndex*>::iterator miPrev = mapBlockIndex.find(hashPrevBlock);
if (miPrev != mapBlockIndex.end())
{
pindexNew->pprev = (*miPrev).second;
pindexNew->nHeight = pindexNew->pprev->nHeight + 1;
}
pindexNew->bnChainWork = (pindexNew->pprev ? pindexNew->pprev->bnChainWork : 0) + pindexNew->GetBlockWork();
CTxDB txdb;
if (!txdb.TxnBegin())
return false;
txdb.WriteBlockIndex(CDiskBlockIndex(pindexNew));
if (!txdb.TxnCommit())
return false;
// New best
if (pindexNew->bnChainWork > bnBestChainWork)
if (!SetBestChain(txdb, pindexNew))
return false;
txdb.Close();
if (pindexNew == pindexBest)
{
// Notify UI to display prev block's coinbase if it was ours
static uint256 hashPrevBestCoinBase;
UpdatedTransaction(hashPrevBestCoinBase);
hashPrevBestCoinBase = vtx[0].GetHash();
}
uiInterface.NotifyBlocksChanged();
return true;
}
bool CBlock::CheckBlock() const
{
// These are checks that are independent of context
// that can be verified before saving an orphan block.
// Size limits
if (vtx.empty() || vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE)
return DoS(100, error("CheckBlock() : size limits failed"));
// Check proof of work matches claimed amount
if (!CheckProofOfWork(GetPoWHash(), nBits))
return DoS(50, error("CheckBlock() : proof of work failed"));
// Check timestamp
if (GetBlockTime() > GetAdjustedTime() + 2 * 60 * 60)
return error("CheckBlock() : block timestamp too far in the future");
// First transaction must be coinbase, the rest must not be
if (vtx.empty() || !vtx[0].IsCoinBase())
return DoS(100, error("CheckBlock() : first tx is not coinbase"));
for (unsigned int i = 1; i < vtx.size(); i++)
if (vtx[i].IsCoinBase())
return DoS(100, error("CheckBlock() : more than one coinbase"));
// Check transactions
BOOST_FOREACH(const CTransaction& tx, vtx)
if (!tx.CheckTransaction())
return DoS(tx.nDoS, error("CheckBlock() : CheckTransaction failed"));
// Check for duplicate txids. This is caught by ConnectInputs(),
// but catching it earlier avoids a potential DoS attack:
set<uint256> uniqueTx;
BOOST_FOREACH(const CTransaction& tx, vtx)
{
uniqueTx.insert(tx.GetHash());
}
if (uniqueTx.size() != vtx.size())
return DoS(100, error("CheckBlock() : duplicate transaction"));
unsigned int nSigOps = 0;
BOOST_FOREACH(const CTransaction& tx, vtx)
{
nSigOps += tx.GetLegacySigOpCount();
}
if (nSigOps > MAX_BLOCK_SIGOPS)
return DoS(100, error("CheckBlock() : out-of-bounds SigOpCount"));
// Check merkleroot
if (hashMerkleRoot != BuildMerkleTree())
return DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
return true;
}
bool CBlock::AcceptBlock()
{
// Check for duplicate
uint256 hash = GetHash();
if (mapBlockIndex.count(hash))
return error("AcceptBlock() : block already in mapBlockIndex");
// Get prev block index
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashPrevBlock);
if (mi == mapBlockIndex.end())
return DoS(10, error("AcceptBlock() : prev block not found"));
CBlockIndex* pindexPrev = (*mi).second;
int nHeight = pindexPrev->nHeight+1;
// Check proof of work
if (nBits != GetNextWorkRequired(pindexPrev, this))
return DoS(100, error("AcceptBlock() : incorrect proof of work"));
// Check timestamp against prev
if (GetBlockTime() <= pindexPrev->GetMedianTimePast())
return error("AcceptBlock() : block's timestamp is too early");
// Check that all transactions are finalized
BOOST_FOREACH(const CTransaction& tx, vtx)
if (!tx.IsFinal(nHeight, GetBlockTime()))
return DoS(10, error("AcceptBlock() : contains a non-final transaction"));
// Check that the block chain matches the known block chain up to a checkpoint
if (!Checkpoints::CheckBlock(nHeight, hash))
return DoS(100, error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight));
// Write block to history file
if (!CheckDiskSpace(::GetSerializeSize(*this, SER_DISK, CLIENT_VERSION)))
return error("AcceptBlock() : out of disk space");
unsigned int nFile = -1;
unsigned int nBlockPos = 0;
if (!WriteToDisk(nFile, nBlockPos))
return error("AcceptBlock() : WriteToDisk failed");
if (!AddToBlockIndex(nFile, nBlockPos))
return error("AcceptBlock() : AddToBlockIndex failed");
// Relay inventory, but don't relay old inventory during initial block download
int nBlockEstimate = Checkpoints::GetTotalBlocksEstimate();
if (hashBestChain == hash)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
pnode->PushInventory(CInv(MSG_BLOCK, hash));
}
return true;
}
bool ProcessBlock(CNode* pfrom, CBlock* pblock)
{
// Check for duplicate
uint256 hash = pblock->GetHash();
if (mapBlockIndex.count(hash))
return error("ProcessBlock() : already have block %d %s", mapBlockIndex[hash]->nHeight, hash.ToString().substr(0,20).c_str());
if (mapOrphanBlocks.count(hash))
return error("ProcessBlock() : already have block (orphan) %s", hash.ToString().substr(0,20).c_str());
// Preliminary checks
if (!pblock->CheckBlock())
return error("ProcessBlock() : CheckBlock FAILED");
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(mapBlockIndex);
if (pcheckpoint && pblock->hashPrevBlock != hashBestChain)
{
// Extra checks to prevent "fill up memory by spamming with bogus blocks"
int64 deltaTime = pblock->GetBlockTime() - pcheckpoint->nTime;
if (deltaTime < 0)
{
if (pfrom)
pfrom->Misbehaving(100);
return error("ProcessBlock() : block with timestamp before last checkpoint");
}
CBigNum bnNewBlock;
bnNewBlock.SetCompact(pblock->nBits);
CBigNum bnRequired;
bnRequired.SetCompact(ComputeMinWork(pcheckpoint->nBits, deltaTime));
if (bnNewBlock > bnRequired)
{
if (pfrom)
pfrom->Misbehaving(100);
return error("ProcessBlock() : block with too little proof-of-work");
}
}
// If don't already have its previous block, shunt it off to holding area until we get it
if (!mapBlockIndex.count(pblock->hashPrevBlock))
{
printf("ProcessBlock: ORPHAN BLOCK, prev=%s\n", pblock->hashPrevBlock.ToString().substr(0,20).c_str());
CBlock* pblock2 = new CBlock(*pblock);
mapOrphanBlocks.insert(make_pair(hash, pblock2));
mapOrphanBlocksByPrev.insert(make_pair(pblock2->hashPrevBlock, pblock2));
// Ask this guy to fill in what we're missing
if (pfrom)
pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(pblock2));
return true;
}
// Store to disk
if (!pblock->AcceptBlock())
return error("ProcessBlock() : AcceptBlock FAILED");
// Recursively process any orphan blocks that depended on this one
vector<uint256> vWorkQueue;
vWorkQueue.push_back(hash);
for (unsigned int i = 0; i < vWorkQueue.size(); i++)
{
uint256 hashPrev = vWorkQueue[i];
for (multimap<uint256, CBlock*>::iterator mi = mapOrphanBlocksByPrev.lower_bound(hashPrev);
mi != mapOrphanBlocksByPrev.upper_bound(hashPrev);
++mi)
{
CBlock* pblockOrphan = (*mi).second;
if (pblockOrphan->AcceptBlock())
vWorkQueue.push_back(pblockOrphan->GetHash());
mapOrphanBlocks.erase(pblockOrphan->GetHash());
delete pblockOrphan;
}
mapOrphanBlocksByPrev.erase(hashPrev);
}
printf("ProcessBlock: ACCEPTED\n");
return true;
}
bool CheckDiskSpace(uint64 nAdditionalBytes)
{
uint64 nFreeBytesAvailable = filesystem::space(GetDataDir()).available;
// Check for nMinDiskSpace bytes (currently 50MB)
if (nFreeBytesAvailable < nMinDiskSpace + nAdditionalBytes)
{
fShutdown = true;
string strMessage = _("Warning: Disk space is low");
strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "FooCoin", CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION | CClientUIInterface::MODAL);
StartShutdown();
return false;
}
return true;
}
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode)
{
if ((nFile < 1) || (nFile == (unsigned int) -1))
return NULL;
FILE* file = fopen((GetDataDir() / strprintf("blk%04d.dat", nFile)).string().c_str(), pszMode);
if (!file)
return NULL;
if (nBlockPos != 0 && !strchr(pszMode, 'a') && !strchr(pszMode, 'w'))
{
if (fseek(file, nBlockPos, SEEK_SET) != 0)
{
fclose(file);
return NULL;
}
}
return file;
}
static unsigned int nCurrentBlockFile = 1;
FILE* AppendBlockFile(unsigned int& nFileRet)
{
nFileRet = 0;
loop
{
FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab");
if (!file)
return NULL;
if (fseek(file, 0, SEEK_END) != 0)
return NULL;
// FAT32 filesize max 4GB, fseek and ftell max 2GB, so we must stay under 2GB
if (ftell(file) < 0x7F000000 - MAX_SIZE)
{
nFileRet = nCurrentBlockFile;
return file;
}
fclose(file);
nCurrentBlockFile++;
}
}
bool LoadBlockIndex(bool fAllowNew)
{
if (fTestNet)
{
pchMessageStart[0] = 0xfb;
pchMessageStart[1] = 0xc0;
pchMessageStart[2] = 0xb8;
pchMessageStart[3] = 0xdb;
hashGenesisBlock = uint256("0xb5ecd7fd980c11bc8ee31de1c85b60970574f9eff4e260e0963a0726d92f3b88");
}
//
// Load block index
//
CTxDB txdb("cr");
if (!txdb.LoadBlockIndex())
return false;
txdb.Close();
//
// Init with genesis block
//
if (mapBlockIndex.empty())
{
if (!fAllowNew)
return false;
// Genesis block
const char* pszTimestamp = "The Physics and Astronomy Student Union at the University of Toronto is a gathering place for the finest specimens of mankind";
CTransaction txNew;
txNew.vin.resize(1);
txNew.vout.resize(1);
txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
txNew.vout[0].nValue = 0;
txNew.vout[0].scriptPubKey = CScript() << 0x0 << OP_CHECKSIG; // a privkey for that 'vanity' pubkey would be interesting ;)
CBlock block;
block.vtx.push_back(txNew);
block.hashPrevBlock = 0;
block.hashMerkleRoot = block.BuildMerkleTree();
block.nVersion = 1;
block.nTime = 1300000000; //epochtime
block.nBits = 0x1e0ffff0;
block.nNonce = 847804;
if (fTestNet)
{
block.nTime = 1300000000;
block.nNonce = 0;
}
//// debug print
printf("%s\n", block.GetHash().ToString().c_str());
printf("%s\n", hashGenesisBlock.ToString().c_str());
printf("%s\n", block.hashMerkleRoot.ToString().c_str());
assert(block.hashMerkleRoot == uint256("0xf443cfdad9cafa7435f638a6985ef240a1487f6796e2e6a95ade268bc1b73360"));
// If genesis block hash does not match, then generate new genesis hash.
if (true && block.GetHash() != hashGenesisBlock)
{
printf("Searching for genesis block...\n");
// This will figure out a valid hash and Nonce if you're
// creating a different genesis block:
uint256 hashTarget = CBigNum().SetCompact(block.nBits).getuint256();
uint256 thash;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
loop
{
scrypt_1024_1_1_256_sp(BEGIN(block.nVersion), BEGIN(thash), scratchpad);
if (thash <= hashTarget)
break;
if ((block.nNonce & 0xFFF) == 0)
{
printf("nonce %08X: hash = %s (target = %s)\n", block.nNonce, thash.ToString().c_str(), hashTarget.ToString().c_str());
}
++block.nNonce;
if (block.nNonce == 0)
{
printf("NONCE WRAPPED, incrementing time\n");
++block.nTime;
}
}
printf("block.nTime = %u \n", block.nTime);
printf("block.nNonce = %u \n", block.nNonce);
printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());
}
block.print();
assert(block.GetHash() == hashGenesisBlock);
// Start new block file
unsigned int nFile;
unsigned int nBlockPos;
if (!block.WriteToDisk(nFile, nBlockPos))
return error("LoadBlockIndex() : writing genesis block to disk failed");
if (!block.AddToBlockIndex(nFile, nBlockPos))
return error("LoadBlockIndex() : genesis block not accepted");
}
return true;
}
void PrintBlockTree()
{
// precompute tree structure
map<CBlockIndex*, vector<CBlockIndex*> > mapNext;
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
{
CBlockIndex* pindex = (*mi).second;
mapNext[pindex->pprev].push_back(pindex);
// test
//while (rand() % 3 == 0)
// mapNext[pindex->pprev].push_back(pindex);
}
vector<pair<int, CBlockIndex*> > vStack;
vStack.push_back(make_pair(0, pindexGenesisBlock));
int nPrevCol = 0;
while (!vStack.empty())
{
int nCol = vStack.back().first;
CBlockIndex* pindex = vStack.back().second;
vStack.pop_back();
// print split or gap
if (nCol > nPrevCol)
{
for (int i = 0; i < nCol-1; i++)
printf("| ");
printf("|\\\n");
}
else if (nCol < nPrevCol)
{
for (int i = 0; i < nCol; i++)
printf("| ");
printf("|\n");
}
nPrevCol = nCol;
// print columns
for (int i = 0; i < nCol; i++)
printf("| ");
// print item
CBlock block;
block.ReadFromDisk(pindex);
printf("%d (%u,%u) %s %s tx %d",
pindex->nHeight,
pindex->nFile,
pindex->nBlockPos,
block.GetHash().ToString().substr(0,20).c_str(),
DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
block.vtx.size());
PrintWallets(block);
// put the main timechain first
vector<CBlockIndex*>& vNext = mapNext[pindex];
for (unsigned int i = 0; i < vNext.size(); i++)
{
if (vNext[i]->pnext)
{
swap(vNext[0], vNext[i]);
break;
}
}
// iterate children
for (unsigned int i = 0; i < vNext.size(); i++)
vStack.push_back(make_pair(nCol+i, vNext[i]));
}
}
bool LoadExternalBlockFile(FILE* fileIn)
{
int nLoaded = 0;
{
LOCK(cs_main);
try {
CAutoFile blkdat(fileIn, SER_DISK, CLIENT_VERSION);
unsigned int nPos = 0;
while (nPos != (unsigned int)-1 && blkdat.good() && !fRequestShutdown)
{
unsigned char pchData[65536];
do {
fseek(blkdat, nPos, SEEK_SET);
int nRead = fread(pchData, 1, sizeof(pchData), blkdat);
if (nRead <= 8)
{
nPos = (unsigned int)-1;
break;
}
void* nFind = memchr(pchData, pchMessageStart[0], nRead+1-sizeof(pchMessageStart));
if (nFind)
{
if (memcmp(nFind, pchMessageStart, sizeof(pchMessageStart))==0)
{
nPos += ((unsigned char*)nFind - pchData) + sizeof(pchMessageStart);
break;
}
nPos += ((unsigned char*)nFind - pchData) + 1;
}
else
nPos += sizeof(pchData) - sizeof(pchMessageStart) + 1;
} while(!fRequestShutdown);
if (nPos == (unsigned int)-1)
break;
fseek(blkdat, nPos, SEEK_SET);
unsigned int nSize;
blkdat >> nSize;
if (nSize > 0 && nSize <= MAX_BLOCK_SIZE)
{
CBlock block;
blkdat >> block;
if (ProcessBlock(NULL,&block))
{
nLoaded++;
nPos += 4 + nSize;
}
}
}
}
catch (std::exception &e) {
printf("%s() : Deserialize or I/O error caught during load\n",
__PRETTY_FUNCTION__);
}
}
printf("Loaded %i blocks from external file\n", nLoaded);
return nLoaded > 0;
}
//////////////////////////////////////////////////////////////////////////////
//
// CAlert
//
map<uint256, CAlert> mapAlerts;
CCriticalSection cs_mapAlerts;
string GetWarnings(string strFor)
{
int nPriority = 0;
string strStatusBar;
string strRPC;
if (GetBoolArg("-testsafemode"))
strRPC = "test";
// Misc warnings like out of disk space and clock is wrong
if (strMiscWarning != "")
{
nPriority = 1000;
strStatusBar = strMiscWarning;
}
// Longer invalid proof-of-work chain
if (pindexBest && bnBestInvalidWork > bnBestChainWork + pindexBest->GetBlockWork() * 6)
{
nPriority = 2000;
strStatusBar = strRPC = "WARNING: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.";
}
// Alerts
{
LOCK(cs_mapAlerts);
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
{
const CAlert& alert = item.second;
if (alert.AppliesToMe() && alert.nPriority > nPriority)
{
nPriority = alert.nPriority;
strStatusBar = alert.strStatusBar;
}
}
}
if (strFor == "statusbar")
return strStatusBar;
else if (strFor == "rpc")
return strRPC;
assert(!"GetWarnings() : invalid parameter");
return "error";
}
CAlert CAlert::getAlertByHash(const uint256 &hash)
{
CAlert retval;
{
LOCK(cs_mapAlerts);
map<uint256, CAlert>::iterator mi = mapAlerts.find(hash);
if(mi != mapAlerts.end())
retval = mi->second;
}
return retval;
}
bool CAlert::ProcessAlert()
{
if (!CheckSignature())
return false;
if (!IsInEffect())
return false;
{
LOCK(cs_mapAlerts);
// Cancel previous alerts
for (map<uint256, CAlert>::iterator mi = mapAlerts.begin(); mi != mapAlerts.end();)
{
const CAlert& alert = (*mi).second;
if (Cancels(alert))
{
printf("cancelling alert %d\n", alert.nID);
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
mapAlerts.erase(mi++);
}
else if (!alert.IsInEffect())
{
printf("expiring alert %d\n", alert.nID);
uiInterface.NotifyAlertChanged((*mi).first, CT_DELETED);
mapAlerts.erase(mi++);
}
else
mi++;
}
// Check if this alert has been cancelled
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
{
const CAlert& alert = item.second;
if (alert.Cancels(*this))
{
printf("alert already cancelled by %d\n", alert.nID);
return false;
}
}
// Add to mapAlerts
mapAlerts.insert(make_pair(GetHash(), *this));
// Notify UI if it applies to me
if(AppliesToMe())
uiInterface.NotifyAlertChanged(GetHash(), CT_NEW);
}
printf("accepted alert %d, AppliesToMe()=%d\n", nID, AppliesToMe());
return true;
}
//////////////////////////////////////////////////////////////////////////////
//
// Messages
//
bool static AlreadyHave(CTxDB& txdb, const CInv& inv)
{
switch (inv.type)
{
case MSG_TX:
{
bool txInMap = false;
{
LOCK(mempool.cs);
txInMap = (mempool.exists(inv.hash));
}
return txInMap ||
mapOrphanTransactions.count(inv.hash) ||
txdb.ContainsTx(inv.hash);
}
case MSG_BLOCK:
return mapBlockIndex.count(inv.hash) ||
mapOrphanBlocks.count(inv.hash);
}
// Don't know what it is, just say we already got one
return true;
}
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
unsigned char pchMessageStart[4] = { 0xfc, 0xd9, 0xb7, 0xdd };
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
static map<CService, CPubKey> mapReuseKey;
RandAddSeedPerfmon();
if (fDebug)
printf("received: %s (%d bytes)\n", strCommand.c_str(), vRecv.size());
if (mapArgs.count("-dropmessagestest") && GetRand(atoi(mapArgs["-dropmessagestest"])) == 0)
{
printf("dropmessagestest DROPPING RECV MESSAGE\n");
return true;
}
if (strCommand == "version")
{
// Each connection can only send one version message
if (pfrom->nVersion != 0)
{
pfrom->Misbehaving(1);
return false;
}
int64 nTime;
CAddress addrMe;
CAddress addrFrom;
uint64 nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
if (pfrom->nVersion < MIN_PROTO_VERSION)
{
// Since February 20, 2012, the protocol is initiated at version 209,
// and earlier versions are no longer supported
printf("partner %s using obsolete version %i; disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion);
pfrom->fDisconnect = true;
return false;
}
if (pfrom->nVersion == 10300)
pfrom->nVersion = 300;
if (!vRecv.empty())
vRecv >> addrFrom >> nNonce;
if (!vRecv.empty())
vRecv >> pfrom->strSubVer;
if (!vRecv.empty())
vRecv >> pfrom->nStartingHeight;
if (pfrom->fInbound && addrMe.IsRoutable())
{
pfrom->addrLocal = addrMe;
SeenLocal(addrMe);
}
// Disconnect if we connected to ourself
if (nNonce == nLocalHostNonce && nNonce > 1)
{
printf("connected to self at %s, disconnecting\n", pfrom->addr.ToString().c_str());
pfrom->fDisconnect = true;
return true;
}
// Be shy and don't send version until we hear
if (pfrom->fInbound)
pfrom->PushVersion();
pfrom->fClient = !(pfrom->nServices & NODE_NETWORK);
AddTimeData(pfrom->addr, nTime);
// Change version
pfrom->PushMessage("verack");
pfrom->vSend.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
if (!pfrom->fInbound)
{
// Advertise our address
if (!fNoListen && !IsInitialBlockDownload())
{
CAddress addr = GetLocalAddress(&pfrom->addr);
if (addr.IsRoutable())
pfrom->PushAddress(addr);
}
// Get recent addresses
if (pfrom->fOneShot || pfrom->nVersion >= CADDR_TIME_VERSION || addrman.size() < 1000)
{
pfrom->PushMessage("getaddr");
pfrom->fGetAddr = true;
}
addrman.Good(pfrom->addr);
} else {
if (((CNetAddr)pfrom->addr) == (CNetAddr)addrFrom)
{
addrman.Add(addrFrom, addrFrom);
addrman.Good(addrFrom);
}
}
// Ask the first connected node for block updates
static int nAskedForBlocks = 0;
if (!pfrom->fClient && !pfrom->fOneShot &&
(pfrom->nVersion < NOBLKS_VERSION_START ||
pfrom->nVersion >= NOBLKS_VERSION_END) &&
(nAskedForBlocks < 1 || vNodes.size() <= 1))
{
nAskedForBlocks++;
pfrom->PushGetBlocks(pindexBest, uint256(0));
}
// Relay alerts
{
LOCK(cs_mapAlerts);
BOOST_FOREACH(PAIRTYPE(const uint256, CAlert)& item, mapAlerts)
item.second.RelayTo(pfrom);
}
pfrom->fSuccessfullyConnected = true;
printf("receive version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", pfrom->nVersion, pfrom->nStartingHeight, addrMe.ToString().c_str(), addrFrom.ToString().c_str(), pfrom->addr.ToString().c_str());
cPeerBlockCounts.input(pfrom->nStartingHeight);
}
else if (pfrom->nVersion == 0)
{
// Must have a version message before anything else
pfrom->Misbehaving(1);
return false;
}
else if (strCommand == "verack")
{
pfrom->vRecv.SetVersion(min(pfrom->nVersion, PROTOCOL_VERSION));
}
else if (strCommand == "addr")
{
vector<CAddress> vAddr;
vRecv >> vAddr;
// Don't want addr from older versions unless seeding
if (pfrom->nVersion < CADDR_TIME_VERSION && addrman.size() > 1000)
return true;
if (vAddr.size() > 1000)
{
pfrom->Misbehaving(20);
return error("message addr size() = %d", vAddr.size());
}
// Store the new addresses
vector<CAddress> vAddrOk;
int64 nNow = GetAdjustedTime();
int64 nSince = nNow - 10 * 60;
BOOST_FOREACH(CAddress& addr, vAddr)
{
if (fShutdown)
return true;
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
addr.nTime = nNow - 5 * 24 * 60 * 60;
pfrom->AddAddressKnown(addr);
bool fReachable = IsReachable(addr);
if (addr.nTime > nSince && !pfrom->fGetAddr && vAddr.size() <= 10 && addr.IsRoutable())
{
// Relay to a limited number of other nodes
{
LOCK(cs_vNodes);
// Use deterministic randomness to send to the same nodes for 24 hours
// at a time so the setAddrKnowns of the chosen nodes prevent repeats
static uint256 hashSalt;
if (hashSalt == 0)
hashSalt = GetRandHash();
uint64 hashAddr = addr.GetHash();
uint256 hashRand = hashSalt ^ (hashAddr<<32) ^ ((GetTime()+hashAddr)/(24*60*60));
hashRand = Hash(BEGIN(hashRand), END(hashRand));
multimap<uint256, CNode*> mapMix;
BOOST_FOREACH(CNode* pnode, vNodes)
{
if (pnode->nVersion < CADDR_TIME_VERSION)
continue;
unsigned int nPointer;
memcpy(&nPointer, &pnode, sizeof(nPointer));
uint256 hashKey = hashRand ^ nPointer;
hashKey = Hash(BEGIN(hashKey), END(hashKey));
mapMix.insert(make_pair(hashKey, pnode));
}
int nRelayNodes = fReachable ? 2 : 1; // limited relaying of addresses outside our network(s)
for (multimap<uint256, CNode*>::iterator mi = mapMix.begin(); mi != mapMix.end() && nRelayNodes-- > 0; ++mi)
((*mi).second)->PushAddress(addr);
}
}
// Do not store addresses outside our network
if (fReachable)
vAddrOk.push_back(addr);
}
addrman.Add(vAddrOk, pfrom->addr, 2 * 60 * 60);
if (vAddr.size() < 1000)
pfrom->fGetAddr = false;
if (pfrom->fOneShot)
pfrom->fDisconnect = true;
}
else if (strCommand == "inv")
{
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > 50000)
{
pfrom->Misbehaving(20);
return error("message inv size() = %d", vInv.size());
}
// find last block in inv vector
unsigned int nLastBlock = (unsigned int)(-1);
for (unsigned int nInv = 0; nInv < vInv.size(); nInv++) {
if (vInv[vInv.size() - 1 - nInv].type == MSG_BLOCK) {
nLastBlock = vInv.size() - 1 - nInv;
break;
}
}
CTxDB txdb("r");
for (unsigned int nInv = 0; nInv < vInv.size(); nInv++)
{
const CInv &inv = vInv[nInv];
if (fShutdown)
return true;
pfrom->AddInventoryKnown(inv);
bool fAlreadyHave = AlreadyHave(txdb, inv);
if (fDebug)
printf(" got inventory: %s %s\n", inv.ToString().c_str(), fAlreadyHave ? "have" : "new");
if (!fAlreadyHave)
pfrom->AskFor(inv);
else if (inv.type == MSG_BLOCK && mapOrphanBlocks.count(inv.hash)) {
pfrom->PushGetBlocks(pindexBest, GetOrphanRoot(mapOrphanBlocks[inv.hash]));
} else if (nInv == nLastBlock) {
// In case we are on a very long side-chain, it is possible that we already have
// the last block in an inv bundle sent in response to getblocks. Try to detect
// this situation and push another getblocks to continue.
std::vector<CInv> vGetData(1,inv);
pfrom->PushGetBlocks(mapBlockIndex[inv.hash], uint256(0));
if (fDebug)
printf("force request: %s\n", inv.ToString().c_str());
}
// Track requests for our stuff
Inventory(inv.hash);
}
}
else if (strCommand == "getdata")
{
vector<CInv> vInv;
vRecv >> vInv;
if (vInv.size() > 50000)
{
pfrom->Misbehaving(20);
return error("message getdata size() = %d", vInv.size());
}
if (fDebugNet || (vInv.size() != 1))
printf("received getdata (%d invsz)\n", vInv.size());
BOOST_FOREACH(const CInv& inv, vInv)
{
if (fShutdown)
return true;
if (fDebugNet || (vInv.size() == 1))
printf("received getdata for: %s\n", inv.ToString().c_str());
if (inv.type == MSG_BLOCK)
{
// Send block from disk
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(inv.hash);
if (mi != mapBlockIndex.end())
{
CBlock block;
block.ReadFromDisk((*mi).second);
pfrom->PushMessage("block", block);
// Trigger them to send a getblocks request for the next batch of inventory
if (inv.hash == pfrom->hashContinue)
{
// Bypass PushInventory, this must send even if redundant,
// and we want it right after the last block so they don't
// wait for other stuff first.
vector<CInv> vInv;
vInv.push_back(CInv(MSG_BLOCK, hashBestChain));
pfrom->PushMessage("inv", vInv);
pfrom->hashContinue = 0;
}
}
}
else if (inv.IsKnownType())
{
// Send stream from relay memory
{
LOCK(cs_mapRelay);
map<CInv, CDataStream>::iterator mi = mapRelay.find(inv);
if (mi != mapRelay.end())
pfrom->PushMessage(inv.GetCommand(), (*mi).second);
}
}
// Track requests for our stuff
Inventory(inv.hash);
}
}
else if (strCommand == "getblocks")
{
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;
// Find the last block the caller has in the main chain
CBlockIndex* pindex = locator.GetBlockIndex();
// Send the rest of the chain
if (pindex)
pindex = pindex->pnext;
int nLimit = 500;
printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit);
for (; pindex; pindex = pindex->pnext)
{
if (pindex->GetBlockHash() == hashStop)
{
printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str());
break;
}
pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash()));
if (--nLimit <= 0)
{
// When this block is requested, we'll send an inv that'll make them
// getblocks the next batch of inventory.
printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str());
pfrom->hashContinue = pindex->GetBlockHash();
break;
}
}
}
else if (strCommand == "getheaders")
{
CBlockLocator locator;
uint256 hashStop;
vRecv >> locator >> hashStop;
CBlockIndex* pindex = NULL;
if (locator.IsNull())
{
// If locator is null, return the hashStop block
map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashStop);
if (mi == mapBlockIndex.end())
return true;
pindex = (*mi).second;
}
else
{
// Find the last block the caller has in the main chain
pindex = locator.GetBlockIndex();
if (pindex)
pindex = pindex->pnext;
}
vector<CBlock> vHeaders;
int nLimit = 2000;
printf("getheaders %d to %s\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str());
for (; pindex; pindex = pindex->pnext)
{
vHeaders.push_back(pindex->GetBlockHeader());
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
break;
}
pfrom->PushMessage("headers", vHeaders);
}
else if (strCommand == "tx")
{
vector<uint256> vWorkQueue;
vector<uint256> vEraseQueue;
CDataStream vMsg(vRecv);
CTxDB txdb("r");
CTransaction tx;
vRecv >> tx;
CInv inv(MSG_TX, tx.GetHash());
pfrom->AddInventoryKnown(inv);
bool fMissingInputs = false;
if (tx.AcceptToMemoryPool(txdb, true, &fMissingInputs))
{
SyncWithWallets(tx, NULL, true);
RelayMessage(inv, vMsg);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
vEraseQueue.push_back(inv.hash);
// Recursively process any orphan transactions that depended on this one
for (unsigned int i = 0; i < vWorkQueue.size(); i++)
{
uint256 hashPrev = vWorkQueue[i];
for (map<uint256, CDataStream*>::iterator mi = mapOrphanTransactionsByPrev[hashPrev].begin();
mi != mapOrphanTransactionsByPrev[hashPrev].end();
++mi)
{
const CDataStream& vMsg = *((*mi).second);
CTransaction tx;
CDataStream(vMsg) >> tx;
CInv inv(MSG_TX, tx.GetHash());
bool fMissingInputs2 = false;
if (tx.AcceptToMemoryPool(txdb, true, &fMissingInputs2))
{
printf(" accepted orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str());
SyncWithWallets(tx, NULL, true);
RelayMessage(inv, vMsg);
mapAlreadyAskedFor.erase(inv);
vWorkQueue.push_back(inv.hash);
vEraseQueue.push_back(inv.hash);
}
else if (!fMissingInputs2)
{
// invalid orphan
vEraseQueue.push_back(inv.hash);
printf(" removed invalid orphan tx %s\n", inv.hash.ToString().substr(0,10).c_str());
}
}
}
BOOST_FOREACH(uint256 hash, vEraseQueue)
EraseOrphanTx(hash);
}
else if (fMissingInputs)
{
AddOrphanTx(vMsg);
// DoS prevention: do not allow mapOrphanTransactions to grow unbounded
unsigned int nEvicted = LimitOrphanTxSize(MAX_ORPHAN_TRANSACTIONS);
if (nEvicted > 0)
printf("mapOrphan overflow, removed %u tx\n", nEvicted);
}
if (tx.nDoS) pfrom->Misbehaving(tx.nDoS);
}
else if (strCommand == "block")
{
CBlock block;
vRecv >> block;
printf("received block %s\n", block.GetHash().ToString().substr(0,20).c_str());
// block.print();
CInv inv(MSG_BLOCK, block.GetHash());
pfrom->AddInventoryKnown(inv);
if (ProcessBlock(pfrom, &block))
mapAlreadyAskedFor.erase(inv);
if (block.nDoS) pfrom->Misbehaving(block.nDoS);
}
else if (strCommand == "getaddr")
{
pfrom->vAddrToSend.clear();
vector<CAddress> vAddr = addrman.GetAddr();
BOOST_FOREACH(const CAddress &addr, vAddr)
pfrom->PushAddress(addr);
}
else if (strCommand == "checkorder")
{
uint256 hashReply;
vRecv >> hashReply;
if (!GetBoolArg("-allowreceivebyip"))
{
pfrom->PushMessage("reply", hashReply, (int)2, string(""));
return true;
}
CWalletTx order;
vRecv >> order;
/// we have a chance to check the order here
// Keep giving the same key to the same ip until they use it
if (!mapReuseKey.count(pfrom->addr))
pwalletMain->GetKeyFromPool(mapReuseKey[pfrom->addr], true);
// Send back approval of order and pubkey to use
CScript scriptPubKey;
scriptPubKey << mapReuseKey[pfrom->addr] << OP_CHECKSIG;
pfrom->PushMessage("reply", hashReply, (int)0, scriptPubKey);
}
else if (strCommand == "reply")
{
uint256 hashReply;
vRecv >> hashReply;
CRequestTracker tracker;
{
LOCK(pfrom->cs_mapRequests);
map<uint256, CRequestTracker>::iterator mi = pfrom->mapRequests.find(hashReply);
if (mi != pfrom->mapRequests.end())
{
tracker = (*mi).second;
pfrom->mapRequests.erase(mi);
}
}
if (!tracker.IsNull())
tracker.fn(tracker.param1, vRecv);
}
else if (strCommand == "ping")
{
if (pfrom->nVersion > BIP0031_VERSION)
{
uint64 nonce = 0;
vRecv >> nonce;
// Echo the message back with the nonce. This allows for two useful features:
//
// 1) A remote node can quickly check if the connection is operational
// 2) Remote nodes can measure the latency of the network thread. If this node
// is overloaded it won't respond to pings quickly and the remote node can
// avoid sending us more work, like chain download requests.
//
// The nonce stops the remote getting confused between different pings: without
// it, if the remote node sends a ping once per second and this node takes 5
// seconds to respond to each, the 5th ping the remote sends would appear to
// return very quickly.
pfrom->PushMessage("pong", nonce);
}
}
else if (strCommand == "alert")
{
CAlert alert;
vRecv >> alert;
if (alert.ProcessAlert())
{
// Relay
pfrom->setKnown.insert(alert.GetHash());
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
alert.RelayTo(pnode);
}
}
}
else
{
// Ignore unknown commands for extensibility
}
// Update the last seen time for this node's address
if (pfrom->fNetworkNode)
if (strCommand == "version" || strCommand == "addr" || strCommand == "inv" || strCommand == "getdata" || strCommand == "ping")
AddressCurrentlyConnected(pfrom->addr);
return true;
}
bool ProcessMessages(CNode* pfrom)
{
CDataStream& vRecv = pfrom->vRecv;
if (vRecv.empty())
return true;
//if (fDebug)
// printf("ProcessMessages(%u bytes)\n", vRecv.size());
//
// Message format
// (4) message start
// (12) command
// (4) size
// (4) checksum
// (x) data
//
loop
{
// Don't bother if send buffer is too full to respond anyway
if (pfrom->vSend.size() >= SendBufferSize())
break;
// Scan for message start
CDataStream::iterator pstart = search(vRecv.begin(), vRecv.end(), BEGIN(pchMessageStart), END(pchMessageStart));
int nHeaderSize = vRecv.GetSerializeSize(CMessageHeader());
if (vRecv.end() - pstart < nHeaderSize)
{
if ((int)vRecv.size() > nHeaderSize)
{
printf("\n\nPROCESSMESSAGE MESSAGESTART NOT FOUND\n\n");
vRecv.erase(vRecv.begin(), vRecv.end() - nHeaderSize);
}
break;
}
if (pstart - vRecv.begin() > 0)
printf("\n\nPROCESSMESSAGE SKIPPED %d BYTES\n\n", pstart - vRecv.begin());
vRecv.erase(vRecv.begin(), pstart);
// Read header
vector<char> vHeaderSave(vRecv.begin(), vRecv.begin() + nHeaderSize);
CMessageHeader hdr;
vRecv >> hdr;
if (!hdr.IsValid())
{
printf("\n\nPROCESSMESSAGE: ERRORS IN HEADER %s\n\n\n", hdr.GetCommand().c_str());
continue;
}
string strCommand = hdr.GetCommand();
// Message size
unsigned int nMessageSize = hdr.nMessageSize;
if (nMessageSize > MAX_SIZE)
{
printf("ProcessMessages(%s, %u bytes) : nMessageSize > MAX_SIZE\n", strCommand.c_str(), nMessageSize);
continue;
}
if (nMessageSize > vRecv.size())
{
// Rewind and wait for rest of message
vRecv.insert(vRecv.begin(), vHeaderSave.begin(), vHeaderSave.end());
break;
}
// Checksum
uint256 hash = Hash(vRecv.begin(), vRecv.begin() + nMessageSize);
unsigned int nChecksum = 0;
memcpy(&nChecksum, &hash, sizeof(nChecksum));
if (nChecksum != hdr.nChecksum)
{
printf("ProcessMessages(%s, %u bytes) : CHECKSUM ERROR nChecksum=%08x hdr.nChecksum=%08x\n",
strCommand.c_str(), nMessageSize, nChecksum, hdr.nChecksum);
continue;
}
// Copy message to its own buffer
CDataStream vMsg(vRecv.begin(), vRecv.begin() + nMessageSize, vRecv.nType, vRecv.nVersion);
vRecv.ignore(nMessageSize);
// Process message
bool fRet = false;
try
{
{
LOCK(cs_main);
fRet = ProcessMessage(pfrom, strCommand, vMsg);
}
if (fShutdown)
return true;
}
catch (std::ios_base::failure& e)
{
if (strstr(e.what(), "end of data"))
{
// Allow exceptions from underlength message on vRecv
printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught, normally caused by a message being shorter than its stated length\n", strCommand.c_str(), nMessageSize, e.what());
}
else if (strstr(e.what(), "size too large"))
{
// Allow exceptions from overlong size
printf("ProcessMessages(%s, %u bytes) : Exception '%s' caught\n", strCommand.c_str(), nMessageSize, e.what());
}
else
{
PrintExceptionContinue(&e, "ProcessMessages()");
}
}
catch (std::exception& e) {
PrintExceptionContinue(&e, "ProcessMessages()");
} catch (...) {
PrintExceptionContinue(NULL, "ProcessMessages()");
}
if (!fRet)
printf("ProcessMessage(%s, %u bytes) FAILED\n", strCommand.c_str(), nMessageSize);
}
vRecv.Compact();
return true;
}
bool SendMessages(CNode* pto, bool fSendTrickle)
{
TRY_LOCK(cs_main, lockMain);
if (lockMain) {
// Don't send anything until we get their version message
if (pto->nVersion == 0)
return true;
// Keep-alive ping. We send a nonce of zero because we don't use it anywhere
// right now.
if (pto->nLastSend && GetTime() - pto->nLastSend > 30 * 60 && pto->vSend.empty()) {
uint64 nonce = 0;
if (pto->nVersion > BIP0031_VERSION)
pto->PushMessage("ping", nonce);
else
pto->PushMessage("ping");
}
// Resend wallet transactions that haven't gotten in a block yet
ResendWalletTransactions();
// Address refresh broadcast
static int64 nLastRebroadcast;
if (!IsInitialBlockDownload() && (GetTime() - nLastRebroadcast > 24 * 60 * 60))
{
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
// Periodically clear setAddrKnown to allow refresh broadcasts
if (nLastRebroadcast)
pnode->setAddrKnown.clear();
// Rebroadcast our address
if (!fNoListen)
{
CAddress addr = GetLocalAddress(&pnode->addr);
if (addr.IsRoutable())
pnode->PushAddress(addr);
}
}
}
nLastRebroadcast = GetTime();
}
//
// Message: addr
//
if (fSendTrickle)
{
vector<CAddress> vAddr;
vAddr.reserve(pto->vAddrToSend.size());
BOOST_FOREACH(const CAddress& addr, pto->vAddrToSend)
{
// returns true if wasn't already contained in the set
if (pto->setAddrKnown.insert(addr).second)
{
vAddr.push_back(addr);
// receiver rejects addr messages larger than 1000
if (vAddr.size() >= 1000)
{
pto->PushMessage("addr", vAddr);
vAddr.clear();
}
}
}
pto->vAddrToSend.clear();
if (!vAddr.empty())
pto->PushMessage("addr", vAddr);
}
//
// Message: inventory
//
vector<CInv> vInv;
vector<CInv> vInvWait;
{
LOCK(pto->cs_inventory);
vInv.reserve(pto->vInventoryToSend.size());
vInvWait.reserve(pto->vInventoryToSend.size());
BOOST_FOREACH(const CInv& inv, pto->vInventoryToSend)
{
if (pto->setInventoryKnown.count(inv))
continue;
// trickle out tx inv to protect privacy
if (inv.type == MSG_TX && !fSendTrickle)
{
// 1/4 of tx invs blast to all immediately
static uint256 hashSalt;
if (hashSalt == 0)
hashSalt = GetRandHash();
uint256 hashRand = inv.hash ^ hashSalt;
hashRand = Hash(BEGIN(hashRand), END(hashRand));
bool fTrickleWait = ((hashRand & 3) != 0);
// always trickle our own transactions
if (!fTrickleWait)
{
CWalletTx wtx;
if (GetTransaction(inv.hash, wtx))
if (wtx.fFromMe)
fTrickleWait = true;
}
if (fTrickleWait)
{
vInvWait.push_back(inv);
continue;
}
}
// returns true if wasn't already contained in the set
if (pto->setInventoryKnown.insert(inv).second)
{
vInv.push_back(inv);
if (vInv.size() >= 1000)
{
pto->PushMessage("inv", vInv);
vInv.clear();
}
}
}
pto->vInventoryToSend = vInvWait;
}
if (!vInv.empty())
pto->PushMessage("inv", vInv);
//
// Message: getdata
//
vector<CInv> vGetData;
int64 nNow = GetTime() * 1000000;
CTxDB txdb("r");
while (!pto->mapAskFor.empty() && (*pto->mapAskFor.begin()).first <= nNow)
{
const CInv& inv = (*pto->mapAskFor.begin()).second;
if (!AlreadyHave(txdb, inv))
{
if (fDebugNet)
printf("sending getdata: %s\n", inv.ToString().c_str());
vGetData.push_back(inv);
if (vGetData.size() >= 1000)
{
pto->PushMessage("getdata", vGetData);
vGetData.clear();
}
mapAlreadyAskedFor[inv] = nNow;
}
pto->mapAskFor.erase(pto->mapAskFor.begin());
}
if (!vGetData.empty())
pto->PushMessage("getdata", vGetData);
}
return true;
}
//////////////////////////////////////////////////////////////////////////////
//
// BitcoinMiner
//
int static FormatHashBlocks(void* pbuffer, unsigned int len)
{
unsigned char* pdata = (unsigned char*)pbuffer;
unsigned int blocks = 1 + ((len + 8) / 64);
unsigned char* pend = pdata + 64 * blocks;
memset(pdata + len, 0, 64 * blocks - len);
pdata[len] = 0x80;
unsigned int bits = len * 8;
pend[-1] = (bits >> 0) & 0xff;
pend[-2] = (bits >> 8) & 0xff;
pend[-3] = (bits >> 16) & 0xff;
pend[-4] = (bits >> 24) & 0xff;
return blocks;
}
static const unsigned int pSHA256InitState[8] =
{0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
void SHA256Transform(void* pstate, void* pinput, const void* pinit)
{
SHA256_CTX ctx;
unsigned char data[64];
SHA256_Init(&ctx);
for (int i = 0; i < 16; i++)
((uint32_t*)data)[i] = ByteReverse(((uint32_t*)pinput)[i]);
for (int i = 0; i < 8; i++)
ctx.h[i] = ((uint32_t*)pinit)[i];
SHA256_Update(&ctx, data, sizeof(data));
for (int i = 0; i < 8; i++)
((uint32_t*)pstate)[i] = ctx.h[i];
}
//
// ScanHash scans nonces looking for a hash with at least some zero bits.
// It operates on big endian data. Caller does the byte reversing.
// All input buffers are 16-byte aligned. nNonce is usually preserved
// between calls, but periodically or if nNonce is 0xffff0000 or above,
// the block is rebuilt and nNonce starts over at zero.
//
unsigned int static ScanHash_CryptoPP(char* pmidstate, char* pdata, char* phash1, char* phash, unsigned int& nHashesDone)
{
unsigned int& nNonce = *(unsigned int*)(pdata + 12);
for (;;)
{
// Crypto++ SHA-256
// Hash pdata using pmidstate as the starting state into
// preformatted buffer phash1, then hash phash1 into phash
nNonce++;
SHA256Transform(phash1, pdata, pmidstate);
SHA256Transform(phash, phash1, pSHA256InitState);
// Return the nonce if the hash has at least some zero bits,
// caller will check if it has enough to reach the target
if (((unsigned short*)phash)[14] == 0)
return nNonce;
// If nothing found after trying for a while, return -1
if ((nNonce & 0xffff) == 0)
{
nHashesDone = 0xffff+1;
return (unsigned int) -1;
}
}
}
// Some explaining would be appreciated
class COrphan
{
public:
CTransaction* ptx;
set<uint256> setDependsOn;
double dPriority;
COrphan(CTransaction* ptxIn)
{
ptx = ptxIn;
dPriority = 0;
}
void print() const
{
printf("COrphan(hash=%s, dPriority=%.1f)\n", ptx->GetHash().ToString().substr(0,10).c_str(), dPriority);
BOOST_FOREACH(uint256 hash, setDependsOn)
printf(" setDependsOn %s\n", hash.ToString().substr(0,10).c_str());
}
};
uint64 nLastBlockTx = 0;
uint64 nLastBlockSize = 0;
CBlock* CreateNewBlock(CReserveKey& reservekey)
{
CBlockIndex* pindexPrev = pindexBest;
// Create new block
auto_ptr<CBlock> pblock(new CBlock());
if (!pblock.get())
return NULL;
// Create coinbase tx
CTransaction txNew;
txNew.vin.resize(1);
txNew.vin[0].prevout.SetNull();
txNew.vout.resize(1);
txNew.vout[0].scriptPubKey << reservekey.GetReservedKey() << OP_CHECKSIG;
// Add our coinbase tx as first transaction
pblock->vtx.push_back(txNew);
// Collect memory pool transactions into the block
int64 nFees = 0;
{
LOCK2(cs_main, mempool.cs);
CTxDB txdb("r");
// Priority order to process transactions
list<COrphan> vOrphan; // list memory doesn't move
map<uint256, vector<COrphan*> > mapDependers;
multimap<double, CTransaction*> mapPriority;
for (map<uint256, CTransaction>::iterator mi = mempool.mapTx.begin(); mi != mempool.mapTx.end(); ++mi)
{
CTransaction& tx = (*mi).second;
if (tx.IsCoinBase() || !tx.IsFinal())
continue;
COrphan* porphan = NULL;
double dPriority = 0;
BOOST_FOREACH(const CTxIn& txin, tx.vin)
{
// Read prev transaction
CTransaction txPrev;
CTxIndex txindex;
if (!txPrev.ReadFromDisk(txdb, txin.prevout, txindex))
{
// Has to wait for dependencies
if (!porphan)
{
// Use list for automatic deletion
vOrphan.push_back(COrphan(&tx));
porphan = &vOrphan.back();
}
mapDependers[txin.prevout.hash].push_back(porphan);
porphan->setDependsOn.insert(txin.prevout.hash);
continue;
}
int64 nValueIn = txPrev.vout[txin.prevout.n].nValue;
// Read block header
int nConf = txindex.GetDepthInMainChain();
dPriority += (double)nValueIn * nConf;
if (fDebug && GetBoolArg("-printpriority"))
printf("priority nValueIn=%-12"PRI64d" nConf=%-5d dPriority=%-20.1f\n", nValueIn, nConf, dPriority);
}
// Priority is sum(valuein * age) / txsize
dPriority /= ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
if (porphan)
porphan->dPriority = dPriority;
else
mapPriority.insert(make_pair(-dPriority, &(*mi).second));
if (fDebug && GetBoolArg("-printpriority"))
{
printf("priority %-20.1f %s\n%s", dPriority, tx.GetHash().ToString().substr(0,10).c_str(), tx.ToString().c_str());
if (porphan)
porphan->print();
printf("\n");
}
}
// Collect transactions into block
map<uint256, CTxIndex> mapTestPool;
uint64 nBlockSize = 1000;
uint64 nBlockTx = 0;
int nBlockSigOps = 100;
while (!mapPriority.empty())
{
// Take highest priority transaction off priority queue
double dPriority = -(*mapPriority.begin()).first;
CTransaction& tx = *(*mapPriority.begin()).second;
mapPriority.erase(mapPriority.begin());
// Size limits
unsigned int nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
if (nBlockSize + nTxSize >= MAX_BLOCK_SIZE_GEN)
continue;
// Legacy limits on sigOps:
unsigned int nTxSigOps = tx.GetLegacySigOpCount();
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
continue;
// Transaction fee required depends on block size
// Litecoind: Reduce the exempted free transactions to 500 bytes (from Bitcoin's 3000 bytes)
bool fAllowFree = (nBlockSize + nTxSize < 1500 || CTransaction::AllowFree(dPriority));
int64 nMinFee = tx.GetMinFee(nBlockSize, fAllowFree, GMF_BLOCK);
// Connecting shouldn't fail due to dependency on other memory pool transactions
// because we're already processing them in order of dependency
map<uint256, CTxIndex> mapTestPoolTmp(mapTestPool);
MapPrevTx mapInputs;
bool fInvalid;
if (!tx.FetchInputs(txdb, mapTestPoolTmp, false, true, mapInputs, fInvalid))
continue;
int64 nTxFees = tx.GetValueIn(mapInputs)-tx.GetValueOut();
if (nTxFees < nMinFee)
continue;
nTxSigOps += tx.GetP2SHSigOpCount(mapInputs);
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
continue;
if (!tx.ConnectInputs(mapInputs, mapTestPoolTmp, CDiskTxPos(1,1,1), pindexPrev, false, true))
continue;
mapTestPoolTmp[tx.GetHash()] = CTxIndex(CDiskTxPos(1,1,1), tx.vout.size());
swap(mapTestPool, mapTestPoolTmp);
// Added
pblock->vtx.push_back(tx);
nBlockSize += nTxSize;
++nBlockTx;
nBlockSigOps += nTxSigOps;
nFees += nTxFees;
// Add transactions that depend on this one to the priority queue
uint256 hash = tx.GetHash();
if (mapDependers.count(hash))
{
BOOST_FOREACH(COrphan* porphan, mapDependers[hash])
{
if (!porphan->setDependsOn.empty())
{
porphan->setDependsOn.erase(hash);
if (porphan->setDependsOn.empty())
mapPriority.insert(make_pair(-porphan->dPriority, porphan->ptx));
}
}
}
}
nLastBlockTx = nBlockTx;
nLastBlockSize = nBlockSize;
printf("CreateNewBlock(): total size %lu\n", nBlockSize);
}
pblock->vtx[0].vout[0].nValue = GetBlockValue(pindexPrev->nHeight+1, nFees);
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
pblock->UpdateTime(pindexPrev);
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock.get());
pblock->nNonce = 0;
return pblock.release();
}
void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int& nExtraNonce)
{
// Update nExtraNonce
static uint256 hashPrevBlock;
if (hashPrevBlock != pblock->hashPrevBlock)
{
nExtraNonce = 0;
hashPrevBlock = pblock->hashPrevBlock;
}
++nExtraNonce;
pblock->vtx[0].vin[0].scriptSig = (CScript() << pblock->nTime << CBigNum(nExtraNonce)) + COINBASE_FLAGS;
assert(pblock->vtx[0].vin[0].scriptSig.size() <= 100);
pblock->hashMerkleRoot = pblock->BuildMerkleTree();
}
void FormatHashBuffers(CBlock* pblock, char* pmidstate, char* pdata, char* phash1)
{
//
// Prebuild hash buffers
//
struct
{
struct unnamed2
{
int nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
unsigned int nTime;
unsigned int nBits;
unsigned int nNonce;
}
block;
unsigned char pchPadding0[64];
uint256 hash1;
unsigned char pchPadding1[64];
}
tmp;
memset(&tmp, 0, sizeof(tmp));
tmp.block.nVersion = pblock->nVersion;
tmp.block.hashPrevBlock = pblock->hashPrevBlock;
tmp.block.hashMerkleRoot = pblock->hashMerkleRoot;
tmp.block.nTime = pblock->nTime;
tmp.block.nBits = pblock->nBits;
tmp.block.nNonce = pblock->nNonce;
FormatHashBlocks(&tmp.block, sizeof(tmp.block));
FormatHashBlocks(&tmp.hash1, sizeof(tmp.hash1));
// Byte swap all the input buffer
for (unsigned int i = 0; i < sizeof(tmp)/4; i++)
((unsigned int*)&tmp)[i] = ByteReverse(((unsigned int*)&tmp)[i]);
// Precalc the first half of the first hash, which stays constant
SHA256Transform(pmidstate, &tmp.block, pSHA256InitState);
memcpy(pdata, &tmp.block, 128);
memcpy(phash1, &tmp.hash1, 64);
}
bool CheckWork(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
{
uint256 hash = pblock->GetPoWHash();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
if (hash > hashTarget)
return false;
//// debug print
printf("BitcoinMiner:\n");
printf("proof-of-work found \n hash: %s \ntarget: %s\n", hash.GetHex().c_str(), hashTarget.GetHex().c_str());
pblock->print();
printf("generated %s\n", FormatMoney(pblock->vtx[0].vout[0].nValue).c_str());
// Found a solution
{
LOCK(cs_main);
if (pblock->hashPrevBlock != hashBestChain)
return error("BitcoinMiner : generated block is stale");
// Remove key from key pool
reservekey.KeepKey();
// Track how many getdata requests this block gets
{
LOCK(wallet.cs_wallet);
wallet.mapRequestCount[pblock->GetHash()] = 0;
}
// Process this block the same as if we had received it from another node
if (!ProcessBlock(NULL, pblock))
return error("BitcoinMiner : ProcessBlock, block not accepted");
}
return true;
}
void static ThreadBitcoinMiner(void* parg);
static bool fGenerateBitcoins = false;
static bool fLimitProcessors = false;
static int nLimitProcessors = -1;
void static BitcoinMiner(CWallet *pwallet)
{
printf("BitcoinMiner started\n");
SetThreadPriority(THREAD_PRIORITY_LOWEST);
// Make this thread recognisable as the mining thread
RenameThread("bitcoin-miner");
// Each thread has its own key and counter
CReserveKey reservekey(pwallet);
unsigned int nExtraNonce = 0;
while (fGenerateBitcoins)
{
if (fShutdown)
return;
while (vNodes.empty() || IsInitialBlockDownload())
{
Sleep(1000);
if (fShutdown)
return;
if (!fGenerateBitcoins)
return;
}
//
// Create new block
//
unsigned int nTransactionsUpdatedLast = nTransactionsUpdated;
CBlockIndex* pindexPrev = pindexBest;
auto_ptr<CBlock> pblock(CreateNewBlock(reservekey));
if (!pblock.get())
return;
IncrementExtraNonce(pblock.get(), pindexPrev, nExtraNonce);
printf("Running BitcoinMiner with %d transactions in block\n", pblock->vtx.size());
//
// Prebuild hash buffers
//
char pmidstatebuf[32+16]; char* pmidstate = alignup<16>(pmidstatebuf);
char pdatabuf[128+16]; char* pdata = alignup<16>(pdatabuf);
char phash1buf[64+16]; char* phash1 = alignup<16>(phash1buf);
FormatHashBuffers(pblock.get(), pmidstate, pdata, phash1);
unsigned int& nBlockTime = *(unsigned int*)(pdata + 64 + 4);
unsigned int& nBlockBits = *(unsigned int*)(pdata + 64 + 8);
//unsigned int& nBlockNonce = *(unsigned int*)(pdata + 64 + 12);
//
// Search
//
int64 nStart = GetTime();
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
loop
{
unsigned int nHashesDone = 0;
//unsigned int nNonceFound;
uint256 thash;
char scratchpad[SCRYPT_SCRATCHPAD_SIZE];
loop
{
scrypt_1024_1_1_256_sp(BEGIN(pblock->nVersion), BEGIN(thash), scratchpad);
if (thash <= hashTarget)
{
// Found a solution
SetThreadPriority(THREAD_PRIORITY_NORMAL);
CheckWork(pblock.get(), *pwalletMain, reservekey);
SetThreadPriority(THREAD_PRIORITY_LOWEST);
break;
}
pblock->nNonce += 1;
nHashesDone += 1;
if ((pblock->nNonce & 0xFF) == 0)
break;
}
// Meter hashes/sec
static int64 nHashCounter;
if (nHPSTimerStart == 0)
{
nHPSTimerStart = GetTimeMillis();
nHashCounter = 0;
}
else
nHashCounter += nHashesDone;
if (GetTimeMillis() - nHPSTimerStart > 4000)
{
static CCriticalSection cs;
{
LOCK(cs);
if (GetTimeMillis() - nHPSTimerStart > 4000)
{
dHashesPerSec = 1000.0 * nHashCounter / (GetTimeMillis() - nHPSTimerStart);
nHPSTimerStart = GetTimeMillis();
nHashCounter = 0;
string strStatus = strprintf(" %.0f khash/s", dHashesPerSec/1000.0);
static int64 nLogTime;
if (GetTime() - nLogTime > 30 * 60)
{
nLogTime = GetTime();
printf("%s ", DateTimeStrFormat("%x %H:%M", GetTime()).c_str());
printf("hashmeter %3d CPUs %6.0f khash/s\n", vnThreadsRunning[THREAD_MINER], dHashesPerSec/1000.0);
}
}
}
}
// Check for stop or if block needs to be rebuilt
if (fShutdown)
return;
if (!fGenerateBitcoins)
return;
if (fLimitProcessors && vnThreadsRunning[THREAD_MINER] > nLimitProcessors)
return;
if (vNodes.empty())
break;
if (pblock->nNonce >= 0xffff0000)
break;
if (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)
break;
if (pindexPrev != pindexBest)
break;
// Update nTime every few seconds
pblock->UpdateTime(pindexPrev);
nBlockTime = ByteReverse(pblock->nTime);
if (fTestNet)
{
// Changing pblock->nTime can change work required on testnet:
nBlockBits = ByteReverse(pblock->nBits);
hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
}
}
}
}
void static ThreadBitcoinMiner(void* parg)
{
CWallet* pwallet = (CWallet*)parg;
try
{
vnThreadsRunning[THREAD_MINER]++;
BitcoinMiner(pwallet);
vnThreadsRunning[THREAD_MINER]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_MINER]--;
PrintException(&e, "ThreadBitcoinMiner()");
} catch (...) {
vnThreadsRunning[THREAD_MINER]--;
PrintException(NULL, "ThreadBitcoinMiner()");
}
nHPSTimerStart = 0;
if (vnThreadsRunning[THREAD_MINER] == 0)
dHashesPerSec = 0;
printf("ThreadBitcoinMiner exiting, %d threads remaining\n", vnThreadsRunning[THREAD_MINER]);
}
void GenerateBitcoins(bool fGenerate, CWallet* pwallet)
{
fGenerateBitcoins = fGenerate;
nLimitProcessors = GetArg("-genproclimit", -1);
if (nLimitProcessors == 0)
fGenerateBitcoins = false;
fLimitProcessors = (nLimitProcessors != -1);
if (fGenerate)
{
int nProcessors = boost::thread::hardware_concurrency();
printf("%d processors\n", nProcessors);
if (nProcessors < 1)
nProcessors = 1;
if (fLimitProcessors && nProcessors > nLimitProcessors)
nProcessors = nLimitProcessors;
int nAddThreads = nProcessors - vnThreadsRunning[THREAD_MINER];
printf("Starting %d BitcoinMiner threads\n", nAddThreads);
for (int i = 0; i < nAddThreads; i++)
{
if (!CreateThread(ThreadBitcoinMiner, pwallet))
printf("Error: CreateThread(ThreadBitcoinMiner) failed\n");
Sleep(10);
}
}
}
| {
"content_hash": "2bddb8860029527bfb66487d35baaf5f",
"timestamp": "",
"source": "github",
"line_count": 3814,
"max_line_length": 280,
"avg_line_length": 33.38751966439434,
"alnum_prop": 0.5726009109470709,
"repo_name": "canadacoin/pasutest",
"id": "cc1487f24b617d3697cb3d7fd9454abe96a42474",
"size": "127846",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "78622"
},
{
"name": "C++",
"bytes": "1370843"
},
{
"name": "IDL",
"bytes": "11401"
},
{
"name": "Objective-C",
"bytes": "2463"
},
{
"name": "Python",
"bytes": "47538"
},
{
"name": "Shell",
"bytes": "1402"
},
{
"name": "TypeScript",
"bytes": "3810608"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/fixture.xsd">
<fixture name="orderStatus"
module="Magento_Sales"
type="composite"
collection="Magento\Sales\Model\ResourceModel\Order\Status\Collection"
repository_class="Magento\Sales\Test\Repository\OrderStatus"
handler_interface="Magento\Sales\Test\Handler\OrderStatus\OrderStatusInterface"
class="Magento\Sales\Test\Fixture\OrderStatus">
<field name="status" is_required="1" />
<field name="label" is_required="" />
<field name="state" is_required="1" />
<field name="is_default" is_required="" />
<field name="visible_on_front" is_required="" />
</fixture>
</config>
| {
"content_hash": "a3c71a57e79c92387c8d3460b639472c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 147,
"avg_line_length": 46.421052631578945,
"alnum_prop": 0.6258503401360545,
"repo_name": "j-froehlich/magento2_wk",
"id": "3866c069ef149a1634c5ea768e82e5232cebe644",
"size": "990",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "dev/tests/functional/tests/app/Magento/Sales/Test/Fixture/OrderStatus.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "13636"
},
{
"name": "CSS",
"bytes": "2076720"
},
{
"name": "HTML",
"bytes": "6151072"
},
{
"name": "JavaScript",
"bytes": "2488727"
},
{
"name": "PHP",
"bytes": "12466046"
},
{
"name": "Shell",
"bytes": "6088"
},
{
"name": "XSLT",
"bytes": "19979"
}
],
"symlink_target": ""
} |
/**
* Module for displaying the Guacamole text input method.
*/
angular.module('textInput', []);
| {
"content_hash": "3d5d6c9670f5f3ef11b2346090524e49",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 57,
"avg_line_length": 16.833333333333332,
"alnum_prop": 0.6732673267326733,
"repo_name": "TribeMedia/guacamole-client",
"id": "89a1e79f82a8e29c2ffcec6d52ee8e5fc42e864f",
"size": "1218",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "guacamole/src/main/webapp/app/textInput/textInputModule.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "103890"
},
{
"name": "HTML",
"bytes": "93843"
},
{
"name": "Java",
"bytes": "1374290"
},
{
"name": "JavaScript",
"bytes": "1076967"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Coq bench</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.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">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<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="../../..">Unstable</a></li>
<li><a href=".">dev / contrib:higman-nw dev</a></li>
<li class="active"><a href="">2014-12-04 06:17:00</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="../../../../../about.html">About</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href=".">« Up</a>
<h1>
contrib:higman-nw
<small>
dev
<span class="label label-success">5 s</span>
</small>
</h1>
<p><em><script>document.write(moment("2014-12-04 06:17:00 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2014-12-04 06:17:00 UTC)</em><p>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>ruby lint.rb unstable ../unstable/packages/coq:contrib:higman-nw/coq:contrib:higman-nw.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
<dt>Output</dt>
<dd><pre>The package is valid.
</pre></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 --dry-run coq:contrib:higman-nw.dev coq.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is dev).
The following actions will be performed:
- install coq:contrib:higman-nw.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:higman-nw.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
Installing coq:contrib:higman-nw.dev.
</pre></dd>
</dl>
<p>Dry install without Coq, to test if the problem was incompatibility with the current Coq version:</p>
<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 dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --deps-only coq:contrib:higman-nw.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>2 s</dd>
</dl>
<h2>Install</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --verbose coq:contrib:higman-nw.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>5 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- install coq:contrib:higman-nw.dev
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:higman-nw] Fetching https://gforge.inria.fr/git/coq-contribs/higman-nw.git#trunk
Initialized empty Git repository in /home/bench/.opam/packages.dev/coq:contrib:higman-nw.dev/.git/
[master (root-commit) 9eb1e71] opam-git-init
From https://gforge.inria.fr/git/coq-contribs/higman-nw
* [new branch] trunk -> opam-ref
* [new branch] trunk -> origin/trunk
.cvsignore
Extract.v
Higman.v
LICENSE
Make
Makefile
description
main.ml
HEAD is now at ca602e9 Revert "Regenerating Makefiles." We will be able to do so when we have access
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building coq:contrib:higman-nw.dev:
coq_makefile -f Make -o Makefile
make -j4
make install
Warning:
Please now use "-extra[-phony] result deps command" instead of "-custom command deps result".
It follows makefile target declaration order and has a clearer semantic.
Warning:
Please now use "-extra[-phony] result deps command" instead of "-custom command deps result".
It follows makefile target declaration order and has a clearer semantic.
Warning:
Please now use "-extra[-phony] result deps command" instead of "-custom command deps result".
It follows makefile target declaration order and has a clearer semantic.
"coqdep" -c -R "." HigmanNW "Higman.v" > "Higman.v.d" || ( RV=$?; rm -f "Higman.v.d"; exit ${RV} )
"coqc" -q -R "." HigmanNW -impredicative-set Higman
coqtop -R "." HigmanNW -q -R "." HigmanNW -impredicative-set -silent -batch -load-vernac-source Extract.v
Fetching opaque proofs from disk for HigmanNW.Higman
ocamlopt -rectypes -thread -o higman higman.mli higman.ml main.ml
File "main.ml", line 60, characters 3-15:
Warning 3: deprecated: Array.create
Use Array.make instead.
***** test: running Higman proof on one example *****
./higman 101 0110 01010
f(0)=101
f(1)=0110
f(2)=01010
f(3)=...
==> f(0) is included in f(2)
****************** End of test **********************
cd "." && for i in Higman.vo ; do \
install -d "`dirname """/home/bench/.opam/system/lib/coq/user-contrib"/HigmanNW/$i`"; \
install -m 0644 $i """/home/bench/.opam/system/lib/coq/user-contrib"/HigmanNW/$i; \
done
Installing coq:contrib:higman-nw.dev.
</pre></dd>
</dl>
<h2>Installation size</h2>
<p>Total: 105 K</p>
<ul>
<li>105 K <code>/home/bench/.opam/system/lib/coq/user-contrib/HigmanNW/Higman.vo</code></li>
<li>1 K <code>/home/bench/.opam/system/lib/coq:contrib:higman-nw/opam.config</code></li>
<li>1 K <code>/home/bench/.opam/system/install/coq:contrib:higman-nw.install</code></li>
</ul>
<h2>Uninstall</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq:contrib:higman-nw.dev</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>1 s</dd>
<dt>Output</dt>
<dd><pre>The following actions will be performed:
- remove coq:contrib:higman-nw.dev
=== 1 to remove ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[coq:contrib:higman-nw] Fetching https://gforge.inria.fr/git/coq-contribs/higman-nw.git#trunk
=-=- Removing Packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Removing coq:contrib:higman-nw.dev.
rm -R /home/bench/.opam/system/lib/coq/user-contrib/HigmanNW
</pre></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": "c1f75ab0c14711f367a727f5ae33ed5c",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 157,
"avg_line_length": 43.21818181818182,
"alnum_prop": 0.5459612957509465,
"repo_name": "coq-bench/coq-bench.github.io-old",
"id": "40cc737ccb5e75e87aeaf1e15278ec3423c2c58d",
"size": "9510",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.02.1-1.2.0/unstable/dev/contrib:higman-nw/dev/2014-12-04_06-17-00.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>basic_seq_packet_socket::max_connections</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="Asio">
<link rel="up" href="../basic_seq_packet_socket.html" title="basic_seq_packet_socket">
<link rel="prev" href="lowest_layer_type.html" title="basic_seq_packet_socket::lowest_layer_type">
<link rel="next" href="message_do_not_route.html" title="basic_seq_packet_socket::message_do_not_route">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="lowest_layer_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../basic_seq_packet_socket.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="message_do_not_route.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.reference.basic_seq_packet_socket.max_connections"></a><a class="link" href="max_connections.html" title="basic_seq_packet_socket::max_connections">basic_seq_packet_socket::max_connections</a>
</h4></div></div></div>
<p>
<span class="emphasis"><em>Inherited from socket_base.</em></span>
</p>
<p>
<a class="indexterm" name="idp124329456"></a>
The maximum length of the queue of
pending incoming connections.
</p>
<pre class="programlisting"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">int</span> <span class="identifier">max_connections</span> <span class="special">=</span> <span class="identifier">implementation_defined</span><span class="special">;</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2015 Christopher M.
Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="lowest_layer_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../basic_seq_packet_socket.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="message_do_not_route.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "2b25cba6d0a80f7c5f85ce90aae3fd98",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 369,
"avg_line_length": 64.7872340425532,
"alnum_prop": 0.6502463054187192,
"repo_name": "letitvi/VideoGridPlayer",
"id": "ea55ddd4b6084f311ebf28f19efac78c0966e98e",
"size": "3045",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "thirdparty/source/asio-1.11.0/doc/asio/reference/basic_seq_packet_socket/max_connections.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1189"
},
{
"name": "C++",
"bytes": "26483"
},
{
"name": "Objective-C",
"bytes": "13"
}
],
"symlink_target": ""
} |
{{<layout}}
{{$pageTitle}}
GOV.UK prototyping kit
{{/pageTitle}}
{{$content}}
<main id="content" role="main">
<div class="spacer_15"></div>
<div class="breadcrumb">
<ol>
<li><a class="breadcrumb_links no_link_style" href="https://www.gov.uk">Home</a></li>
<li><a class="breadcrumb_links no_link_style" href="https://www.gov.uk/government/organisations/land-registry">Land Registry</a></li>
<li class="breadcrumb_no_arrow"><span>Data Publication Platform</span></li>
</ol>
</div>
<div class="spacer_5"></div>
<div class="grid-row">
<!-- ///////////////////////////////// column two-thirds ///////////////////////////////// -->
<div class="column-two-thirds">
<h1 class="title_48">Data Publication Platform</h1>
<p class="panel_indent">The Land Registry Data Publication Platform release data organised by services for citizens, professional and businessess.</p>
<!--
<div class="spacer_5"></div>
<div class="text_16_gray">
<span class="text_16_bold">1. Choose data</span>
2. Your details
3. Payment
4. Review
5. Confirmation
</div>
<div class="spacer_20"></div>
-->
<table class="custom_1">
<tr>
<th width="80%" class="table_text_gray">Services</th>
<th width="20%" class="table_text_gray"> </th>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">House Price Index</a><br>
<span class="text_16_gray">Lorum ipsum colabra senatus roman sumus et sempre. </span></td>
<td><img class="icon_data" src="/public/images/free.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Price Paid Data</a><br>
<span class="text_16_gray">Colabra senatus roman sumus et mendigas dolores. </span></td>
<td><img class="icon_data" src="/public/images/free.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Transaction Data</a><br>
<span class="text_16_gray">Senatus dolore suposares ilum sempre romanus. </span></td>
<td><img class="icon_data" src="/public/images/free.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Commercial and Corporate Ownership Data</a><br>
<span class="text_16_gray">Ipsum colabra senatus roman sumus. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"><img class="icon_data" src="/public/images/license.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">INSPIRE Index Polygons Spatial Data</a><br>
<span class="text_16_gray">Solemne sintra setuaris momentum corrupta gitanas centra. </span></td>
<td><img class="icon_data" src="/public/images/free.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">1862 Act Registers</a><br>
<span class="text_16_gray">Romanus caesar sempre seratis et sucumba tempo sempre. </span></td>
<td><img class="icon_data" src="/public/images/free.jpg"></td>
</tr>
<!--
<tr>
<td><a href="#" class="link_19_bold no_link_style">National Polygon Services</a><br>
<span class="text_16_gray">Adelis visnculas solventa sempre ipdeas mallas sentare. </span></td>
<td><img src="/public/images/chargeable.jpg"><img src="/public/images/license.jpg"></td>
</tr>
-->
<div id="show_1a">
<tr id="showHide1a" data-target="show_1b">
<td><span class="link_19_bold no_link_style">National Polygon Services</span><br>
<span class="text_16_gray">Adelis visnculas solventa sempre ipdeas mallas sentare. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"><img class="icon_data" src="/public/images/license.jpg"></td>
</tr>
</div>
<div id="show_1b">
<tr id="showHide1b" data-target="show_1a">
<td colspan="2" style="background-color: #e8e8e8; padding:0px; margin:0px;">
<table>
<tr>
<td style="width:5%" class="td-no-line"></td>
<td style="width:70%" class="text_16">
<span class="text_19_bold">National Polygon Services</span><br>
<span id="here"><a href="#here" class="link_16 no_link_style">Close </a></span></td>
<td style="width:20%; text-align:right; padding-top: 9px;"><img class="icon_data" style="margin-right:-5px;" src="/public/images/chargeable.jpg"><img class="icon_data" style="margin-right:-5px;" src="/public/images/license.jpg"></td>
<td style="width:5%" class="td-no-line"></td>
</tr>
<tr>
<td class="td-no-line"></td>
<td class="text_16" colspan="2">
<span class="text_16_bold">Description</span>
<div class="spacer_10"></div>
<span>
National Polygon Services provides information about the extent of registered land and property in England and Wales.
<!--
For more information about the National Polygon Services, visit the <a href="https://www.gov.uk/guidance/national-polygon-service" class="link_16 no_link_style">guidance</a> or contact our Business Development Fulfilment Team. Email [email protected] or call 0300 006 0478.
-->
</span>
<div class="spacer_15"></div>
<a href="service" class="link_16 no_link_style">Find out more</a>
<div class="spacer_15"></div>
</td>
<td class="td-no-line"></td>
</tr>
<tr>
<td class="td-no-line"></td>
<td class="td-no-line text_16" colspan="2">
<span class="text_16_bold">Purchase the data</span>
<div class="spacer_10"></div>
<span>The National Polygon Service contains three licensed, chargeable datasets. Each dataset is only available as part of the National Polygon Service:
<div class="spacer_10"></div>
• National Polygon dataset <br>
• Title Descriptor dataset <br>
• Title Number and UPRN Look Up dataset
<div class="spacer_10"></div>
You can buy all or individual customised datasets online.</span>
<div class="spacer_20"></div>
<a href="data"><input class="button" type="submit" value="Buy dataset"></a>
<div class="spacer_5"></div>
</td>
<td class="td-no-line"></td>
</tr>
</table>
</td>
</tr>
</div>
<!--
<tr id="showHide1" data-target="show_1" class="hide-styles">
<td><span class="link_19_bold no_link_style">National Polygon Services</span><br>
<span class="text_16_gray">Adelis visnculas solventa sempre ipdeas mallas sentare. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"><img class="icon_data" src="/public/images/license.jpg"></td>
</tr>
<tr id="show_1">
<td colspan="2" style="background-color: #e8e8e8">
<table>
<tr>
<td style="width:5%" class="td-no-line"></td>
<td style="width:100%; vertical-align: top" class="text_16">
<span class="text_16_bold">Description</span>
<div class="spacer_10"></div>
<span>
National Polygon Services provides information about the extent of registered land and property in England and Wales.
</span>
<div class="spacer_15"></div>
<a href="service" class="link_16 no_link_style">National Polygon Services</a>
<div class="spacer_15"></div>
</td>
<td style="width:5%" class="td-no-line"></td>
</tr>
<tr>
<td class="td-no-line"></td>
<td class="td-no-line text_16">
<span class="text_16_bold">Purchase the data</span>
<div class="spacer_10"></div>
<span>The National Polygon Service contains three licensed, chargeable datasets. Each dataset is only available as part of the National Polygon Service:
<div class="spacer_10"></div>
• National Polygon dataset <br>
• Title Descriptor dataset <br>
• Title Number and UPRN Look Up dataset
<div class="spacer_10"></div>
You can buy all or individual customised datasets online.</span>
<div class="spacer_20"></div>
<a href="data"><input class="button" type="submit" value="Buy dataset"></a>
</td>
<td class="td-no-line"></td>
</tr>
</table>
</td>
</tr>
-->
<tr>
<td><a href="#" class="link_19_bold no_link_style">Title Descriptor</a><br>
<span class="text_16_gray">Supra mentore senatus dolore aliquam argumentas est. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Unique Property Reference Number (UPRN)</a><br>
<span class="text_16_gray">Pentare simgulas pernotare et continua. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg" alt="text"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Overseas Ownership</a><br>
<span class="text_16_gray">Momentum totalitare militia embarga contigentas dolore. </span></td>
<td><img class="icon_data" src="/public/images/free.jpg"><img class="icon_data" src="/public/images/license.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">DayList</a><br>
<span class="text_16_gray">Caesar pensare et dolore causare nicolastum mentore. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Leases</a><br>
<span class="text_16_gray">Abultare compitare estival momentum seratis. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">Charges</a><br>
<span class="text_16_gray">Cantare et bailares colabra remanus sempre momentum. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"></td>
</tr>
<tr>
<td><a href="#" class="link_19_bold no_link_style">National Spatial Dataset</a><br>
<span class="text_16_gray">Conversa ansunta abogare sempre milanesas archiva. </span></td>
<td><img class="icon_data" src="/public/images/chargeable.jpg"><img class="icon_data" src="/public/images/license.jpg"></td>
</tr>
<!--
<tr>
<td><a href="#">National Spatial Dataset</a></td>
<td>Lorum...</td>
</tr>
-->
</table>
<div class="spacer_50"></div>
<!--
<h2 class="title_24">Land Registry Digital Service</h2>
<div class="spacer_5"></div>
<p class="text_16">The <a class="link_16" href="#">Land Registry</a> are working with <a class="link_16" href="#">The Government Digital Service (GDS)</a> to build a new digital service. The service will form a part of <a class="link_16" href="#">GOV.UK</a> and is currently in alpha phase following guidance in the Government Service Design Manual in order to meet the <a class="link_16" href="#">Government Digital By Default Service Standard</a>.
<br><br>
The service is being built in the open, with the <a class="link_16" href="#">code</a> developed as open source, and the <a class="link_16" href="#">architecture</a> and other documentation published under the open government licence. </p>
<div class="spacer_50"></div>
-->
<div>
<a href="#" class="link_16_gray no_link_style">Is there anything wrong with this page?</a>
</div>
</div>
<!-- ///////////////////////////////// end column two-thirds ///////////////////////////////// -->
<!-- ///////////////////////////////// column-third ///////////////////////////////// -->
<div class="column-third">
<div class="spacer_10"></div>
<div class="related"></div>
<div class="spacer_15"></div>
<p class="text_19_bold">Open Data</p>
<div class="spacer_15"></div>
<div class="text_16">Land Registry release free datasets to support economic growth and as part of our commitment to the <a href="#" class="link_16 no_link_style">Open Data Agenda</a>.</div>
<div class="spacer_20"></div>
<div>
<span class="number_36_bold">238,306</span>
<br>
<span class="text_16">Monthly downloaded files</span>
<div class="spacer_20"></div>
<span class="number_36_bold">7,689 Gb</span>
<br>
<span class="text_16">Downloaded full dataset</span>
<div class="spacer_20"></div>
<span class="number_36_bold">21,475,470</span>
<br>
<span class="text_16">Number of data elements (polygons) available to view via INSPIRE</span>
</div>
</div>
<!-- ///////////////////////////////// end column-third ///////////////////////////////// -->
</div>
<script src="http://hmrc-prototype.herokuapp.com/assets/javascripts/vendor/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
document.getElementById("showHide1b").style.display = 'none';
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#showHide1a').on('click', function(){
$('#showHide1a').hide();
$('#showHide1b').show();
});
$('#showHide1b').on('click', function(){
$('#showHide1b').hide();
$('#showHide1a').show();
});
//$('#show_2').hide();
//$('#showHide2').on('click', function(){
//$('#' + $(this).attr('data-target')).toggle();
//$(this).toggleClass('hide-styles').toggleClass('show-styles');
//$('#showHide2').toggleClass('hide').toggleClass('show');
//});
});
</script>
</main>
{{/content}}
{{/layout}}
| {
"content_hash": "6940401d6cfeae99ef96251edebed2ea",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 452,
"avg_line_length": 42.18361581920904,
"alnum_prop": 0.548382776401259,
"repo_name": "LandRegistry/data-publication-platform",
"id": "cc84ad3ed30a33ed7d5913e36e86635036c7d2ec",
"size": "14946",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/views/projects/dashboard/latest/dashboard.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "72041"
},
{
"name": "HTML",
"bytes": "210259"
},
{
"name": "JavaScript",
"bytes": "26182"
}
],
"symlink_target": ""
} |
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Threading;
using System.Web.Mvc;
using WebMatrix.WebData;
using CAT.Azure.Models;
namespace CAT.Azure.Filters
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
{
private static SimpleMembershipInitializer _initializer;
private static object _initializerLock = new object();
private static bool _isInitialized;
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// Ensure ASP.NET Simple Membership is initialized only once per app start
LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
}
private class SimpleMembershipInitializer
{
public SimpleMembershipInitializer()
{
Database.SetInitializer<UsersContext>(null);
try
{
using (var context = new UsersContext())
{
if (!context.Database.Exists())
{
// Create the SimpleMembership database without Entity Framework migration schema
((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
}
}
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
}
catch (Exception ex)
{
throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
}
}
}
}
}
| {
"content_hash": "d4e0467f4b3d3bedac82a87a32b0d989",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 207,
"avg_line_length": 39.96,
"alnum_prop": 0.6121121121121121,
"repo_name": "AlexCatarino/CAT",
"id": "cabd0ed2145a7c569e3857852c151ecc09718149",
"size": "2000",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CAT.Azurexxx/Filters/InitializeSimpleMembershipAttribute.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "184"
},
{
"name": "C#",
"bytes": "692761"
},
{
"name": "CSS",
"bytes": "27659"
},
{
"name": "JavaScript",
"bytes": "599223"
}
],
"symlink_target": ""
} |
CREATE DATABASE IF NOT EXISTS `whiskeyAppTest` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `whiskeyAppTest`;
-- MySQL dump 10.13 Distrib 5.6.13, for osx10.6 (i386)
--
-- Host: localhost Database: whiskeyAppTest
-- ------------------------------------------------------
-- Server version 5.5.38-0ubuntu0.12.04.1
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `articles`
--
DROP TABLE IF EXISTS `articles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `articles` (
`aid` int(11) NOT NULL,
`uid` varchar(45) DEFAULT NULL,
`dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`articleUrl` varchar(100) NOT NULL,
PRIMARY KEY (`aid`),
KEY `a_uid_idx` (`uid`),
CONSTRAINT `a_uid` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`) ON DELETE SET NULL ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `articles`
--
LOCK TABLES `articles` WRITE;
/*!40000 ALTER TABLE `articles` DISABLE KEYS */;
INSERT INTO `articles` VALUES (1,'rcruz','2014-10-11 02:58:27','https://raw.githubusercontent.com/rcruz/whiskey-articles/master/1.md');
/*!40000 ALTER TABLE `articles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `drinkReviews`
--
DROP TABLE IF EXISTS `drinkReviews`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `drinkReviews` (
`drid` int(11) NOT NULL AUTO_INCREMENT,
`did` int(11) NOT NULL,
`uid` varchar(45) DEFAULT NULL,
`dateCreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`rating` int(3) NOT NULL,
`articleUrl` varchar(100) DEFAULT NULL,
PRIMARY KEY (`drid`),
UNIQUE KEY `drid_UNIQUE` (`drid`),
UNIQUE KEY `dr_did_uid_UNIQUE` (`did`,`uid`),
KEY `dr_did_idx` (`did`),
KEY `dr_uid_idx` (`uid`),
CONSTRAINT `dr_uid` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`) ON DELETE SET NULL ON UPDATE NO ACTION,
CONSTRAINT `dr_did` FOREIGN KEY (`did`) REFERENCES `drinks` (`did`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `drinkReviews`
--
LOCK TABLES `drinkReviews` WRITE;
/*!40000 ALTER TABLE `drinkReviews` DISABLE KEYS */;
INSERT INTO `drinkReviews` VALUES (1,1,'rcruz','2014-10-04 22:08:30',70,NULL);
/*!40000 ALTER TABLE `drinkReviews` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `drinks`
--
DROP TABLE IF EXISTS `drinks`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `drinks` (
`did` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
`type` varchar(45) NOT NULL,
`subtype` varchar(45) DEFAULT NULL,
`originCountry` varchar(45) NOT NULL,
`originRegion` varchar(45) DEFAULT NULL,
`manufacturer` varchar(45) DEFAULT NULL,
`alcoholContent` float DEFAULT NULL,
PRIMARY KEY (`did`),
UNIQUE KEY `UNIQUE` (`name`,`manufacturer`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `drinks`
--
LOCK TABLES `drinks` WRITE;
/*!40000 ALTER TABLE `drinks` DISABLE KEYS */;
INSERT INTO `drinks` VALUES (1,'Jim Beam Kentucky Straight Bourbon','Whiskey',NULL,'USA',NULL,NULL,40),(2,'Jameson Irish Whiskey','Whiskey',NULL,'Ireland',NULL,NULL,40);
/*!40000 ALTER TABLE `drinks` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`uid` varchar(45) NOT NULL,
`email` varchar(60) NOT NULL,
`firstName` varchar(45) NOT NULL,
`lastName` varchar(45) NOT NULL,
`password` varchar(128) NOT NULL,
PRIMARY KEY (`uid`),
UNIQUE KEY `uid_UNIQUE` (`uid`),
UNIQUE KEY `email_UNIQUE` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES ('admin','[email protected]','Master','Blaster','$2a$10$Ov5/Yoab3TfapcsFEeKfDevS1LmbPCkekLaEZc/tmm4WFdTB/7oa6'),('rcruz','[email protected]','Rowell','Cruz','$2a$10$v.8uOeZxi0yWdcQgNQ0c5ueTskQK63HB4.3rJLjDKBmQgvVtC1VFK');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2014-10-10 22:59:19
| {
"content_hash": "8336e136e7c53dc0a459b5c458395b46",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 244,
"avg_line_length": 37.152317880794705,
"alnum_prop": 0.6862745098039216,
"repo_name": "rcruz/whiskey-app",
"id": "bc25d4ee6cab3741e7e7fb848120687405094bc4",
"size": "5610",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/test/testData.sql",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "49556"
},
{
"name": "Shell",
"bytes": "386"
}
],
"symlink_target": ""
} |
body {
align-content: center;
background-image: url('noConnection.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
} | {
"content_hash": "9a010fa5b5224ef9535f37e017c94c28",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 43,
"avg_line_length": 24,
"alnum_prop": 0.7619047619047619,
"repo_name": "Peter42/lunch_parser",
"id": "def0ceab1f93a1e9c280731ddfada2289fc96ba3",
"size": "168",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "webservice/src/main/resources/static/noConnection.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1824"
},
{
"name": "HTML",
"bytes": "1252"
},
{
"name": "Java",
"bytes": "38530"
},
{
"name": "JavaScript",
"bytes": "6175"
},
{
"name": "Shell",
"bytes": "422"
}
],
"symlink_target": ""
} |
'use strict';
//Setting up route
angular.module('bs').config(
function($stateProvider, $urlRouterProvider){
// For unmatched routes:
$urlRouterProvider.otherwise('/');
// states for my app
$stateProvider
.state('home', {
url: '/',
templateUrl: 'views/index.html'
});
}
);
//Setting HTML5 Location Mode
angular.module('bs').config(
function($locationProvider){
$locationProvider.hashPrefix('!');
});
/*Setting custom interpolate,
to differentiate angular templates (front end) from swig templates (back end)*/
angular.module('bs').config(
function($interpolateProvider){
$interpolateProvider.startSymbol('[[');
$interpolateProvider.endSymbol(']]');
});
| {
"content_hash": "e67e9eb6738fc3cfb03a0e2b757c0754",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 79,
"avg_line_length": 24.133333333333333,
"alnum_prop": 0.6602209944751382,
"repo_name": "HugoMuller/battleship.js",
"id": "29c76faade63317e09f39b1ea0bbd87e21a2975c",
"size": "724",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/js/config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2979"
},
{
"name": "HTML",
"bytes": "5546"
},
{
"name": "JavaScript",
"bytes": "53993"
}
],
"symlink_target": ""
} |
""" Module for producing the Project Summary Report
Note: Much of this code was written by Pontus and lifted from
the SciLifeLab repo
"""
from collections import defaultdict, OrderedDict
import os
from string import ascii_uppercase as alphabets
import ngi_reports.reports
class Report(ngi_reports.reports.BaseReport):
## initialize class and assign basic variables
def __init__(self, LOG, working_dir, **kwargs):
# Initialise the parent class
super(Report, self).__init__(LOG, working_dir, **kwargs)
# general initialization
self.tables_info = defaultdict(dict)
self.report_info = {}
# report name and directory to be created
self.report_dir = os.path.join(working_dir, 'reports')
self.report_basename = ''
self.signature = kwargs.get('signature')
def generate_report_template(self, proj, template, support_email):
## Check and exit if signature not provided
if not self.signature:
self.LOG.error('It is required to provide Signature/Name while generating \'project_summary\' report, see -s opition in help')
raise SystemExit
else:
self.report_info['signature'] = self.signature
## Helper vars
seq_methods = OrderedDict()
## Get information for the report
self.report_basename = proj.ngi_name
self.report_info['support_email'] = support_email
self.report_info['dates'] = self.get_order_dates(proj.dates)
self.report_info['report_date'] = self.creation_date
self.report_info['accredit'] = self.get_accredit_info(proj.accredited, proj.library_construction, proj.ngi_name)
## Get sequecing method for the flowcell
seq_template = '{}) Samples were sequenced on {} ({}) with a {} setup '\
'using {}. The Bcl to FastQ conversion was performed using {} from the CASAVA software '\
'suite. The quality scale used is Sanger / phred33 / Illumina 1.8+.'
## Collect required information for all flowcell run for the project
for fc in proj.flowcells.values():
## Sort by the order of readss
run_setup = sorted(fc.run_setup, key=lambda k: k['Number'])
run_setup_text = ''
read_count = 0
index_count = 0
for read in run_setup:
run_setup_text += read['NumCycles']
run_setup_text += 'nt'
if read['IsIndexedRead'] == 'N':
read_count += 1
run_setup_text += '(Read'
run_setup_text += str(read_count)
elif read['IsIndexedRead'] == 'Y':
index_count += 1
run_setup_text += '(Index'
run_setup_text += str(index_count)
if run_setup.index(read) == len(run_setup)-1:
run_setup_text += ')'
else:
run_setup_text += ')-'
if fc.type == 'NovaSeq6000':
fc_chem = '\'{}\' workflow in \'{}\' mode flowcell'.format(fc.chemistry.get('WorkflowType'), fc.chemistry.get('FlowCellMode'))
elif fc.type == 'NextSeq500':
fc_chem = '\'{}-Output\' chemistry'.format(fc.chemistry.get('Chemistry'))
elif fc.type == 'NextSeq2000':
fc_chem = '\'{}\' flowcell'.format(fc.chemistry.get('Chemistry'))
else:
fc_chem = '\'{}\' chemistry'.format(fc.chemistry.get('Chemistry'))
applicationName = 'MSC' if fc.type == "MiSeq" else fc.seq_software.get('ApplicationName')
seq_software = "{} {}/RTA {}".format(applicationName, fc.seq_software.get('ApplicationVersion'), fc.seq_software.get('RTAVersion'))
tmp_method = seq_template.format('SECTION', fc.type, seq_software, run_setup_text, fc_chem, fc.casava)
## to make sure the sequencing methods are unique
if tmp_method not in list(seq_methods.keys()):
seq_methods[tmp_method] = alphabets[len(list(seq_methods.keys()))]
fc.seq_meth = seq_methods[tmp_method]
## give proper section name for the methods
self.report_info['sequencing_methods'] = "\n\n".join([m.replace('SECTION',seq_methods[m]) for m in seq_methods])
## Check if sequencing info is complete
if not self.report_info['sequencing_methods']:
self.LOG.warn('Sequencing methods may have some missing information, kindly check your inputs.')
###############################################################################
##### Create table text and header explanation from collected information #####
###############################################################################
## sample_info table
unit_magnitude = {'#reads' : '', 'Kreads': ' Thousand','Mreads': ' Million'}
sample_header = ['NGI ID', 'User ID', proj.samples_unit, '≥Q30']
sample_filter = ['ngi_id', 'customer_name', 'total_reads', 'qscore']
self.tables_info['tables']['sample_info'] = self.create_table_text(proj.samples.values(), filter_keys=sample_filter, header=sample_header)
self.tables_info['header_explanation']['sample_info'] = '* _NGI ID:_ Internal NGI sample identifier\n'\
'* _User ID:_ Sample name submitted by user\n'\
'* _{}:_ Total{} reads (or pairs) for a sample\n'\
'* _≥Q30:_ Aggregated percentage of bases that have a quality score ≥ Q30'\
.format(proj.samples_unit, unit_magnitude[proj.samples_unit])
## library_info table
library_header = ['NGI ID', 'Index', 'Lib Prep', 'Avg. FS', 'Lib QC']
library_filter = ['ngi_id', 'barcode', 'label', 'avg_size', 'qc_status']
library_list = []
for s, v in list(proj.samples.items()):
for p in list(v.preps.values()):
p = vars(p)
p['ngi_id'] = s
library_list.append(p)
self.tables_info['tables']['library_info'] = self.create_table_text(sorted(library_list, key=lambda d: d['ngi_id']), filter_keys=library_filter, header=library_header)
self.tables_info['header_explanation']['library_info'] = '* _NGI ID:_ Internal NGI sample identifier\n'\
'* _Index:_ Barcode sequence used for the sample\n'\
'* _Lib. Prep:_ NGI library identifier. The first library prep will be marked "A", the second "B" and so on.\n'\
'* _Avg. FS:_ Average fragment size of the library\n'\
'* _Lib. QC:_ Library quality control status\n'
## lanes_info table
lanes_header = ['Date', 'FC id', 'Lane', 'Cluster(M)', 'Phix', '≥Q30(%)', 'Method']
lanes_filter = ['date', 'name', 'id', 'cluster', 'phix', 'avg_qval', 'seq_meth']
lanes_list = []
for f, v in list(proj.flowcells.items()):
for l in list(v.lanes.values()):
l = vars(l)
l['date'] = v.date
l['name'] = v.name
l['seq_meth'] = v.seq_meth
lanes_list.append(l)
self.tables_info['tables']['lanes_info'] = self.create_table_text(sorted(lanes_list, key=lambda d: '{}_{}'.format(d['date'],d['id'])), filter_keys=lanes_filter, header=lanes_header)
self.tables_info['header_explanation']['lanes_info'] = '* _Date:_ Date of sequencing\n'\
'* _Flowcell:_ Flowcell identifier\n'\
'* _Lane:_ Flowcell lane number\n'\
'* _Clusters:_ Number of clusters that passed the read filters (millions)\n'\
'* _≥Q30:_ Aggregated percentage of bases that have a quality score ≥ Q30\n'\
'* _PhiX:_ Average PhiX error rate for the lane\n'\
'* _Method:_ Sequencing method used. See description under Sequencing heading above.\n'
# Make the file basename
output_bn = os.path.realpath(os.path.join(self.working_dir, self.report_dir, '{}_project_summary'.format(self.report_basename)))
# Parse the template
try:
md = template.render(project=proj, tables=self.tables_info['header_explanation'], report_info=self.report_info)
return {output_bn: md}
except:
self.LOG.error('Could not parse the project_summary template')
raise
#####################################################
##### Helper methods to get certain information #####
#####################################################
def create_table_text(self, ip, filter_keys=None, header=None, sep='\t'):
""" Create a single text string that will be saved in a file in TABLE format
from given dict and filtered based upon mentioned header.
:param dict/list ip: Input dictionary/list to be convertead as table string
:param list filter: A list of keys that will be used to filter the ip_dict
:param list header: A list that will be used as header
:param str sep: A string that will be used as separator
"""
op_string = []
if isinstance(ip, dict):
ip = list(ip.values())
if header:
op_string.append(sep.join(header))
if not filter_keys:
filter_keys = []
for i in ip:
filter_keys.extend(list(i.keys()))
filter_keys = sorted(list(set(filter_keys)))
for i in ip:
row = []
for k in filter_keys:
if type(i) is dict:
row.append(i.get(k,'NA'))
else:
row.append(getattr(i, k, 'NA'))
row = list(map(str, row))
op_string.append(sep.join(row))
return '\n'.join(op_string)
def get_order_dates(self, project_dates):
""" Get order dates as a markdown string. Ignore if unavailable
"""
dates = []
for item in project_dates:
if project_dates.get(item):
dates.append('_{}:_ {}'.format(item.replace('_', ' ').capitalize(), project_dates[item]))
return ', '.join(dates)
def get_accredit_info(self, accredit_dict, library_construction, proj_name):
"""Get swedac accreditation info for given step 'k'
:param Project proj: Project object containing details of the relevant project
"""
accredit_info = {}
for key in accredit_dict:
accredit = accredit_dict[key]
## For "finished library" projects, set certain accredation steps as "NA" even if not set by default
if key in ['library_preparation','data_analysis'] and library_construction == 'Library was prepared by user.':
accredit_info[key] = 'Not Applicable'
elif accredit in ['Yes','No']:
accredit_info[key] = '{} under ISO/IEC 17025'.format(['[cross] Not accredited','[tick] Accredited'][accredit == 'Yes'])
elif accredit == 'N/A':
accredit_info[key] = 'Not Applicable'
else:
self.LOG.error('Accreditation step {} for project {} is found, but no value is set'.format(key, proj_name))
return accredit_info
# Generate CSV files for the tables
def create_txt_files(self, op_dir=None):
""" Generate the CSV files for mentioned tables i.e. a dictionary with table name as key,
which will be used as file name and the content of file in single string as value to
put in the TXT file
:param str op_dir: Path where the TXT files should be created, current dir is default
"""
for tb_nm, tb_cont in list(self.tables_info['tables'].items()):
op_fl = '{}_{}.txt'.format(self.report_basename, tb_nm)
if op_dir:
op_fl = os.path.join(op_dir, op_fl)
with open(op_fl, 'w') as TXT:
TXT.write(tb_cont)
| {
"content_hash": "c1315132fe488177e4063d4008c42009",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 189,
"avg_line_length": 52.74688796680498,
"alnum_prop": 0.5313089993706733,
"repo_name": "NationalGenomicsInfrastructure/ngi_reports",
"id": "18eb547a209bba7a5a57b8771f6119b573c94c3f",
"size": "12747",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ngi_reports/reports/project_summary.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "87274"
},
{
"name": "Python",
"bytes": "58486"
},
{
"name": "TeX",
"bytes": "12112"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "5ae822552817686a50efba727ebf7973",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "33ee7f094a3283e9c0df7fae08105bdf4a0fb4e7",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Solanales/Solanaceae/Schizanthus/Schizanthus hookeri/Schizanthus hookeri calycosus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package jetbrains.mps.samples.VoiceMenuToXML;
/*Generated by MPS */
import jetbrains.mps.smodel.language.LanguageRuntime;
import jetbrains.mps.smodel.adapter.ids.SLanguageId;
import java.util.Collection;
import org.jetbrains.mps.openapi.language.SLanguage;
import jetbrains.mps.smodel.runtime.ILanguageAspect;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.smodel.language.LanguageExtensions;
public class Language extends LanguageRuntime {
private final SLanguageId myId;
public Language() {
myId = SLanguageId.deserialize("750ae49d-4f57-400c-b5dc-2b58c1e3f9a9");
}
@Override
public String getNamespace() {
return "jetbrains.mps.samples.VoiceMenuToXML";
}
@Override
public int getVersion() {
return 0;
}
public SLanguageId getId() {
return myId;
}
@Override
protected void fillExtendedLanguages(Collection<SLanguage> extendedLanguages) {
}
@Override
protected <T extends ILanguageAspect> T createAspect(Class<T> aspectClass) {
return null;
}
@Override
protected void contribute(@NotNull LanguageExtensions extensions) {
}
}
| {
"content_hash": "95791dcf945e0efe78c1e8264a4a0045",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 81,
"avg_line_length": 24.152173913043477,
"alnum_prop": 0.7632763276327633,
"repo_name": "vaclav/voicemenu",
"id": "b0272b51a9a566cd1a2909681b9e3f1dc0bf8f68",
"size": "1111",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "languages/jetbrains.mps.samples.VoiceMenuToXML/source_gen/jetbrains/mps/samples/VoiceMenuToXML/Language.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6045"
},
{
"name": "C++",
"bytes": "68399"
},
{
"name": "HTML",
"bytes": "18345"
},
{
"name": "Java",
"bytes": "1296825"
},
{
"name": "JetBrains MPS",
"bytes": "4775682"
},
{
"name": "Shell",
"bytes": "8303"
}
],
"symlink_target": ""
} |
package com.squareup.spoon;
import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.ITestRunListener;
import com.beust.jcommander.IStringConverter;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.google.common.collect.ImmutableSet;
import com.squareup.spoon.html.HtmlRenderer;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Strings.isNullOrEmpty;
import static com.squareup.spoon.DeviceTestResult.Status;
import static com.squareup.spoon.SpoonInstrumentationInfo.parseFromFile;
import static com.squareup.spoon.SpoonLogger.logDebug;
import static com.squareup.spoon.SpoonLogger.logInfo;
import static java.util.Collections.synchronizedSet;
/** Represents a collection of devices and the test configuration to be executed. */
public final class SpoonRunner {
private static final String DEFAULT_TITLE = "Spoon Execution";
public static final String DEFAULT_OUTPUT_DIRECTORY = "spoon-output";
private static final int DEFAULT_ADB_TIMEOUT = 10 * 60; //10 minutes
private final ExecutorService threadExecutor;
private final String title;
private final File androidSdk;
private final File applicationApk;
private final File instrumentationApk;
private final File output;
private final boolean debug;
private final boolean noAnimations;
private final int adbTimeout;
private final List<String> instrumentationArgs;
private final String className;
private final String methodName;
private final Set<String> serials;
private final String classpath;
private final IRemoteAndroidTestRunner.TestSize testSize;
private final boolean failIfNoDeviceConnected;
private final List<ITestRunListener> testRunListeners;
private final boolean terminateAdb;
private SpoonRunner(String title, File androidSdk, File applicationApk, File instrumentationApk,
File output, boolean debug, boolean noAnimations, int adbTimeout, Set<String> serials,
String classpath, List<String> instrumentationArgs, String className, String methodName,
IRemoteAndroidTestRunner.TestSize testSize, boolean failIfNoDeviceConnected,
List<ITestRunListener> testRunListeners, boolean sequential, boolean terminateAdb) {
this.title = title;
this.androidSdk = androidSdk;
this.applicationApk = applicationApk;
this.instrumentationApk = instrumentationApk;
this.output = output;
this.debug = debug;
this.noAnimations = noAnimations;
this.adbTimeout = adbTimeout;
this.instrumentationArgs = instrumentationArgs;
this.className = className;
this.methodName = methodName;
this.classpath = classpath;
this.testSize = testSize;
this.serials = ImmutableSet.copyOf(serials);
this.failIfNoDeviceConnected = failIfNoDeviceConnected;
this.testRunListeners = testRunListeners;
this.terminateAdb = terminateAdb;
if (sequential) {
this.threadExecutor = Executors.newSingleThreadExecutor();
} else {
this.threadExecutor = Executors.newCachedThreadPool();
}
}
/**
* Install and execute the tests on all specified devices.
*
* @return {@code true} if there were no test failures or exceptions thrown.
*/
public boolean run() {
checkArgument(applicationApk.exists(), "Could not find application APK.");
checkArgument(instrumentationApk.exists(), "Could not find instrumentation APK.");
AndroidDebugBridge adb = SpoonUtils.initAdb(androidSdk);
try {
// If we were given an empty serial set, load all available devices.
Set<String> serials = this.serials;
if (serials.isEmpty()) {
serials = SpoonUtils.findAllDevices(adb);
}
if (failIfNoDeviceConnected && serials.isEmpty()) {
throw new RuntimeException("No device(s) found.");
}
// Execute all the things...
SpoonSummary summary = runTests(adb, serials);
// ...and render to HTML
new HtmlRenderer(summary, SpoonUtils.GSON, output).render();
return parseOverallSuccess(summary);
} finally {
if (terminateAdb) {
AndroidDebugBridge.terminate();
}
}
}
private SpoonSummary runTests(AndroidDebugBridge adb, Set<String> serials) {
int targetCount = serials.size();
logInfo("Executing instrumentation suite on %d device(s).", targetCount);
try {
FileUtils.deleteDirectory(output);
} catch (IOException e) {
throw new RuntimeException("Unable to clean output directory: " + output, e);
}
final SpoonInstrumentationInfo testInfo = parseFromFile(instrumentationApk);
logDebug(debug, "Application: %s from %s", testInfo.getApplicationPackage(),
applicationApk.getAbsolutePath());
logDebug(debug, "Instrumentation: %s from %s", testInfo.getInstrumentationPackage(),
instrumentationApk.getAbsolutePath());
final SpoonSummary.Builder summary = new SpoonSummary.Builder().setTitle(title).start();
if (testSize != null) {
summary.setTestSize(testSize);
}
if (targetCount == 1) {
// Since there is only one device just execute it synchronously in this process.
String serial = serials.iterator().next();
String safeSerial = SpoonUtils.sanitizeSerial(serial);
try {
logDebug(debug, "[%s] Starting execution.", serial);
summary.addResult(safeSerial, getTestRunner(serial, testInfo).run(adb));
} catch (Exception e) {
logDebug(debug, "[%s] Execution exception!", serial);
e.printStackTrace(System.out);
summary.addResult(safeSerial, new DeviceResult.Builder().addException(e).build());
} finally {
logDebug(debug, "[%s] Execution done.", serial);
}
} else {
// Spawn a new thread for each device and wait for them all to finish.
final CountDownLatch done = new CountDownLatch(targetCount);
final Set<String> remaining = synchronizedSet(new HashSet<String>(serials));
for (final String serial : serials) {
final String safeSerial = SpoonUtils.sanitizeSerial(serial);
logDebug(debug, "[%s] Starting execution.", serial);
Runnable runnable = new Runnable() {
@Override public void run() {
try {
summary.addResult(safeSerial, getTestRunner(serial, testInfo).runInNewProcess());
} catch (Exception e) {
e.printStackTrace(System.out);
summary.addResult(safeSerial, new DeviceResult.Builder().addException(e).build());
} finally {
done.countDown();
remaining.remove(serial);
logDebug(debug, "[%s] Execution done. (%s remaining %s)", serial, done.getCount(),
remaining);
}
}
};
threadExecutor.execute(runnable);
}
try {
done.await();
threadExecutor.shutdown();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
if (!debug) {
// Clean up anything in the work directory.
try {
FileUtils.deleteDirectory(new File(output, SpoonDeviceRunner.TEMP_DIR));
} catch (IOException ignored) {
}
}
return summary.end().build();
}
/** Returns {@code false} if a test failed on any device. */
static boolean parseOverallSuccess(SpoonSummary summary) {
for (DeviceResult result : summary.getResults().values()) {
if (result.getInstallFailed()) {
return false; // App and/or test installation failed.
}
if (!result.getExceptions().isEmpty() && result.getTestResults().isEmpty()) {
return false; // No tests run and top-level exception present.
}
for (DeviceTestResult methodResult : result.getTestResults().values()) {
if (methodResult.getStatus() != Status.PASS) {
return false; // Individual test failure.
}
}
}
return true;
}
private SpoonDeviceRunner getTestRunner(String serial, SpoonInstrumentationInfo testInfo) {
return new SpoonDeviceRunner(androidSdk, applicationApk, instrumentationApk, output, serial,
debug, noAnimations, adbTimeout, classpath, testInfo, instrumentationArgs, className,
methodName, testSize, testRunListeners);
}
/** Build a test suite for the specified devices and configuration. */
public static class Builder {
private String title = DEFAULT_TITLE;
private File androidSdk;
private File applicationApk;
private File instrumentationApk;
private File output;
private boolean debug = false;
private Set<String> serials;
private String classpath = System.getProperty("java.class.path");
private List<String> instrumentationArgs;
private String className;
private String methodName;
private boolean noAnimations;
private IRemoteAndroidTestRunner.TestSize testSize;
private int adbTimeout;
private boolean failIfNoDeviceConnected;
private List<ITestRunListener> testRunListeners = new ArrayList<ITestRunListener>();
private boolean sequential;
private boolean terminateAdb = true;
/** Identifying title for this execution. */
public Builder setTitle(String title) {
checkNotNull(title, "Title cannot be null.");
this.title = title;
return this;
}
/** Path to the local Android SDK directory. */
public Builder setAndroidSdk(File androidSdk) {
checkNotNull(androidSdk, "SDK path not specified.");
checkArgument(androidSdk.exists(), "SDK path does not exist.");
this.androidSdk = androidSdk;
return this;
}
/** Path to application APK. */
public Builder setApplicationApk(File apk) {
checkNotNull(apk, "APK path not specified.");
checkArgument(apk.exists(), "APK path does not exist.");
this.applicationApk = apk;
return this;
}
/** Path to instrumentation APK. */
public Builder setInstrumentationApk(File apk) {
checkNotNull(apk, "Instrumentation APK path not specified.");
checkArgument(apk.exists(), "Instrumentation APK path does not exist.");
this.instrumentationApk = apk;
return this;
}
/** Path to output directory. */
public Builder setOutputDirectory(File output) {
checkNotNull(output, "Output directory not specified.");
this.output = output;
return this;
}
/** Whether or not debug logging is enabled. */
public Builder setDebug(boolean debug) {
this.debug = debug;
return this;
}
/** Whether or not animations are enabled. */
public Builder setNoAnimations(boolean noAnimations) {
this.noAnimations = noAnimations;
return this;
}
/** Set ADB timeout. */
public Builder setAdbTimeout(int value) {
this.adbTimeout = value;
return this;
}
/** Add a device serial for test execution. */
public Builder addDevice(String serial) {
checkNotNull(serial, "Serial cannot be null.");
checkArgument(serials == null || !serials.isEmpty(), "Already marked as using all devices.");
if (serials == null) {
serials = new LinkedHashSet<String>();
}
serials.add(serial);
return this;
}
/** Use all currently attached device serials when executed. */
public Builder useAllAttachedDevices() {
if (this.serials != null) {
throw new IllegalStateException("Serial list already contains entries.");
}
if (this.androidSdk == null) {
throw new IllegalStateException("SDK must be set before calling this method.");
}
this.serials = Collections.emptySet();
return this;
}
/** Classpath to use for new JVM processes. */
public Builder setClasspath(String classpath) {
checkNotNull(classpath, "Classpath cannot be null.");
this.classpath = classpath;
return this;
}
public Builder setInstrumentationArgs(List<String> instrumentationArgs) {
this.instrumentationArgs = instrumentationArgs;
return this;
}
public Builder setClassName(String className) {
this.className = className;
return this;
}
public Builder setTestSize(IRemoteAndroidTestRunner.TestSize testSize) {
this.testSize = testSize;
return this;
}
public Builder setFailIfNoDeviceConnected(boolean failIfNoDeviceConnected) {
this.failIfNoDeviceConnected = failIfNoDeviceConnected;
return this;
}
public Builder setSequential(boolean sequential) {
this.sequential = sequential;
return this;
}
public Builder setMethodName(String methodName) {
this.methodName = methodName;
return this;
}
public Builder addTestRunListener(ITestRunListener testRunListener) {
checkNotNull(testRunListener, "TestRunListener cannot be null.");
testRunListeners.add(testRunListener);
return this;
}
public Builder setTerminateAdb(boolean terminateAdb) {
this.terminateAdb = terminateAdb;
return this;
}
public SpoonRunner build() {
checkNotNull(androidSdk, "SDK is required.");
checkArgument(androidSdk.exists(), "SDK path does not exist.");
checkNotNull(applicationApk, "Application APK is required.");
checkNotNull(instrumentationApk, "Instrumentation APK is required.");
checkNotNull(output, "Output path is required.");
checkNotNull(serials, "Device serials are required.");
if (!isNullOrEmpty(methodName)) {
checkArgument(!isNullOrEmpty(className),
"Must specify class name if you're specifying a method name.");
}
return new SpoonRunner(title, androidSdk, applicationApk, instrumentationApk, output, debug,
noAnimations, adbTimeout, serials, classpath, instrumentationArgs, className, methodName,
testSize, failIfNoDeviceConnected, testRunListeners, sequential, terminateAdb);
}
}
static class CommandLineArgs {
@Parameter(names = { "--title" }, description = "Execution title") //
public String title = DEFAULT_TITLE;
@Parameter(names = { "--apk" }, description = "Application APK",
converter = FileConverter.class, required = true) //
public File apk;
@Parameter(names = { "--test-apk" }, description = "Test application APK",
converter = FileConverter.class, required = true) //
public File testApk;
@Parameter(names = { "--e" },
description = "Arguments to pass to the Instrumentation Runner. This can be used multiple"
+ " times for multiple entries. Usage: --e <NAME>=<VALUE>.")
public List<String> instrumentationArgs;
@Parameter(names = { "--class-name" }, description = "Test class name to run (fully-qualified)")
public String className;
@Parameter(names = { "--method-name" },
description = "Test method name to run (must also use --class-name)") //
public String methodName;
@Parameter(names = { "--size" }, converter = TestSizeConverter.class,
description = "Only run methods with corresponding size annotation (small, medium, large)")
public IRemoteAndroidTestRunner.TestSize size;
@Parameter(names = { "--output" }, description = "Output path",
converter = FileConverter.class) //
public File output = cleanFile(SpoonRunner.DEFAULT_OUTPUT_DIRECTORY);
@Parameter(names = { "--sdk" }, description = "Path to Android SDK") //
public File sdk = cleanFile(System.getenv("ANDROID_HOME"));
@Parameter(names = { "--fail-on-failure" }, description = "Non-zero exit code on failure")
public boolean failOnFailure;
@Parameter(names = { "--fail-if-no-device-connected" },
description = "Fail if no device is connected") //
public boolean failIfNoDeviceConnected;
@Parameter(names = { "--sequential" },
description = "Execute tests sequentially (one device at a time)") //
public boolean sequential;
@Parameter(names = { "--no-animations" }, description = "Disable animated gif generation")
public boolean noAnimations;
@Parameter(names = { "--adb-timeout" },
description = "Set maximum execution time per test in seconds (10min default)") //
public int adbTimeoutSeconds = DEFAULT_ADB_TIMEOUT;
@SuppressWarnings("MismatchedQueryAndUpdateOfCollection") //
@Parameter(names = "-serial",
description = "Serial of the device to use (May be used multiple times)")
private List<String> serials = new ArrayList<String>();
@Parameter(names = { "--debug" }, hidden = true) //
public boolean debug;
@Parameter(names = { "-h", "--help" }, description = "Command help", help = true, hidden = true)
public boolean help;
}
private static File cleanFile(String path) {
if (path == null) {
return null;
}
return new File(path);
}
/* JCommander deems it necessary that this class be public. Lame. */
public static class FileConverter implements IStringConverter<File> {
@Override public File convert(String s) {
return cleanFile(s);
}
}
public static class TestSizeConverter
implements IStringConverter<IRemoteAndroidTestRunner.TestSize> {
@Override public IRemoteAndroidTestRunner.TestSize convert(String value) {
try {
return IRemoteAndroidTestRunner.TestSize.getTestSize(value);
} catch (IllegalArgumentException e) {
throw new ParameterException(e.getMessage());
}
}
}
public static void main(String... args) {
CommandLineArgs parsedArgs = new CommandLineArgs();
JCommander jc = new JCommander(parsedArgs);
try {
jc.parse(args);
} catch (ParameterException e) {
StringBuilder out = new StringBuilder(e.getLocalizedMessage()).append("\n\n");
jc.usage(out);
System.err.println(out.toString());
System.exit(1);
return;
}
if (parsedArgs.help) {
jc.usage();
return;
}
Builder builder = new SpoonRunner.Builder() //
.setTitle(parsedArgs.title)
.setApplicationApk(parsedArgs.apk)
.setInstrumentationApk(parsedArgs.testApk)
.setOutputDirectory(parsedArgs.output)
.setDebug(parsedArgs.debug)
.setAndroidSdk(parsedArgs.sdk)
.setNoAnimations(parsedArgs.noAnimations)
.setTestSize(parsedArgs.size)
.setAdbTimeout(parsedArgs.adbTimeoutSeconds * 1000)
.setFailIfNoDeviceConnected(parsedArgs.failIfNoDeviceConnected)
.setSequential(parsedArgs.sequential)
.setInstrumentationArgs(parsedArgs.instrumentationArgs)
.setClassName(parsedArgs.className)
.setMethodName(parsedArgs.methodName);
if (parsedArgs.serials == null || parsedArgs.serials.isEmpty()) {
builder.useAllAttachedDevices();
} else {
for (String serial : parsedArgs.serials) {
builder.addDevice(serial);
}
}
SpoonRunner spoonRunner = builder.build();
if (!spoonRunner.run() && parsedArgs.failOnFailure) {
System.exit(1);
}
}
}
| {
"content_hash": "33d679e7ed508423d6b4fbe7faa2c8a6",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 100,
"avg_line_length": 36.659176029962545,
"alnum_prop": 0.6872190437270127,
"repo_name": "hulingCK/spoon",
"id": "4e8eb3f212317a5d30ca74bb50cd2b0d13b4db8c",
"size": "19576",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "spoon-runner/src/main/java/com/squareup/spoon/SpoonRunner.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "17234"
},
{
"name": "HTML",
"bytes": "1863801"
},
{
"name": "Java",
"bytes": "265122"
},
{
"name": "Shell",
"bytes": "2375"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("02. Match Phone Number")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("02. Match Phone Number")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d4365222-df80-4fff-a963-65476d95fc6e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "879ad04e34bb6cb4efcc88874a8ed0f6",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.22222222222222,
"alnum_prop": 0.7457507082152974,
"repo_name": "damyan91/CSharp-Advanced",
"id": "3c53302eddcc6f5e16698e9c3749de6206a79218",
"size": "1415",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CSharp Fundamentals/Exercises/Regular Expressions - Exercises/02. Match Phone Number/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "608913"
}
],
"symlink_target": ""
} |
package org.apache.ignite.internal.processors.cache.distributed.dht.atomic;
import org.apache.ignite.internal.processors.affinity.*;
import org.apache.ignite.internal.processors.cache.*;
/**
* DHT atomic cache entry for off-heap tiered or off-heap values modes.
*/
public class GridDhtAtomicOffHeapCacheEntry extends GridDhtAtomicCacheEntry {
/** Off-heap value pointer. */
private long valPtr;
/**
* @param ctx Cache context.
* @param topVer Topology version at the time of creation (if negative, then latest topology is assumed).
* @param key Cache key.
* @param hash Key hash value.
* @param val Entry value.
* @param next Next entry in the linked list.
* @param hdrId Header id.
*/
public GridDhtAtomicOffHeapCacheEntry(GridCacheContext ctx,
AffinityTopologyVersion topVer,
KeyCacheObject key,
int hash,
CacheObject val,
GridCacheMapEntry next,
int hdrId) {
super(ctx, topVer, key, hash, val, next, hdrId);
}
/** {@inheritDoc} */
@Override protected boolean hasOffHeapPointer() {
return valPtr != 0;
}
/** {@inheritDoc} */
@Override protected long offHeapPointer() {
return valPtr;
}
/** {@inheritDoc} */
@Override protected void offHeapPointer(long valPtr) {
this.valPtr = valPtr;
}
}
| {
"content_hash": "d8c5a67732f237c6f0e6555d4cde585b",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 109,
"avg_line_length": 28.958333333333332,
"alnum_prop": 0.6489208633093525,
"repo_name": "avinogradovgg/ignite",
"id": "91a8e657bc3d3c1ce7fe7f22d3e063927d1d2269",
"size": "2192",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicOffHeapCacheEntry.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "31291"
},
{
"name": "C#",
"bytes": "160354"
},
{
"name": "C++",
"bytes": "28098"
},
{
"name": "CSS",
"bytes": "17517"
},
{
"name": "Groovy",
"bytes": "15102"
},
{
"name": "HTML",
"bytes": "4669"
},
{
"name": "Java",
"bytes": "19506508"
},
{
"name": "JavaScript",
"bytes": "1085"
},
{
"name": "PHP",
"bytes": "11079"
},
{
"name": "Scala",
"bytes": "653258"
},
{
"name": "Shell",
"bytes": "396961"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<service xmlns="http://zstack.org/schema/zstack">
<id>network.service</id>
<interceptor>NetworkServiceApiInterceptor</interceptor>
<message>
<name>org.zstack.header.network.service.APIQueryNetworkServiceProviderMsg</name>
</message>
<message>
<name>org.zstack.header.network.service.APIGetNetworkServiceTypesMsg</name>
</message>
<message>
<name>org.zstack.header.network.service.APIAttachNetworkServiceProviderToL2NetworkMsg</name>
</message>
</service>
| {
"content_hash": "05f6c01538d6a87aaab691fca3e4051c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 100,
"avg_line_length": 30.77777777777778,
"alnum_prop": 0.7129963898916968,
"repo_name": "AlanJager/zstack",
"id": "c9917eb28c52319baa1437a4b994d6f9b7f70316",
"size": "554",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "conf/serviceConfig/networkService.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "4616"
},
{
"name": "AspectJ",
"bytes": "74681"
},
{
"name": "Batchfile",
"bytes": "2932"
},
{
"name": "Groovy",
"bytes": "6776667"
},
{
"name": "Java",
"bytes": "26341557"
},
{
"name": "Python",
"bytes": "1062162"
},
{
"name": "Shell",
"bytes": "176428"
}
],
"symlink_target": ""
} |
<?php
namespace Sylius\Bundle\ShippingBundle\DependencyInjection;
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
/**
* @author Paweł Jędrzejewski <[email protected]>
*/
final class SyliusShippingExtension extends AbstractResourceExtension
{
/**
* {@inheritdoc}
*/
public function load(array $config, ContainerBuilder $container)
{
$config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load(sprintf('services/integrations/%s.xml', $config['driver']));
$this->registerResources('sylius', $config['driver'], $config['resources'], $container);
$this->mapFormValidationGroupsParameters($config, $container);
$loader->load('services.xml');
}
}
| {
"content_hash": "ec13b43d162c9d1c9f1a714d3440afdd",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 101,
"avg_line_length": 34,
"alnum_prop": 0.732620320855615,
"repo_name": "PyRowMan/Sylius",
"id": "39175a60d19c016d60cf6fdcba5b2d6f0ecf5b18",
"size": "1335",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/Sylius/Bundle/ShippingBundle/DependencyInjection/SyliusShippingExtension.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "601"
},
{
"name": "CSS",
"bytes": "1792"
},
{
"name": "Cucumber",
"bytes": "720724"
},
{
"name": "HTML",
"bytes": "251437"
},
{
"name": "JavaScript",
"bytes": "50121"
},
{
"name": "PHP",
"bytes": "6012228"
},
{
"name": "Shell",
"bytes": "27681"
}
],
"symlink_target": ""
} |
class Payment
include Mongoid::Document
MIN_YEAR = 2016
MAX_YEAR = Time.now.year
MIN_MONTH = 1
MAX_MONTH = 12
field :year, type: Integer
field :month, type: Integer
field :total, type: Float
field :eventual, type: Float
field :net_salary, type: Float
belongs_to :employee
validates :year, presence: true, numericality: {
only_integer: true, greater_than_or_equal_to: MIN_YEAR,
less_than_or_equal_to: MAX_YEAR
}
validates :month, presence: true, numericality: {
only_integer: true, greater_than_or_equal_to: MIN_MONTH,
less_than_or_equal_to: MAX_MONTH
}
validates :total, presence: true, numericality: {
only_integer: false
}
def ==(obj)
return false if obj.nil?
return false unless self.class == obj.class
(
(self.total == obj.total) &&
(self.eventual == obj.eventual) &&
(self.month == obj.month) &&
(self.year == obj.year)
)
end
end | {
"content_hash": "de5fdb133268e009409ce4639750072f",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 59,
"avg_line_length": 23.425,
"alnum_prop": 0.6446104589114194,
"repo_name": "radarpgcs/radar-pgcs",
"id": "44a16575d5f64d23544348e93983e786e36ccc41",
"size": "937",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/models/payment.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3172"
},
{
"name": "CoffeeScript",
"bytes": "633"
},
{
"name": "HTML",
"bytes": "31232"
},
{
"name": "JavaScript",
"bytes": "1406"
},
{
"name": "Ruby",
"bytes": "106541"
}
],
"symlink_target": ""
} |
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.InteropServices;
namespace Toolkit
{
public class Hotkey : IMessageFilter
{
#region Interop
[DllImport("user32.dll", SetLastError = true)]
private static extern int RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, Keys vk);
[DllImport("user32.dll", SetLastError=true)]
private static extern int UnregisterHotKey(IntPtr hWnd, int id);
private const uint WM_HOTKEY = 0x312;
private const uint MOD_ALT = 0x1;
private const uint MOD_CONTROL = 0x2;
private const uint MOD_SHIFT = 0x4;
private const uint MOD_WIN = 0x8;
private const uint ERROR_HOTKEY_ALREADY_REGISTERED = 1409;
#endregion
private static int currentID;
private const int maximumID = 0xBFFF;
private Keys keyCode;
private bool shift;
private bool control;
private bool alt;
private bool windows;
[XmlIgnore]
private int id;
[XmlIgnore]
private bool registered;
[XmlIgnore]
private Control windowControl;
public event HandledEventHandler Pressed;
public Hotkey() : this(Keys.None, false, false, false, false)
{
// No work done here!
}
public Hotkey(Keys keyCode, bool shift, bool control, bool alt, bool windows)
{
// Assign properties
this.KeyCode = keyCode;
this.Shift = shift;
this.Control = control;
this.Alt = alt;
this.Windows = windows;
// Register us as a message filter
Application.AddMessageFilter(this);
}
~Hotkey()
{
// Unregister the hotkey if necessary
if (this.Registered)
{ this.Unregister(); }
}
public Hotkey Clone()
{
// Clone the whole object
return new Hotkey(this.keyCode, this.shift, this.control, this.alt, this.windows);
}
public bool GetCanRegister(Control windowControl)
{
// Handle any exceptions: they mean "no, you can't register" :)
try
{
// Attempt to register
if (!this.Register(windowControl))
{ return false; }
// Unregister and say we managed it
this.Unregister();
return true;
}
catch (Win32Exception)
{ return false; }
catch (NotSupportedException)
{ return false; }
}
public bool Register(Control windowControl)
{
// Check that we have not registered
if (this.registered)
{ throw new NotSupportedException("You cannot register a hotkey that is already registered"); }
// We can't register an empty hotkey
if (this.Empty)
{ throw new NotSupportedException("You cannot register an empty hotkey"); }
// Get an ID for the hotkey and increase current ID
this.id = Hotkey.currentID;
Hotkey.currentID = Hotkey.currentID + 1 % Hotkey.maximumID;
// Translate modifier keys into unmanaged version
uint modifiers = (this.Alt ? Hotkey.MOD_ALT : 0) | (this.Control ? Hotkey.MOD_CONTROL : 0) |
(this.Shift ? Hotkey.MOD_SHIFT : 0) | (this.Windows ? Hotkey.MOD_WIN : 0);
// Register the hotkey
if (Hotkey.RegisterHotKey(windowControl.Handle, this.id, modifiers, keyCode) == 0)
{
// Is the error that the hotkey is registered?
if (Marshal.GetLastWin32Error() == ERROR_HOTKEY_ALREADY_REGISTERED)
{ return false; }
else
{ throw new Win32Exception(); }
}
// Save the control reference and register state
this.registered = true;
this.windowControl = windowControl;
// We successfully registered
return true;
}
public void Unregister()
{
// Check that we have registered
if (!this.registered)
{ throw new NotSupportedException("You cannot unregister a hotkey that is not registered"); }
// It's possible that the control itself has died: in that case, no need to unregister!
if (!this.windowControl.IsDisposed)
{
// Clean up after ourselves
if (Hotkey.UnregisterHotKey(this.windowControl.Handle, this.id) == 0)
{ throw new Win32Exception(); }
}
// Clear the control reference and register state
this.registered = false;
this.windowControl = null;
}
private void Reregister()
{
// Only do something if the key is already registered
if (!this.registered)
{ return; }
// Save control reference
Control windowControl = this.windowControl;
// Unregister and then reregister again
this.Unregister();
this.Register(windowControl);
}
public bool PreFilterMessage(ref Message message)
{
// Only process WM_HOTKEY messages
if (message.Msg != Hotkey.WM_HOTKEY)
{ return false; }
// Check that the ID is our key and we are registerd
if (this.registered && (message.WParam.ToInt32() == this.id))
{
// Fire the event and pass on the event if our handlers didn't handle it
return this.OnPressed();
}
else
{ return false; }
}
private bool OnPressed()
{
// Fire the event if we can
HandledEventArgs handledEventArgs = new HandledEventArgs(false);
if (this.Pressed != null)
{ this.Pressed(this, handledEventArgs); }
// Return whether we handled the event or not
return handledEventArgs.Handled;
}
public override string ToString()
{
// We can be empty
if (this.Empty)
{ return "(none)"; }
// Build key name
string keyName = Enum.GetName(typeof(Keys), this.keyCode);;
switch (this.keyCode)
{
case Keys.D0:
case Keys.D1:
case Keys.D2:
case Keys.D3:
case Keys.D4:
case Keys.D5:
case Keys.D6:
case Keys.D7:
case Keys.D8:
case Keys.D9:
// Strip the first character
keyName = keyName.Substring(1);
break;
default:
// Leave everything alone
break;
}
// Build modifiers
string modifiers = "";
if (this.shift)
{ modifiers += "Shift+"; }
if (this.control)
{ modifiers += "Control+"; }
if (this.alt)
{ modifiers += "Alt+"; }
if (this.windows)
{ modifiers += "Windows+"; }
// Return result
return modifiers + keyName;
}
public bool Empty
{
get { return this.keyCode == Keys.None; }
}
public bool Registered
{
get { return this.registered; }
}
public Keys KeyCode
{
get { return this.keyCode; }
set
{
// Save and reregister
this.keyCode = value;
this.Reregister();
}
}
public bool Shift
{
get { return this.shift; }
set
{
// Save and reregister
this.shift = value;
this.Reregister();
}
}
public bool Control
{
get { return this.control; }
set
{
// Save and reregister
this.control = value;
this.Reregister();
}
}
public bool Alt
{
get { return this.alt; }
set
{
// Save and reregister
this.alt = value;
this.Reregister();
}
}
public bool Windows
{
get { return this.windows; }
set
{
// Save and reregister
this.windows = value;
this.Reregister();
}
}
}
}
| {
"content_hash": "1a9c79581c7eeef21d485396864b92b3",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 98,
"avg_line_length": 23.5,
"alnum_prop": 0.6281527405946175,
"repo_name": "hilts-vaughan/inspire",
"id": "ef607dcee9d6b825156151b3ef70c82dfb6dcda8",
"size": "7097",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Forge/Toolkit/Hotkey.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1725136"
},
{
"name": "CSS",
"bytes": "22879"
},
{
"name": "CoffeeScript",
"bytes": "341"
},
{
"name": "JavaScript",
"bytes": "48315"
},
{
"name": "Shell",
"bytes": "1014"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<recipeml version="0.5">
<recipe>
<head>
<title>Abm Pizza Dough</title>
<categories>
<cat>None</cat></categories>
<yield>1</yield></head>
<ingredients>
<ing>
<amt>
<qty>7/8</qty>
<unit>cups</unit></amt>
<item>Water; (120F/50C)</item></ing>
<ing>
<amt>
<qty>1</qty>
<unit>tablespoon</unit></amt>
<item>Olive oil</item></ing>
<ing>
<amt>
<qty>2</qty>
<unit>teaspoons</unit></amt>
<item>Sugar</item></ing>
<ing>
<amt>
<qty>1</qty>
<unit>teaspoon</unit></amt>
<item>Salt</item></ing>
<ing>
<amt>
<qty>2</qty>
<unit>cups</unit></amt>
<item>All-purpose flour</item></ing>
<ing>
<amt>
<qty>2</qty>
<unit>teaspoons</unit></amt>
<item>Quick-Rise Instant yeast</item></ing></ingredients>
<directions>
<step> Place dough ingredients into the bread pan in order given.
Use Dough program. When finished remove dough from the bread pan and place
in a greased bowl, turning to coat evenly. Cover and let dough rest for 10
minutes OR cover and refrigerate overnight.
Roll dough into a 12" pizza pan or a 13"x9" greased pan. Raise the edges a
bit. Put on toppings.
Cook topped pizza for 20 - 25 minutes at 425F (220C).
Notes: Remove refrigerated dough from 'fridge about 1 hour before using.
All-purpose white flour may be replaced with equal parts white and whole
wheat.
Posted to TNT Recipes Digest by Rod Grant <[email protected]> on Mar 22,
1998
</step></directions></recipe></recipeml>
| {
"content_hash": "35a91ad6631edf501531230a0d24c0ac",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 80,
"avg_line_length": 30.45762711864407,
"alnum_prop": 0.5592654424040067,
"repo_name": "coogle/coogle-recipes",
"id": "f1767bf2d13484e766b89b2477d0a7ef024018b2",
"size": "1797",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "extras/recipes/Abm_Pizza_Dough.xml",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Blade",
"bytes": "70365"
},
{
"name": "CSS",
"bytes": "2508"
},
{
"name": "HTML",
"bytes": "1294"
},
{
"name": "JavaScript",
"bytes": "1133"
},
{
"name": "PHP",
"bytes": "130922"
},
{
"name": "Puppet",
"bytes": "23814"
},
{
"name": "SCSS",
"bytes": "1015"
},
{
"name": "Shell",
"bytes": "3538"
},
{
"name": "Vue",
"bytes": "559"
}
],
"symlink_target": ""
} |
export enum NgxLegendItemColor {
GREEN = 'green',
PURPLE = 'purple',
LIGHT_PURPLE = 'light-purple',
BLUE = 'blue',
YELLOW = 'yellow',
}
| {
"content_hash": "b0231fd786478c2bba03a5e0497b8593",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 32,
"avg_line_length": 20.857142857142858,
"alnum_prop": 0.6301369863013698,
"repo_name": "nvhlottehpt/gitdemo",
"id": "96b411dd82fcae7d2c6bee3ea19ad5c28a4d88f9",
"size": "146",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "src/app/pages/e-commerce/legend-chart/enum.legend-item-color.ts",
"mode": "33261",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<div class="padding">
<p class="m-b-md"><strong>Dropzone</strong> <a href="http://www.dropzonejs.com/" target="blank"><i class="fa fa-link text-muted"></i></a></p>
<p class="text-muted">DropzoneJS is an open source library that provides drag’n’drop file uploads with image previews.</p>
<form action="api/dropzone" class="dropzone white">
<div class="dz-message" ui-jp="dropzone" ui-options="{ url: 'api/dropzone' }">
<h4 class="m-t-lg m-b-md">Drop files here or click to upload.</h4>
<span class="text-muted block m-b-lg">(This is just a demo dropzone. Selected files are <strong>not</strong> actually uploaded.)</span>
</div>
</form>
</div>
| {
"content_hash": "386c7c3ddd449824daf08a79187b2bec",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 143,
"avg_line_length": 67.5,
"alnum_prop": 0.6666666666666666,
"repo_name": "MR-MONGOOSE/alpha",
"id": "62d33e6b4394c7ab1c57316be3e9264a4f07f2c6",
"size": "679",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "flatkit/views/form/form.dropzone.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "576954"
},
{
"name": "HTML",
"bytes": "1113086"
},
{
"name": "JavaScript",
"bytes": "1140600"
},
{
"name": "PHP",
"bytes": "414"
}
],
"symlink_target": ""
} |
package types
import (
"os"
. "gopkg.in/check.v1"
)
func (s *NodeSuite) TestHostname(c *C) {
h, err := os.Hostname()
// Unmodified node-name value is either os.Hostname if available or
// "localhost" otherwise
if err != nil {
c.Assert(GetName(), Equals, "localhost")
} else {
c.Assert(GetName(), Equals, h)
}
newName := "foo.domain"
SetName(newName)
c.Assert(GetName(), Equals, newName)
}
| {
"content_hash": "ea4035310ec2eaa5d24ff6fccca55df3",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 17.782608695652176,
"alnum_prop": 0.6528117359413202,
"repo_name": "tgraf/cilium",
"id": "b21f3ff87784464e71b14c0e4a27d7254e4f95a6",
"size": "1038",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "pkg/node/types/nodename_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1109708"
},
{
"name": "C++",
"bytes": "6557"
},
{
"name": "Dockerfile",
"bytes": "27333"
},
{
"name": "Go",
"bytes": "9930421"
},
{
"name": "HCL",
"bytes": "1127"
},
{
"name": "Makefile",
"bytes": "72210"
},
{
"name": "Mustache",
"bytes": "1457"
},
{
"name": "Python",
"bytes": "11099"
},
{
"name": "Ruby",
"bytes": "392"
},
{
"name": "Shell",
"bytes": "369722"
},
{
"name": "SmPL",
"bytes": "6540"
},
{
"name": "Smarty",
"bytes": "10858"
},
{
"name": "TeX",
"bytes": "416"
},
{
"name": "sed",
"bytes": "1336"
}
],
"symlink_target": ""
} |
@interface AppDelegate (Baichuan)
@end
| {
"content_hash": "003737cbfe900a4b00e505b478e2f1ef",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 33,
"avg_line_length": 19.5,
"alnum_prop": 0.7948717948717948,
"repo_name": "wenin819/cordova-plugin-baichuan",
"id": "7719f43894ec7722cce966a16f90e16075cc395c",
"size": "137",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/ios/AppDelegate+Baichuan.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "13428"
},
{
"name": "JavaScript",
"bytes": "2759"
},
{
"name": "Objective-C",
"bytes": "284577"
},
{
"name": "Ruby",
"bytes": "1752"
}
],
"symlink_target": ""
} |
package rancher
import (
"errors"
"fmt"
"time"
rancherClient "github.com/rancher/go-rancher/v2"
)
func backoff(maxDuration time.Duration, timeoutMessage string, f func() (bool, error)) error {
startTime := time.Now()
waitTime := 150 * time.Millisecond
maxWaitTime := 2 * time.Second
for {
if time.Now().Sub(startTime) > maxDuration {
return errors.New(timeoutMessage)
}
if done, err := f(); err != nil {
return err
} else if done {
return nil
}
time.Sleep(waitTime)
waitTime *= 2
if waitTime > maxWaitTime {
waitTime = maxWaitTime
}
}
}
// WaitFor waits for a resource to reach a certain state.
func (r *Client) WaitFor(resource *rancherClient.Resource, output interface{}, transitioning func() string) error {
return backoff(2*time.Minute, fmt.Sprintf("Time out waiting for %s:%s to become active", resource.Type, resource.Id), func() (bool, error) {
err := r.client.Reload(resource, output)
if err != nil {
return false, err
}
if transitioning() != "yes" {
return true, nil
}
return false, nil
})
}
// WaitService waits for a loadbalancer resource to transition
func (r *Client) WaitService(service *rancherClient.Service) error {
return r.WaitFor(&service.Resource, service, func() string {
return service.Transitioning
})
}
// WaitLoadBalancerService waits for a loadbalancer service resource to transition
func (r *Client) WaitLoadBalancerService(lb *rancherClient.LoadBalancerService) error {
return r.WaitFor(&lb.Resource, lb, func() string {
return lb.Transitioning
})
}
// WaitCertificate waits for a certificate resource to transition
func (r *Client) WaitCertificate(certificate *rancherClient.Certificate) error {
return r.WaitFor(&certificate.Resource, certificate, func() string {
return certificate.Transitioning
})
}
| {
"content_hash": "2e645943b1b565612794dca92afaabb8",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 141,
"avg_line_length": 26.691176470588236,
"alnum_prop": 0.7168044077134986,
"repo_name": "janeczku/rancher-letsencrypt",
"id": "2b75023f7ee77f93a6e4aea815aefcc0a8a98bb9",
"size": "1815",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rancher/wait.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "41210"
},
{
"name": "Makefile",
"bytes": "2440"
},
{
"name": "Shell",
"bytes": "1110"
}
],
"symlink_target": ""
} |
{% load static %}
{% load i18n %}
{% load cache %}
{% get_current_language as CURRENT_LANGUAGE %}
<!DOCTYPE html>
<html lang="{{ CURRENT_LANGUAGE }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta property="og:type" content="website">
<meta property="og:site_name" content="Dorokhin.Moscow">
<link rel="image_src" href="https://Dorokhin.Moscowm/{% static '/images/main.jpg' %}">
<meta property="og:image" content="https://Dorokhin.Moscow/{% static '/images/main.jpg' %}">
<meta property="og:image:width" content="800">
<meta property="og:image:height" content="800">
<meta property="og:title" content="Разработка на Python">
<meta property="og:description" content="Различная информация о разработке на Python, API, HighLoad">
<meta name="theme-color" content="#858084">
<meta name="referrer" content="unsafe-url">
<meta name="author" content="Andrew Dorokhin">
<link rel="icon" type="image/png" href="{% static '/favicon.png' %}" />
<title>{% block title %}Blog - Dorokhin.Moscow{% endblock %}</title>
{% block extrastyle %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="{% static '/css/hljs/monokai-sublime.css' %}" rel="stylesheet">
<link href="{% static '/css/cropper.css' %}" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
{% endblock %}
{% block css_files %}
<link href="{% static '/blog/css/blog.css' %}" rel="stylesheet">
{% endblock %}
{% block fonts %}
<link href="https://fonts.googleapis.com/css?family=Playfair+Display:700,900" rel="stylesheet">
{% endblock %}
</head>
<body>
<div class="container">
<header class="blog-header py-3">
<div class="row flex-nowrap justify-content-between align-items-center">
<div class="col-4 pt-1 d-none d-lg-block">
<a class="text-muted" href="/">Главная</a>
</div>
<div class="col-4 text-center">
<a class="blog-header-logo text-dark" href="{% url 'blog:ArticleList' %}">Dorokhin.Moscow</a>
</div>
<div class="col-4 d-none d-md-flex justify-content-end align-items-center ">
<a class="text-muted" href="#">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mx-3"><circle cx="10.5" cy="10.5" r="7.5"></circle><line x1="21" y1="21" x2="15.8" y2="15.8"></line></svg>
</a>
{% cache 500 userbar request.user.username %}
<ul class="navbar-nav">
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
{{ user.username.title }}
</a>
<div class="dropdown-menu dropdown-menu-right">
<h6 class="dropdown-header">
<img src="{{ user.profile.avatar.url }}" width="50px" height="50px" class="rounded-circle">
{{ user.first_name }} {{ user.last_name }}
</h6>
{% if user.is_staff %}
<a class="dropdown-item" href="/admin">
{% blocktrans %}Админка{% endblocktrans %}
{% if user.is_superuser %}<span class="badge badge-danger">{% blocktrans %}root{% endblocktrans %}</span>{% endif %}
</a>
<a class="dropdown-item" href="{% url 'phone:index' %}">{% blocktrans %}Тел.Справочник{% endblocktrans %}</a>
<a class="dropdown-item" href="{% url 'realty:index' %}">{% blocktrans %}Недвижимость{% endblocktrans %}</a>
{% endif %}
<a class="dropdown-item" href="{% url 'extended_profile:profile' user.id %}">{% blocktrans %}Профиль{% endblocktrans %}</a>
<a class="dropdown-item text-danger" href="/logout">{% blocktrans %}Выйти{% endblocktrans %}</a>
</div>
</li>
{% else %}
<a class="btn btn-sm btn-outline-success" href="{% url 'extended_profile:login' %}">{% blocktrans %}Войти{% endblocktrans %}</a>
{% endif %}
</ul>
{% endcache %}
</div>
</div>
</header>
{% cache 60 categories request.user.username %}
<!-- Blog Categories -->
{% if categories %}
<div class="nav-scroller py-1 mb-2">
<nav class="nav d-flex justify-content-between">
{% for cat in categories %}
<a class="p-2 text-muted" href="{{ cat.get_absolute_url }}">{{ cat.name }}</a>
{% endfor %}
</nav>
</div>
{% endif %}
{% endcache %}
{% if latest_post %}
<div class="jumbotron p-3 p-md-5 text-white rounded bg-dark">
<div class="col-md-12 px-0">
<h1 class="display-4 font-italic">{{ latest_post.name }}</h1>
<p class="lead my-4">{{ latest_post.description|safe }}</p>
<p class="lead mb-0"><a href="{{ latest_post.get_absolute_url }}" class="text-white font-weight-bold">Продолжить чтение...</a></p>
</div>
</div>
{% endif %}
{% if featured_posts %}
<div class="row mb-2">
{% for post in featured_posts %}
<div class="col-md-6">
<div class="card flex-md-row mb-4 box-shadow h-md-280">
<div class="card-body d-flex flex-column align-items-start">
<strong class="d-inline-block mb-2 text-success">{{ post.category }}</strong>
<h4 class="mb-0">
<a class="text-dark" href="{{ post.get_absolute_url }}">{{ post.name|truncatewords:7 }}</a>
</h4>
<div class="mb-1 text-muted">{{ post.created|date:'d.m.Y' }}</div>
<p class="card-text lg-auto">{{ post.description|safe|truncatewords:2 }}</p>
<a href="{{ post.get_absolute_url }}" class="btn btn-outline-secondary">Продолжить чтение...</a>
</div>
{% if post.category.image %}
<img class="card-img-right flex-auto d-none d-xl-block" alt="Thumbnail" src="{{ post.category.image.url }}" style="width: 200px; height: 240px; padding: 0.5em">
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% block content %}{% endblock %}
<footer class="blog-footer">
<p>© 2017 <a href="https://dorokhin.moscow/">Andrew Dorokhin</a> - Django version: {{ django_version }}</p>
<a href="#" class="go-top">Наверх</a>
</footer>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/holder/2.9.4/holder.min.js"></script>
<script src="{% static '/js/highlight.site.pack.js' %}"></script>
<script>
Holder.addTheme('thumb', {
bg: '#55595c',
fg: '#eceeef',
text: 'Thumbnail'
});
$( "img" ).addClass( "img-fluid" );
/**********************/
/* Back to Top Button */
/**********************/
$(document).ready(function() {
// Show or hide the sticky footer button
$(window).scroll(function() {
if ($(this).scrollTop() > 200) {
$('.go-top').fadeIn(200);
} else {
$('.go-top').fadeOut(200);
}
});
// Animate the scroll to top
$('.go-top').click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 300);
})
});
</script>
<script>
$(document).ready(function() {
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
</script>
<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
(function (d, w, c) {
(w[c] = w[c] || []).push(function() {
try {
w.yaCounter41501059 = new Ya.Metrika2({
id:41501059,
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true,
trackHash:true
});
} catch(e) { }
});
var n = d.getElementsByTagName("script")[0],
s = d.createElement("script"),
f = function () { n.parentNode.insertBefore(s, n); };
s.type = "text/javascript";
s.async = true;
s.src = "https://mc.yandex.ru/metrika/tag.js";
if (w.opera == "[object Opera]") {
d.addEventListener("DOMContentLoaded", f, false);
} else { f(); }
})(document, window, "yandex_metrika_callbacks2");
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/41501059" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<svg xmlns="http://www.w3.org/2000/svg" width="200" height="250" viewBox="0 0 200 250" preserveAspectRatio="none" style="display: none; visibility: hidden; position: absolute; top: -100%; left: -100%;"><defs><style type="text/css"></style></defs><text x="0" y="13" style="font-weight:bold;font-size:13pt;font-family:Arial, Helvetica, Open Sans, sans-serif">Thumbnail</text>
</svg>
</body>
</html> | {
"content_hash": "a10da0ec0d2fca107c207865c8cfb987",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 381,
"avg_line_length": 54.794642857142854,
"alnum_prop": 0.47009939709956006,
"repo_name": "andrewnsk/dorokhin.moscow",
"id": "eea0b3a3a0d86a2d061821f266e48712551475af",
"size": "12413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "templates/blog/blog_base.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "461"
},
{
"name": "HTML",
"bytes": "153184"
},
{
"name": "Python",
"bytes": "127702"
},
{
"name": "Shell",
"bytes": "930"
}
],
"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) on Wed Aug 14 21:12:40 EDT 2013 -->
<title>Uses of Class org.drip.analytics.holset.CFFHoliday</title>
<meta name="date" content="2013-08-14">
<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.drip.analytics.holset.CFFHoliday";
}
//-->
</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/drip/analytics/holset/CFFHoliday.html" title="class in org.drip.analytics.holset">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-files/index-1.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/drip/analytics/holset/\class-useCFFHoliday.html" target="_top">Frames</a></li>
<li><a href="CFFHoliday.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.drip.analytics.holset.CFFHoliday" class="title">Uses of Class<br>org.drip.analytics.holset.CFFHoliday</h2>
</div>
<div class="classUseContainer">No usage of org.drip.analytics.holset.CFFHoliday</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/drip/analytics/holset/CFFHoliday.html" title="class in org.drip.analytics.holset">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-files/index-1.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/drip/analytics/holset/\class-useCFFHoliday.html" target="_top">Frames</a></li>
<li><a href="CFFHoliday.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "f03f51eab7f6b33250060e159cf74848",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 135,
"avg_line_length": 36.982608695652175,
"alnum_prop": 0.5951093345873502,
"repo_name": "tectronics/rootfinder",
"id": "36566ec3e76e10e17fc139a5199a2b7b21f18c8c",
"size": "4253",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "2.2/docs/Javadoc/org/drip/analytics/holset/class-use/CFFHoliday.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "34839"
},
{
"name": "HTML",
"bytes": "77000232"
},
{
"name": "Java",
"bytes": "10842587"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Poker.Core.Interfaces;
namespace Poker.Core
{
static class Utilities
{
/// <summary>
/// Gets the next item in the list, or the first if the current item was the last (or null)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="list">List of items</param>
/// <param name="current">The current item</param>
/// <returns></returns>
internal static T NextAfterOrFirst<T>(this IList<T> list, T current)
{
int newIndex = list.IndexOf(current);
newIndex++;
if (newIndex == list.Count)
newIndex = 0;
return list[newIndex];
}
/// <summary>
/// Gets the next active player
/// </summary>
/// <param name="list"></param>
/// <param name="current"></param>
/// <returns></returns>
internal static IPlayer NextActiveOrFirst(this IList<IPlayer> list, IPlayer current)
{
do
{
current = list.NextAfterOrFirst(current);
} while (current.Participation != PlayerParticipation.Active);
return current;
}
}
}
| {
"content_hash": "82e560d1fd1967f907042b595f046e6c",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 99,
"avg_line_length": 29.477272727272727,
"alnum_prop": 0.5481881264456437,
"repo_name": "ErnstHaagsman/Poker",
"id": "fbb7a36dad1506cb87af738821c24c6991b159f0",
"size": "1299",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Poker.Core/Utilities.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "29228"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_11) on Mon Jul 12 21:36:17 CEST 2010 -->
<TITLE>
Uses of Class org.apache.fop.afp.modca.ContainerDataDescriptor (Apache FOP 1.0 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Uses of Class org.apache.fop.afp.modca.ContainerDataDescriptor (Apache FOP 1.0 API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
fop 1.0</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="ContainerDataDescriptor.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Class<br>org.apache.fop.afp.modca.ContainerDataDescriptor</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
Packages that use <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca">ContainerDataDescriptor</A></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.apache.fop.afp"><B>org.apache.fop.afp</B></A></TD>
<TD>Contains an AFP library. </TD>
</TR>
</TABLE>
<P>
<A NAME="org.apache.fop.afp"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
Uses of <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca">ContainerDataDescriptor</A> in <A HREF="../../../../../../org/apache/fop/afp/package-summary.html">org.apache.fop.afp</A></FONT></TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
<TD COLSPAN=2>Methods in <A HREF="../../../../../../org/apache/fop/afp/package-summary.html">org.apache.fop.afp</A> that return <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca">ContainerDataDescriptor</A></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca">ContainerDataDescriptor</A></CODE></FONT></TD>
<TD><CODE><B>Factory.</B><B><A HREF="../../../../../../org/apache/fop/afp/Factory.html#createContainerDataDescriptor(int, int, int, int)">createContainerDataDescriptor</A></B>(int dataWidth,
int dataHeight,
int widthRes,
int heightRes)</CODE>
<BR>
Creates a new MO:DCA <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca"><CODE>ContainerDataDescriptor</CODE></A></TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../org/apache/fop/afp/modca/ContainerDataDescriptor.html" title="class in org.apache.fop.afp.modca"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
fop 1.0</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="ContainerDataDescriptor.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright 1999-2010 The Apache Software Foundation. All Rights Reserved.
</BODY>
</HTML>
| {
"content_hash": "4688a8426dc7e4485a7cc8c97ad727bb",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 291,
"avg_line_length": 46.91428571428571,
"alnum_prop": 0.6211936662606578,
"repo_name": "kezhong/XML",
"id": "752cb9895e4045db0ccdcd9730bec8d4a63240ce",
"size": "8210",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "javadocs/org/apache/fop/afp/modca/class-use/ContainerDataDescriptor.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "28133"
},
{
"name": "PHP",
"bytes": "1069"
},
{
"name": "Shell",
"bytes": "7531"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "f521ba43f03b22b025823a5843e31061",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.307692307692308,
"alnum_prop": 0.6940298507462687,
"repo_name": "mdoering/backbone",
"id": "d61498280133f19714cea4796b35e88d275b1860",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Zingiberales/Zingiberaceae/Rhynchanthus/Rhynchanthus longiflorus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/renderer_host/dwrite_font_proxy_impl_win.h"
#include <shlobj.h>
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include "base/callback_helpers.h"
#include "base/check_op.h"
#include "base/feature_list.h"
#include "base/i18n/case_conversion.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/renderer_host/dwrite_font_file_util_win.h"
#include "content/browser/renderer_host/dwrite_font_uma_logging_win.h"
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "third_party/abseil-cpp/absl/utility/utility.h"
#include "third_party/blink/public/common/font_unique_name_lookup/font_unique_name_table.pb.h"
#include "third_party/blink/public/common/font_unique_name_lookup/icu_fold_case_util.h"
#include "third_party/skia/include/core/SkFontMgr.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/ports/SkTypeface_win.h"
#include "ui/gfx/win/direct_write.h"
#include "ui/gfx/win/text_analysis_source.h"
namespace mswr = Microsoft::WRL;
namespace content {
namespace {
// These are the fonts that Blink tries to load in getLastResortFallbackFont,
// and will crash if none can be loaded.
const wchar_t* kLastResortFontNames[] = {
L"Sans", L"Arial", L"MS UI Gothic", L"Microsoft Sans Serif",
L"Segoe UI", L"Calibri", L"Times New Roman", L"Courier New"};
struct RequiredFontStyle {
const char16_t* family_name;
DWRITE_FONT_WEIGHT required_weight;
DWRITE_FONT_STRETCH required_stretch;
DWRITE_FONT_STYLE required_style;
};
const RequiredFontStyle kRequiredStyles[] = {
// The regular version of Gill Sans is actually in the Gill Sans MT family,
// and the Gill Sans family typically contains just the ultra-bold styles.
{u"gill sans", DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STRETCH_NORMAL,
DWRITE_FONT_STYLE_NORMAL},
{u"helvetica", DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STRETCH_NORMAL,
DWRITE_FONT_STYLE_NORMAL},
{u"open sans", DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STRETCH_NORMAL,
DWRITE_FONT_STYLE_NORMAL},
};
// As a workaround for crbug.com/635932, refuse to load some common fonts that
// do not contain certain styles. We found that sometimes these fonts are
// installed only in specialized styles ('Open Sans' might only be available in
// the condensed light variant, or Helvetica might only be available in bold).
// That results in a poor user experience because websites that use those fonts
// usually expect them to be rendered in the regular variant.
bool CheckRequiredStylesPresent(IDWriteFontCollection* collection,
const std::u16string& family_name,
uint32_t family_index) {
for (const auto& font_style : kRequiredStyles) {
if (base::EqualsCaseInsensitiveASCII(family_name, font_style.family_name)) {
mswr::ComPtr<IDWriteFontFamily> family;
if (FAILED(collection->GetFontFamily(family_index, &family))) {
DCHECK(false);
return true;
}
mswr::ComPtr<IDWriteFont> font;
if (FAILED(family->GetFirstMatchingFont(
font_style.required_weight, font_style.required_stretch,
font_style.required_style, &font))) {
DCHECK(false);
return true;
}
// GetFirstMatchingFont doesn't require strict style matching, so check
// the actual font that we got.
if (font->GetWeight() != font_style.required_weight ||
font->GetStretch() != font_style.required_stretch ||
font->GetStyle() != font_style.required_style) {
// Not really a loader type, but good to have telemetry on how often
// fonts like these are encountered, and the data can be compared with
// the other loader types.
LogLoaderType(
DirectWriteFontLoaderType::FONT_WITH_MISSING_REQUIRED_STYLES);
return false;
}
break;
}
}
return true;
}
} // namespace
DWriteFontProxyImpl::DWriteFontProxyImpl()
: windows_fonts_path_(GetWindowsFontsPath()) {}
DWriteFontProxyImpl::~DWriteFontProxyImpl() = default;
// static
void DWriteFontProxyImpl::Create(
mojo::PendingReceiver<blink::mojom::DWriteFontProxy> receiver) {
mojo::MakeSelfOwnedReceiver(std::make_unique<DWriteFontProxyImpl>(),
std::move(receiver));
}
void DWriteFontProxyImpl::SetWindowsFontsPathForTesting(std::u16string path) {
windows_fonts_path_.swap(path);
}
void DWriteFontProxyImpl::FindFamily(const std::u16string& family_name,
FindFamilyCallback callback) {
InitializeDirectWrite();
TRACE_EVENT0("dwrite,fonts", "FontProxyHost::OnFindFamily");
UINT32 family_index = UINT32_MAX;
if (collection_) {
BOOL exists = FALSE;
UINT32 index = UINT32_MAX;
HRESULT hr = collection_->FindFamilyName(base::as_wcstr(family_name),
&index, &exists);
if (SUCCEEDED(hr) && exists &&
CheckRequiredStylesPresent(collection_.Get(), family_name, index)) {
family_index = index;
}
}
std::move(callback).Run(family_index);
}
void DWriteFontProxyImpl::GetFamilyCount(GetFamilyCountCallback callback) {
InitializeDirectWrite();
TRACE_EVENT0("dwrite,fonts", "FontProxyHost::OnGetFamilyCount");
std::move(callback).Run(collection_ ? collection_->GetFontFamilyCount() : 0);
}
void DWriteFontProxyImpl::GetFamilyNames(UINT32 family_index,
GetFamilyNamesCallback callback) {
InitializeDirectWrite();
TRACE_EVENT0("dwrite,fonts", "FontProxyHost::OnGetFamilyNames");
callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback), std::vector<blink::mojom::DWriteStringPairPtr>());
if (!collection_)
return;
TRACE_EVENT0("dwrite,fonts", "FontProxyHost::DoGetFamilyNames");
mswr::ComPtr<IDWriteFontFamily> family;
HRESULT hr = collection_->GetFontFamily(family_index, &family);
if (FAILED(hr)) {
return;
}
mswr::ComPtr<IDWriteLocalizedStrings> localized_names;
hr = family->GetFamilyNames(&localized_names);
if (FAILED(hr)) {
return;
}
size_t string_count = localized_names->GetCount();
std::vector<wchar_t> locale;
std::vector<wchar_t> name;
std::vector<blink::mojom::DWriteStringPairPtr> family_names;
for (size_t index = 0; index < string_count; ++index) {
UINT32 length = 0;
hr = localized_names->GetLocaleNameLength(index, &length);
if (FAILED(hr)) {
return;
}
++length; // Reserve space for the null terminator.
locale.resize(length);
hr = localized_names->GetLocaleName(index, locale.data(), length);
if (FAILED(hr)) {
return;
}
CHECK_EQ(L'\0', locale[length - 1]);
length = 0;
hr = localized_names->GetStringLength(index, &length);
if (FAILED(hr)) {
return;
}
++length; // Reserve space for the null terminator.
name.resize(length);
hr = localized_names->GetString(index, name.data(), length);
if (FAILED(hr)) {
return;
}
CHECK_EQ(L'\0', name[length - 1]);
family_names.emplace_back(absl::in_place, base::WideToUTF16(locale.data()),
base::WideToUTF16(name.data()));
}
std::move(callback).Run(std::move(family_names));
}
void DWriteFontProxyImpl::GetFontFiles(uint32_t family_index,
GetFontFilesCallback callback) {
InitializeDirectWrite();
TRACE_EVENT0("dwrite,fonts", "FontProxyHost::OnGetFontFiles");
callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback), std::vector<base::FilePath>(),
std::vector<base::File>());
if (!collection_)
return;
mswr::ComPtr<IDWriteFontFamily> family;
HRESULT hr = collection_->GetFontFamily(family_index, &family);
if (FAILED(hr)) {
if (IsLastResortFallbackFont(family_index))
LogMessageFilterError(
MessageFilterError::LAST_RESORT_FONT_GET_FAMILY_FAILED);
return;
}
UINT32 font_count = family->GetFontCount();
std::set<std::wstring> path_set;
std::set<std::wstring> custom_font_path_set;
// Iterate through all the fonts in the family, and all the files for those
// fonts. If anything goes wrong, bail on the entire family to avoid having
// a partially-loaded font family.
for (UINT32 font_index = 0; font_index < font_count; ++font_index) {
mswr::ComPtr<IDWriteFont> font;
hr = family->GetFont(font_index, &font);
if (FAILED(hr)) {
if (IsLastResortFallbackFont(family_index))
LogMessageFilterError(
MessageFilterError::LAST_RESORT_FONT_GET_FONT_FAILED);
return;
}
uint32_t dummy_ttc_index = 0;
if (FAILED(AddFilesForFont(font.Get(), windows_fonts_path_, &path_set,
&custom_font_path_set, &dummy_ttc_index))) {
if (IsLastResortFallbackFont(family_index))
LogMessageFilterError(
MessageFilterError::LAST_RESORT_FONT_ADD_FILES_FAILED);
}
}
std::vector<base::File> file_handles;
// For files outside the windows fonts directory we pass them to the renderer
// as file handles. The renderer would be unable to open the files directly
// due to sandbox policy (it would get ERROR_ACCESS_DENIED instead). Passing
// handles allows the renderer to bypass the restriction and use the fonts.
// TODO(jam): if kDWriteFontProxyOnIO is removed also remove the exception
// for this class from thread_restrictions.h
base::ScopedAllowBlocking allow_io;
for (const auto& custom_font_path : custom_font_path_set) {
// Specify FLAG_WIN_EXCLUSIVE_WRITE to prevent base::File from opening the
// file with FILE_SHARE_WRITE access. FLAG_WIN_EXCLUSIVE_WRITE doesn't
// actually open the file for write access.
base::File file(base::FilePath(custom_font_path),
base::File::FLAG_OPEN | base::File::FLAG_READ |
base::File::FLAG_WIN_EXCLUSIVE_WRITE);
if (file.IsValid()) {
file_handles.push_back(std::move(file));
}
}
std::vector<base::FilePath> file_paths;
for (const auto& path : path_set) {
file_paths.emplace_back(base::FilePath(path));
}
LogLastResortFontFileCount(file_paths.size());
std::move(callback).Run(file_paths, std::move(file_handles));
}
void DWriteFontProxyImpl::MapCharacters(
const std::u16string& text,
blink::mojom::DWriteFontStylePtr font_style,
const std::u16string& locale_name,
uint32_t reading_direction,
const std::u16string& base_family_name,
MapCharactersCallback callback) {
InitializeDirectWrite();
callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback),
blink::mojom::MapCharactersResult::New(
UINT32_MAX, u"", text.length(), 0.0,
blink::mojom::DWriteFontStyle::New(DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
DWRITE_FONT_WEIGHT_NORMAL)));
if (factory2_ == nullptr || collection_ == nullptr)
return;
if (font_fallback_ == nullptr) {
if (FAILED(factory2_->GetSystemFontFallback(&font_fallback_))) {
return;
}
}
mswr::ComPtr<IDWriteFont> mapped_font;
mswr::ComPtr<IDWriteNumberSubstitution> number_substitution;
if (FAILED(factory2_->CreateNumberSubstitution(
DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, base::as_wcstr(locale_name),
TRUE /* ignoreUserOverride */, &number_substitution))) {
DCHECK(false);
return;
}
mswr::ComPtr<IDWriteTextAnalysisSource> analysis_source;
if (FAILED(gfx::win::TextAnalysisSource::Create(
&analysis_source, base::UTF16ToWide(text),
base::UTF16ToWide(locale_name), number_substitution.Get(),
static_cast<DWRITE_READING_DIRECTION>(reading_direction)))) {
DCHECK(false);
return;
}
auto result = blink::mojom::MapCharactersResult::New(
UINT32_MAX, u"", text.length(), 0.0,
blink::mojom::DWriteFontStyle::New(DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH_NORMAL,
DWRITE_FONT_WEIGHT_NORMAL));
if (FAILED(font_fallback_->MapCharacters(
analysis_source.Get(), 0, text.length(), collection_.Get(),
base::as_wcstr(base_family_name),
static_cast<DWRITE_FONT_WEIGHT>(font_style->font_weight),
static_cast<DWRITE_FONT_STYLE>(font_style->font_slant),
static_cast<DWRITE_FONT_STRETCH>(font_style->font_stretch),
&result->mapped_length, &mapped_font, &result->scale))) {
DCHECK(false);
return;
}
if (mapped_font == nullptr) {
std::move(callback).Run(std::move(result));
return;
}
mswr::ComPtr<IDWriteFontFamily> mapped_family;
if (FAILED(mapped_font->GetFontFamily(&mapped_family))) {
DCHECK(false);
return;
}
mswr::ComPtr<IDWriteLocalizedStrings> family_names;
if (FAILED(mapped_family->GetFamilyNames(&family_names))) {
DCHECK(false);
return;
}
result->font_style->font_slant = mapped_font->GetStyle();
result->font_style->font_stretch = mapped_font->GetStretch();
result->font_style->font_weight = mapped_font->GetWeight();
std::vector<wchar_t> name;
size_t name_count = family_names->GetCount();
for (size_t name_index = 0; name_index < name_count; name_index++) {
UINT32 name_length = 0;
if (FAILED(family_names->GetStringLength(name_index, &name_length)))
continue; // Keep trying other names
++name_length; // Reserve space for the null terminator.
name.resize(name_length);
if (FAILED(family_names->GetString(name_index, name.data(), name_length)))
continue;
UINT32 index = UINT32_MAX;
BOOL exists = false;
if (FAILED(collection_->FindFamilyName(name.data(), &index, &exists)) ||
!exists)
continue;
// Found a matching family!
result->family_index = index;
result->family_name = base::as_u16cstr(name.data());
std::move(callback).Run(std::move(result));
return;
}
// Could not find a matching family
LogMessageFilterError(MessageFilterError::MAP_CHARACTERS_NO_FAMILY);
DCHECK_EQ(result->family_index, UINT32_MAX);
DCHECK_GT(result->mapped_length, 0u);
}
void DWriteFontProxyImpl::GetUniqueNameLookupTableIfAvailable(
GetUniqueNameLookupTableIfAvailableCallback callback) {
DCHECK(base::FeatureList::IsEnabled(features::kFontSrcLocalMatching));
/* Table is not synchronously available, return immediately. */
if (!DWriteFontLookupTableBuilder::GetInstance()
->FontUniqueNameTableReady()) {
std::move(callback).Run(false, base::ReadOnlySharedMemoryRegion());
return;
}
std::move(callback).Run(
true,
DWriteFontLookupTableBuilder::GetInstance()->DuplicateMemoryRegion());
}
void DWriteFontProxyImpl::MatchUniqueFont(
const std::u16string& unique_font_name,
MatchUniqueFontCallback callback) {
TRACE_EVENT0("dwrite,fonts", "DWriteFontProxyImpl::MatchUniqueFont");
DCHECK(base::FeatureList::IsEnabled(features::kFontSrcLocalMatching));
callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(std::move(callback),
base::File(), 0);
InitializeDirectWrite();
// We must not get here if this version of DWrite can't handle performing the
// search.
DCHECK(factory3_.Get());
mswr::ComPtr<IDWriteFontSet> system_font_set;
HRESULT hr = factory3_->GetSystemFontSet(&system_font_set);
if (FAILED(hr))
return;
DCHECK_GT(system_font_set->GetFontCount(), 0U);
mswr::ComPtr<IDWriteFontSet> filtered_set;
auto filter_set = [&system_font_set, &filtered_set,
&unique_font_name](DWRITE_FONT_PROPERTY_ID property_id) {
TRACE_EVENT0("dwrite,fonts",
"DWriteFontProxyImpl::MatchUniqueFont::filter_set");
std::wstring unique_font_name_wide = base::UTF16ToWide(unique_font_name);
DWRITE_FONT_PROPERTY search_property = {property_id,
unique_font_name_wide.c_str(), L""};
// GetMatchingFonts() matches all languages according to:
// https://docs.microsoft.com/en-us/windows/desktop/api/dwrite_3/ns-dwrite_3-dwrite_font_property
HRESULT hr =
system_font_set->GetMatchingFonts(&search_property, 1, &filtered_set);
return SUCCEEDED(hr);
};
// Search PostScript name first, otherwise try searching for full font name.
// Return if filtering failed.
if (!filter_set(DWRITE_FONT_PROPERTY_ID_POSTSCRIPT_NAME))
return;
if (!filtered_set->GetFontCount() &&
!filter_set(DWRITE_FONT_PROPERTY_ID_FULL_NAME)) {
return;
}
if (!filtered_set->GetFontCount())
return;
mswr::ComPtr<IDWriteFontFaceReference> first_font;
hr = filtered_set->GetFontFaceReference(0, &first_font);
if (FAILED(hr))
return;
mswr::ComPtr<IDWriteFontFace3> first_font_face_3;
hr = first_font->CreateFontFace(&first_font_face_3);
if (FAILED(hr))
return;
mswr::ComPtr<IDWriteFontFace> first_font_face;
hr = first_font_face_3.As<IDWriteFontFace>(&first_font_face);
if (FAILED(hr))
return;
std::wstring font_file_pathname;
uint32_t ttc_index;
if (FAILED(FontFilePathAndTtcIndex(first_font_face.Get(), font_file_pathname,
ttc_index))) {
return;
}
base::FilePath path(font_file_pathname);
// Have the Browser process open the font file and send the handle to the
// Renderer Process to access the font. Otherwise, user-installed local font
// files outside of Windows fonts system directory wouldn't be accessible by
// Renderer due to Windows sandboxing rules.
// Specify FLAG_WIN_EXCLUSIVE_WRITE to prevent base::File from opening the
// file with FILE_SHARE_WRITE access. FLAG_WIN_EXCLUSIVE_WRITE doesn't
// actually open the file for write access.
base::File font_file(path, base::File::FLAG_OPEN | base::File::FLAG_READ |
base::File::FLAG_WIN_EXCLUSIVE_WRITE);
if (!font_file.IsValid() || !font_file.GetLength()) {
return;
}
std::move(callback).Run(std::move(font_file), ttc_index);
}
void DWriteFontProxyImpl::GetUniqueFontLookupMode(
GetUniqueFontLookupModeCallback callback) {
InitializeDirectWrite();
// If factory3_ is available, that means we can use IDWriteFontSet to filter
// for PostScript name and full font name directly and do not need to build
// the lookup table.
blink::mojom::UniqueFontLookupMode lookup_mode =
factory3_.Get() ? blink::mojom::UniqueFontLookupMode::kSingleLookups
: blink::mojom::UniqueFontLookupMode::kRetrieveTable;
std::move(callback).Run(lookup_mode);
}
void DWriteFontProxyImpl::GetUniqueNameLookupTable(
GetUniqueNameLookupTableCallback callback) {
DCHECK(base::FeatureList::IsEnabled(features::kFontSrcLocalMatching));
DWriteFontLookupTableBuilder::GetInstance()->QueueShareMemoryRegionWhenReady(
base::SequencedTaskRunner::GetCurrentDefault(), std::move(callback));
}
void DWriteFontProxyImpl::FallbackFamilyAndStyleForCodepoint(
const std::string& base_family_name,
const std::string& locale_name,
uint32_t codepoint,
FallbackFamilyAndStyleForCodepointCallback callback) {
InitializeDirectWrite();
callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun(
std::move(callback),
blink::mojom::FallbackFamilyAndStyle::New("",
/* weight */ 0,
/* width */ 0,
/* slant */ 0));
if (!codepoint || !collection_ || !factory_)
return;
sk_sp<SkFontMgr> font_mgr(
SkFontMgr_New_DirectWrite(factory_.Get(), collection_.Get()));
if (!font_mgr)
return;
const char* bcp47_locales[] = {locale_name.c_str()};
int num_locales = locale_name.empty() ? 0 : 1;
const char** locales = locale_name.empty() ? nullptr : bcp47_locales;
sk_sp<SkTypeface> typeface(font_mgr->matchFamilyStyleCharacter(
base_family_name.c_str(), SkFontStyle(), locales, num_locales,
codepoint));
if (!typeface)
return;
SkString family_name;
typeface->getFamilyName(&family_name);
SkFontStyle font_style = typeface->fontStyle();
auto result_fallback_and_style = blink::mojom::FallbackFamilyAndStyle::New(
family_name.c_str(), font_style.weight(), font_style.width(),
font_style.slant());
std::move(callback).Run(std::move(result_fallback_and_style));
}
void DWriteFontProxyImpl::InitializeDirectWrite() {
if (direct_write_initialized_)
return;
direct_write_initialized_ = true;
TRACE_EVENT0("dwrite,fonts", "DWriteFontProxyImpl::InitializeDirectWrite");
gfx::win::CreateDWriteFactory(&factory_);
if (factory_ == nullptr) {
// We won't be able to load fonts, but we should still return messages so
// renderers don't hang if they for some reason send us a font message.
return;
}
// QueryInterface for IDWriteFactory2. It's ok for this to fail if we are
// running an older version of DirectWrite (earlier than Win8.1).
factory_.As<IDWriteFactory2>(&factory2_);
// QueryInterface for IDwriteFactory3, needed for MatchUniqueFont on Windows
// 10. May fail on older versions, in which case, unique font matching must be
// done through indexing system fonts using DWriteFontLookupTableBuilder.
factory_.As<IDWriteFactory3>(&factory3_);
HRESULT hr = factory_->GetSystemFontCollection(&collection_);
DCHECK(SUCCEEDED(hr));
if (!collection_) {
base::UmaHistogramSparse(
"DirectWrite.Fonts.Proxy.GetSystemFontCollectionResult", hr);
LogMessageFilterError(MessageFilterError::ERROR_NO_COLLECTION);
return;
}
// Temp code to help track down crbug.com/561873
for (size_t font = 0; font < std::size(kLastResortFontNames); font++) {
uint32_t font_index = 0;
BOOL exists = FALSE;
if (SUCCEEDED(collection_->FindFamilyName(kLastResortFontNames[font],
&font_index, &exists)) &&
exists && font_index != UINT32_MAX) {
last_resort_fonts_.push_back(font_index);
}
}
LogLastResortFontCount(last_resort_fonts_.size());
}
bool DWriteFontProxyImpl::IsLastResortFallbackFont(uint32_t font_index) {
for (auto iter = last_resort_fonts_.begin(); iter != last_resort_fonts_.end();
++iter) {
if (*iter == font_index)
return true;
}
return false;
}
} // namespace content
| {
"content_hash": "2a4a72d378eba1eba743004491d78663",
"timestamp": "",
"source": "github",
"line_count": 621,
"max_line_length": 101,
"avg_line_length": 37.34299516908212,
"alnum_prop": 0.6763691246226822,
"repo_name": "chromium/chromium",
"id": "90e5a51d20e444c41a38502954695acfa2a5f29c",
"size": "23190",
"binary": false,
"copies": "5",
"ref": "refs/heads/main",
"path": "content/browser/renderer_host/dwrite_font_proxy_impl_win.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Organization</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../index.html" title="Chapter 1. Fusion 2.1">
<link rel="up" href="../index.html" title="Chapter 1. Fusion 2.1">
<link rel="prev" href="quick_start.html" title="Quick Start">
<link rel="next" href="support.html" title="Support">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="quick_start.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="support.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="fusion.organization"></a><a class="link" href="organization.html" title="Organization">Organization</a>
</h2></div></div></div>
<p>
The library is organized into layers of modules, with each module addressing
a particular area of responsibility. A module may not depend on modules in
higher layers.
</p>
<p>
The library is organized in three layers:
</p>
<h4>
<a name="fusion.organization.h0"></a>
<span><a name="fusion.organization.layers"></a></span><a class="link" href="organization.html#fusion.organization.layers">Layers</a>
</h4>
<div class="blockquote"><blockquote class="blockquote"><p>
<span class="inlinemediaobject"><img src="../images/fusion_org.png" alt="fusion_org"></span>
</p></blockquote></div>
<p>
The entire library is found in the <code class="computeroutput"><span class="string">"boost/fusion"</span></code>
directory. Modules are organized in directories. Each module has its own header
file placed in the same directory with the actual module-directory. For example,
there exists <code class="computeroutput"><span class="string">"boost/fusion/support.hpp"</span></code>
in the same directory as "boost/fusion/support". Everything, except
those found inside "detail" directories, is public.
</p>
<p>
There is also a <code class="computeroutput"><span class="string">"boost/fusion/include/"</span></code>
directory that contains all the headers to all the components and modules.
If you are unsure where to find a specific component or module, or don't want
to fuss with hierarchy and nesting, use this.
</p>
<p>
The library is header-only. There is no need to build object files to link
against.
</p>
<h4>
<a name="fusion.organization.h1"></a>
<span><a name="fusion.organization.directory"></a></span><a class="link" href="organization.html#fusion.organization.directory">Directory</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
tuple
</li>
<li class="listitem">
algorithm
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
iteration
</li>
<li class="listitem">
query
</li>
<li class="listitem">
transformation
</li>
</ul></div>
</li>
<li class="listitem">
adapted
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
array
</li>
<li class="listitem">
mpl
</li>
<li class="listitem">
boost::tuple
</li>
<li class="listitem">
std_pair
</li>
<li class="listitem">
struct
</li>
<li class="listitem">
variant
</li>
</ul></div>
</li>
<li class="listitem">
view
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
filter_view
</li>
<li class="listitem">
iterator_range
</li>
<li class="listitem">
joint_view
</li>
<li class="listitem">
reverse_view
</li>
<li class="listitem">
single_view
</li>
<li class="listitem">
transform_view
</li>
<li class="listitem">
zip_view
</li>
</ul></div>
</li>
<li class="listitem">
container
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
deque
</li>
<li class="listitem">
list
</li>
<li class="listitem">
map
</li>
<li class="listitem">
set
</li>
<li class="listitem">
vector
</li>
<li class="listitem">
generation
</li>
</ul></div>
</li>
<li class="listitem">
mpl
</li>
<li class="listitem">
functional
</li>
<li class="listitem">
sequence
<div class="itemizedlist"><ul class="itemizedlist" type="circle">
<li class="listitem">
comparison
</li>
<li class="listitem">
intrinsic
</li>
<li class="listitem">
io
</li>
</ul></div>
</li>
<li class="listitem">
iterator
</li>
<li class="listitem">
support
</li>
</ul></div>
<h4>
<a name="fusion.organization.h2"></a>
<span><a name="fusion.organization.example"></a></span><a class="link" href="organization.html#fusion.organization.example">Example</a>
</h4>
<p>
If, for example, you want to use <code class="computeroutput"><span class="identifier">list</span></code>,
depending on the granularity that you desire, you may do so by including one
of
</p>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">container</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">container</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">container</span><span class="special">/</span><span class="identifier">list</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">include</span><span class="special">/</span><span class="identifier">list</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<p>
The first includes all containers The second includes only <code class="computeroutput"><span class="identifier">list</span></code>
<sup>[<a name="fusion.organization.f0" href="#ftn.fusion.organization.f0" class="footnote">4</a>]</sup>.
</p>
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a id="ftn.fusion.organization.f0" href="#fusion.organization.f0" class="para">4</a>] </sup>
Modules may contain smaller components. Header file information for each
component will be provided as part of the component's documentation.
</p></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2006, 2011, 2012 Joel de Guzman,
Dan Marsden, Tobias Schwinger<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="quick_start.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="support.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| {
"content_hash": "f17d221d058d12b4cbebba99024b3995",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 419,
"avg_line_length": 45.27354260089686,
"alnum_prop": 0.6027139461172741,
"repo_name": "goldcoin/gldcoin",
"id": "80d66502fcf4dbca3979df2fc094ef882b511308",
"size": "10096",
"binary": false,
"copies": "8",
"ref": "refs/heads/master",
"path": "BuildDeps/deps/boost/libs/fusion/doc/html/fusion/organization.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "21289"
},
{
"name": "Assembly",
"bytes": "1152300"
},
{
"name": "Awk",
"bytes": "54072"
},
{
"name": "Batchfile",
"bytes": "95617"
},
{
"name": "C",
"bytes": "30167843"
},
{
"name": "C#",
"bytes": "1801043"
},
{
"name": "C++",
"bytes": "143719415"
},
{
"name": "CMake",
"bytes": "7934"
},
{
"name": "CSS",
"bytes": "369274"
},
{
"name": "Cuda",
"bytes": "26749"
},
{
"name": "DIGITAL Command Language",
"bytes": "320412"
},
{
"name": "Emacs Lisp",
"bytes": "1639"
},
{
"name": "FORTRAN",
"bytes": "1387"
},
{
"name": "Groff",
"bytes": "29119"
},
{
"name": "HTML",
"bytes": "187929099"
},
{
"name": "IDL",
"bytes": "14"
},
{
"name": "Java",
"bytes": "4131730"
},
{
"name": "JavaScript",
"bytes": "210803"
},
{
"name": "Lex",
"bytes": "1255"
},
{
"name": "Makefile",
"bytes": "1926648"
},
{
"name": "Max",
"bytes": "36857"
},
{
"name": "NSIS",
"bytes": "5910"
},
{
"name": "Objective-C",
"bytes": "88946"
},
{
"name": "Objective-C++",
"bytes": "11420"
},
{
"name": "OpenEdge ABL",
"bytes": "66157"
},
{
"name": "PHP",
"bytes": "60328"
},
{
"name": "Perl",
"bytes": "3895713"
},
{
"name": "Perl6",
"bytes": "29655"
},
{
"name": "Prolog",
"bytes": "42455"
},
{
"name": "Protocol Buffer",
"bytes": "2764"
},
{
"name": "Python",
"bytes": "1785357"
},
{
"name": "QML",
"bytes": "593"
},
{
"name": "QMake",
"bytes": "55372"
},
{
"name": "R",
"bytes": "4009"
},
{
"name": "Rebol",
"bytes": "354"
},
{
"name": "Scheme",
"bytes": "4249"
},
{
"name": "Shell",
"bytes": "1384609"
},
{
"name": "Tcl",
"bytes": "2603631"
},
{
"name": "TeX",
"bytes": "13404"
},
{
"name": "XS",
"bytes": "198495"
},
{
"name": "XSLT",
"bytes": "761090"
},
{
"name": "Yacc",
"bytes": "18910"
},
{
"name": "eC",
"bytes": "5157"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blockfacebook</name>
<displayName><![CDATA[Facebook block]]></displayName>
<version><![CDATA[1.3.3]]></version>
<description><![CDATA[Displays a block for subscribing to your Facebook page.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module> | {
"content_hash": "9e15216f9145346e8e9a5f06934c6869",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 95,
"avg_line_length": 39.583333333333336,
"alnum_prop": 0.7052631578947368,
"repo_name": "Aurelsicoko/prestashop-14",
"id": "53e7231b28224a2eaed49f964d3703820fc761a1",
"size": "475",
"binary": false,
"copies": "4",
"ref": "refs/heads/development",
"path": "modules/blockfacebook/config.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "3982"
},
{
"name": "CSS",
"bytes": "1187672"
},
{
"name": "HTML",
"bytes": "466645"
},
{
"name": "JavaScript",
"bytes": "1844134"
},
{
"name": "PHP",
"bytes": "9719403"
},
{
"name": "Ruby",
"bytes": "1771"
},
{
"name": "Smarty",
"bytes": "2507647"
}
],
"symlink_target": ""
} |
#ifndef JERRYX_HANDLER_H
#define JERRYX_HANDLER_H
#include "jerryscript.h"
JERRY_C_API_BEGIN
/*
* Handler registration helper
*/
jerry_value_t jerryx_handler_register_global (const char *name_p, jerry_external_handler_t handler_p);
/*
* Common external function handlers
*/
jerry_value_t jerryx_handler_assert_fatal (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_assert_throw (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_assert (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
jerry_value_t
jerryx_handler_gc (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_print (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_source_name (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
/**
* Struct used by the `jerryx_set_functions` method to
* register multiple methods for a given object.
*/
typedef struct
{
const char *name; /**< name of the property to add */
jerry_value_t value; /**< value of the property */
} jerryx_property_entry;
#define JERRYX_PROPERTY_NUMBER(NAME, NUMBER) \
(jerryx_property_entry) \
{ \
NAME, jerry_number (NUMBER) \
}
#define JERRYX_PROPERTY_STRING(NAME, STR, SIZE) \
(jerryx_property_entry) \
{ \
NAME, jerry_string ((const jerry_char_t *) STR, SIZE, JERRY_ENCODING_UTF8) \
}
#define JERRYX_PROPERTY_STRING_SZ(NAME, STR) \
(jerryx_property_entry) \
{ \
NAME, jerry_string_sz (STR) \
}
#define JERRYX_PROPERTY_BOOLEAN(NAME, VALUE) \
(jerryx_property_entry) \
{ \
NAME, jerry_boolean (VALUE) \
}
#define JERRYX_PROPERTY_FUNCTION(NAME, FUNC) \
(jerryx_property_entry) \
{ \
NAME, jerry_function_external (FUNC) \
}
#define JERRYX_PROPERTY_UNDEFINED(NAME) \
(jerryx_property_entry) \
{ \
NAME, jerry_undefined () \
}
#define JERRYX_PROPERTY_LIST_END() \
(jerryx_property_entry) \
{ \
NULL, 0 \
}
/**
* Stores the result of property register operation.
*/
typedef struct
{
jerry_value_t result; /**< result of property registration (undefined or error object) */
uint32_t registered; /**< number of successfully registered methods */
} jerryx_register_result;
jerryx_register_result jerryx_set_properties (const jerry_value_t target_object, const jerryx_property_entry entries[]);
void jerryx_release_property_entry (const jerryx_property_entry entries[],
const jerryx_register_result register_result);
jerry_value_t jerryx_set_property_str (const jerry_value_t target_object, const char *name, const jerry_value_t value);
jerry_value_t jerryx_get_property_str (const jerry_value_t target_object, const char *name);
bool jerryx_has_property_str (const jerry_value_t target_object, const char *name);
JERRY_C_API_END
#endif /* !JERRYX_HANDLER_H */
| {
"content_hash": "8d0a35ed4cdbdd916fc112fdd3a21bed",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 120,
"avg_line_length": 38.74528301886792,
"alnum_prop": 0.5385926467007548,
"repo_name": "dbatyai/jerryscript",
"id": "393586109711a243c0b00ee8b238c0d0840c5a49",
"size": "4739",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "jerry-ext/include/jerryscript-ext/handler.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Assembly",
"bytes": "3218"
},
{
"name": "Batchfile",
"bytes": "2635"
},
{
"name": "C",
"bytes": "6268199"
},
{
"name": "C++",
"bytes": "9575"
},
{
"name": "CMake",
"bytes": "81888"
},
{
"name": "JavaScript",
"bytes": "2182714"
},
{
"name": "Makefile",
"bytes": "12349"
},
{
"name": "Python",
"bytes": "254124"
},
{
"name": "Shell",
"bytes": "45112"
}
],
"symlink_target": ""
} |
class AddCustomRoleToUsers < ActiveRecord::Migration
def change
add_column :users, :custom_role, :string
end
end
| {
"content_hash": "9162bd6ffd256efba08d62c6e6bf1003",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 52,
"avg_line_length": 24.2,
"alnum_prop": 0.7520661157024794,
"repo_name": "NuxosMinecraft/NuxWS",
"id": "89fe4f956711182c3dbf71f2ddb81b3247473820",
"size": "121",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20120803181952_add_custom_role_to_users.rb",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "4908"
},
{
"name": "JavaScript",
"bytes": "29143"
},
{
"name": "Perl",
"bytes": "1389"
},
{
"name": "Ruby",
"bytes": "127297"
},
{
"name": "Shell",
"bytes": "753"
}
],
"symlink_target": ""
} |
package org.elasticsearch.gateway;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexFormatTooNewException;
import org.apache.lucene.index.IndexFormatTooOldException;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexInput;
import org.apache.lucene.store.OutputStreamIndexOutput;
import org.apache.lucene.store.SimpleFSDirectory;
import org.apache.lucene.util.IOUtils;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.lucene.store.IndexOutputOutputStream;
import org.elasticsearch.common.lucene.store.InputStreamIndexInput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* MetaDataStateFormat is a base class to write checksummed
* XContent based files to one or more directories in a standardized directory structure.
* @param <T> the type of the XContent base data-structure
*/
public abstract class MetaDataStateFormat<T> {
public static final String STATE_DIR_NAME = "_state";
public static final String STATE_FILE_EXTENSION = ".st";
private static final String STATE_FILE_CODEC = "state";
private static final int STATE_FILE_VERSION = 0;
private static final int BUFFER_SIZE = 4096;
private final XContentType format;
private final String prefix;
private final Pattern stateFilePattern;
/**
* Creates a new {@link MetaDataStateFormat} instance
* @param format the format of the x-content
*/
protected MetaDataStateFormat(XContentType format, String prefix) {
this.format = format;
this.prefix = prefix;
this.stateFilePattern = Pattern.compile(Pattern.quote(prefix) + "(\\d+)(" + MetaDataStateFormat.STATE_FILE_EXTENSION + ")?");
}
/**
* Returns the {@link XContentType} used to serialize xcontent on write.
*/
public XContentType format() {
return format;
}
/**
* Writes the given state to the given directories. The state is written to a
* state directory ({@value #STATE_DIR_NAME}) underneath each of the given file locations and is created if it
* doesn't exist. The state is serialized to a temporary file in that directory and is then atomically moved to
* it's target filename of the pattern <tt>{prefix}{version}.st</tt>.
*
* @param state the state object to write
* @param version the version of the state
* @param locations the locations where the state should be written to.
* @throws IOException if an IOException occurs
*/
public final void write(final T state, final long version, final Path... locations) throws IOException {
if (locations == null) {
throw new IllegalArgumentException("Locations must not be null");
}
if (locations.length <= 0) {
throw new IllegalArgumentException("One or more locations required");
}
final long maxStateId = findMaxStateId(prefix, locations)+1;
assert maxStateId >= 0 : "maxStateId must be positive but was: [" + maxStateId + "]";
final String fileName = prefix + maxStateId + STATE_FILE_EXTENSION;
Path stateLocation = locations[0].resolve(STATE_DIR_NAME);
Files.createDirectories(stateLocation);
final Path tmpStatePath = stateLocation.resolve(fileName + ".tmp");
final Path finalStatePath = stateLocation.resolve(fileName);
try {
final String resourceDesc = "MetaDataStateFormat.write(path=\"" + tmpStatePath + "\")";
try (OutputStreamIndexOutput out = new OutputStreamIndexOutput(resourceDesc, Files.newOutputStream(tmpStatePath), BUFFER_SIZE)) {
CodecUtil.writeHeader(out, STATE_FILE_CODEC, STATE_FILE_VERSION);
out.writeInt(format.index());
out.writeLong(version);
try (XContentBuilder builder = newXContentBuilder(format, new IndexOutputOutputStream(out) {
@Override
public void close() throws IOException {
// this is important since some of the XContentBuilders write bytes on close.
// in order to write the footer we need to prevent closing the actual index input.
} })) {
builder.startObject();
{
toXContent(builder, state);
}
builder.endObject();
}
CodecUtil.writeFooter(out);
}
IOUtils.fsync(tmpStatePath, false); // fsync the state file
Files.move(tmpStatePath, finalStatePath, StandardCopyOption.ATOMIC_MOVE);
IOUtils.fsync(stateLocation, true);
for (int i = 1; i < locations.length; i++) {
stateLocation = locations[i].resolve(STATE_DIR_NAME);
Files.createDirectories(stateLocation);
Path tmpPath = stateLocation.resolve(fileName + ".tmp");
Path finalPath = stateLocation.resolve(fileName);
try {
Files.copy(finalStatePath, tmpPath);
Files.move(tmpPath, finalPath, StandardCopyOption.ATOMIC_MOVE); // we are on the same FileSystem / Partition here we can do an atomic move
IOUtils.fsync(stateLocation, true); // we just fsync the dir here..
} finally {
Files.deleteIfExists(tmpPath);
}
}
} finally {
Files.deleteIfExists(tmpStatePath);
}
cleanupOldFiles(prefix, fileName, locations);
}
protected XContentBuilder newXContentBuilder(XContentType type, OutputStream stream ) throws IOException {
return XContentFactory.contentBuilder(type, stream);
}
/**
* Writes the given state to the given XContentBuilder
* Subclasses need to implement this class for theirs specific state.
*/
public abstract void toXContent(XContentBuilder builder, T state) throws IOException;
/**
* Reads a new instance of the state from the given XContentParser
* Subclasses need to implement this class for theirs specific state.
*/
public abstract T fromXContent(XContentParser parser) throws IOException;
/**
* Reads the state from a given file and compares the expected version against the actual version of
* the state.
*/
public final T read(Path file) throws IOException {
try (Directory dir = newDirectory(file.getParent())) {
try (final IndexInput indexInput = dir.openInput(file.getFileName().toString(), IOContext.DEFAULT)) {
// We checksum the entire file before we even go and parse it. If it's corrupted we barf right here.
CodecUtil.checksumEntireFile(indexInput);
CodecUtil.checkHeader(indexInput, STATE_FILE_CODEC, STATE_FILE_VERSION, STATE_FILE_VERSION);
final XContentType xContentType = XContentType.values()[indexInput.readInt()];
indexInput.readLong(); // version currently unused
long filePointer = indexInput.getFilePointer();
long contentSize = indexInput.length() - CodecUtil.footerLength() - filePointer;
try (IndexInput slice = indexInput.slice("state_xcontent", filePointer, contentSize)) {
try (XContentParser parser = XContentFactory.xContent(xContentType).createParser(new InputStreamIndexInput(slice, contentSize))) {
return fromXContent(parser);
}
}
} catch(CorruptIndexException | IndexFormatTooOldException | IndexFormatTooNewException ex) {
// we trick this into a dedicated exception with the original stacktrace
throw new CorruptStateException(ex);
}
}
}
protected Directory newDirectory(Path dir) throws IOException {
return new SimpleFSDirectory(dir);
}
private void cleanupOldFiles(final String prefix, final String currentStateFile, Path[] locations) throws IOException {
final DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) throws IOException {
final String entryFileName = entry.getFileName().toString();
return Files.isRegularFile(entry)
&& entryFileName.startsWith(prefix) // only state files
&& currentStateFile.equals(entryFileName) == false; // keep the current state file around
}
};
// now clean up the old files
for (Path dataLocation : locations) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(dataLocation.resolve(STATE_DIR_NAME), filter)) {
for (Path stateFile : stream) {
Files.deleteIfExists(stateFile);
}
}
}
}
long findMaxStateId(final String prefix, Path... locations) throws IOException {
long maxId = -1;
for (Path dataLocation : locations) {
final Path resolve = dataLocation.resolve(STATE_DIR_NAME);
if (Files.exists(resolve)) {
try (DirectoryStream<Path> stream = Files.newDirectoryStream(resolve, prefix + "*")) {
for (Path stateFile : stream) {
final Matcher matcher = stateFilePattern.matcher(stateFile.getFileName().toString());
if (matcher.matches()) {
final long id = Long.parseLong(matcher.group(1));
maxId = Math.max(maxId, id);
}
}
}
}
}
return maxId;
}
/**
* Tries to load the latest state from the given data-locations. It tries to load the latest state determined by
* the states version from one or more data directories and if none of the latest states can be loaded an exception
* is thrown to prevent accidentally loading a previous state and silently omitting the latest state.
*
* @param logger an elasticsearch logger instance
* @param dataLocations the data-locations to try.
* @return the latest state or <code>null</code> if no state was found.
*/
public T loadLatestState(ESLogger logger, Path... dataLocations) throws IOException {
List<PathAndStateId> files = new ArrayList<>();
long maxStateId = -1;
boolean maxStateIdIsLegacy = true;
if (dataLocations != null) { // select all eligible files first
for (Path dataLocation : dataLocations) {
final Path stateDir = dataLocation.resolve(STATE_DIR_NAME);
// now, iterate over the current versions, and find latest one
// we don't check if the stateDir is present since it could be deleted
// after the check. Also if there is a _state file and it's not a dir something is really wrong
try (DirectoryStream<Path> paths = Files.newDirectoryStream(stateDir)) { // we don't pass a glob since we need the group part for parsing
for (Path stateFile : paths) {
final Matcher matcher = stateFilePattern.matcher(stateFile.getFileName().toString());
if (matcher.matches()) {
final long stateId = Long.parseLong(matcher.group(1));
maxStateId = Math.max(maxStateId, stateId);
final boolean legacy = MetaDataStateFormat.STATE_FILE_EXTENSION.equals(matcher.group(2)) == false;
maxStateIdIsLegacy &= legacy; // on purpose, see NOTE below
PathAndStateId pav = new PathAndStateId(stateFile, stateId, legacy);
logger.trace("found state file: {}", pav);
files.add(pav);
}
}
} catch (NoSuchFileException | FileNotFoundException ex) {
// no _state directory -- move on
}
}
}
final List<Throwable> exceptions = new ArrayList<>();
T state = null;
// NOTE: we might have multiple version of the latest state if there are multiple data dirs.. for this case
// we iterate only over the ones with the max version. If we have at least one state file that uses the
// new format (ie. legacy == false) then we know that the latest version state ought to use this new format.
// In case the state file with the latest version does not use the new format while older state files do,
// the list below will be empty and loading the state will fail
Collection<PathAndStateId> pathAndStateIds = files
.stream()
.filter(new StateIdAndLegacyPredicate(maxStateId, maxStateIdIsLegacy))
.collect(Collectors.toCollection(ArrayList::new));
for (PathAndStateId pathAndStateId : pathAndStateIds) {
try {
final Path stateFile = pathAndStateId.file;
final long id = pathAndStateId.id;
final XContentParser parser;
if (pathAndStateId.legacy) { // read the legacy format -- plain XContent
final byte[] data = Files.readAllBytes(stateFile);
if (data.length == 0) {
logger.debug("{}: no data for [{}], ignoring...", prefix, stateFile.toAbsolutePath());
continue;
}
parser = XContentHelper.createParser(new BytesArray(data));
state = fromXContent(parser);
if (state == null) {
logger.debug("{}: no data for [{}], ignoring...", prefix, stateFile.toAbsolutePath());
}
} else {
state = read(stateFile);
logger.trace("state id [{}] read from [{}]", id, stateFile.getFileName());
}
return state;
} catch (Throwable e) {
exceptions.add(new IOException("failed to read " + pathAndStateId.toString(), e));
logger.debug("{}: failed to read [{}], ignoring...", e, pathAndStateId.file.toAbsolutePath(), prefix);
}
}
// if we reach this something went wrong
ExceptionsHelper.maybeThrowRuntimeAndSuppress(exceptions);
if (files.size() > 0) {
// We have some state files but none of them gave us a usable state
throw new IllegalStateException("Could not find a state file to recover from among " + files);
}
return state;
}
/**
* Filters out all {@link org.elasticsearch.gateway.MetaDataStateFormat.PathAndStateId} instances with a different id than
* the given one.
*/
private static final class StateIdAndLegacyPredicate implements Predicate<PathAndStateId> {
private final long id;
private final boolean legacy;
StateIdAndLegacyPredicate(long id, boolean legacy) {
this.id = id;
this.legacy = legacy;
}
@Override
public boolean test(PathAndStateId input) {
return input.id == id && input.legacy == legacy;
}
}
/**
* Internal struct-like class that holds the parsed state id, the file
* and a flag if the file is a legacy state ie. pre 1.5
*/
private static class PathAndStateId {
final Path file;
final long id;
final boolean legacy;
private PathAndStateId(Path file, long id, boolean legacy) {
this.file = file;
this.id = id;
this.legacy = legacy;
}
@Override
public String toString() {
return "[id:" + id + ", legacy:" + legacy + ", file:" + file.toAbsolutePath() + "]";
}
}
/**
* Deletes all meta state directories recursively for the given data locations
* @param dataLocations the data location to delete
*/
public static void deleteMetaState(Path... dataLocations) throws IOException {
Path[] stateDirectories = new Path[dataLocations.length];
for (int i = 0; i < dataLocations.length; i++) {
stateDirectories[i] = dataLocations[i].resolve(STATE_DIR_NAME);
}
IOUtils.rm(stateDirectories);
}
}
| {
"content_hash": "abdebdb1b376e7d61b27a957747e6780",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 158,
"avg_line_length": 48.26721763085399,
"alnum_prop": 0.6234233205867244,
"repo_name": "ESamir/elasticsearch",
"id": "c3c1cd3b73495df982d449255c1d708a35da3848",
"size": "18309",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/elasticsearch/gateway/MetaDataStateFormat.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ANTLR",
"bytes": "8172"
},
{
"name": "Batchfile",
"bytes": "11683"
},
{
"name": "Emacs Lisp",
"bytes": "3341"
},
{
"name": "FreeMarker",
"bytes": "45"
},
{
"name": "Groovy",
"bytes": "212815"
},
{
"name": "HTML",
"bytes": "5595"
},
{
"name": "Java",
"bytes": "33651186"
},
{
"name": "Perl",
"bytes": "6923"
},
{
"name": "Python",
"bytes": "75563"
},
{
"name": "Ruby",
"bytes": "1917"
},
{
"name": "Shell",
"bytes": "90733"
}
],
"symlink_target": ""
} |
{-# OPTIONS_HADDOCK show-extensions #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-|
Module : Data.Utils.Stack
Description : a simple stack monad
Copyright : (c) Lars Brünjes, 2016
License : MIT
Maintainer : [email protected]
Stability : experimental
Portability : portable
This module defines the 'StackT' monad transformer,
which is simply a wrapped state monad whose state is a list.
-}
module Data.Utils.Stack
( StackT
, pop
, peek
, push
, runStackT
, evalStackT
, execStackT
, Stack
, runStack
, evalStack
, execStack
) where
import Control.Monad.Trans.Class (MonadTrans)
import Data.MyPrelude
-- | A computation of type @'StackT' s m a@ has access to a stack of elements of type @s@.
--
newtype StackT s m a = StackT (StateT [s] m a)
deriving (Functor, Applicative, Monad, MonadTrans)
-- | Peeks at the top element of the stack. Returns 'Nothing' if the stack is empty.
--
peek :: Monad m => StackT s m (Maybe s)
peek = do
xs <- StackT get
return $ case xs of
[] -> Nothing
(x : _) -> Just x
-- | Pops the top element from the stack. Returns 'Nothing' if the stack is empty.
--
pop :: Monad m => StackT s m (Maybe s)
pop = do
xs <- StackT get
case xs of
[] -> return Nothing
(x : xs') -> (StackT $ put xs') >> return (Just x)
-- | Pushes a new element onto the stack.
--
push :: Monad m => s -> StackT s m ()
push x = StackT $ modify (x :)
-- | Runs a computation in the @'StackT' s m@ monad.
--
runStackT :: StackT s m a -> [s] -> m (a, [s])
runStackT (StackT m) = runStateT m
-- | Evaluates a computation in the @'StackT' s m@ monad.
--
evalStackT :: Monad m => StackT s m a -> [s] -> m a
evalStackT m xs = fst <$> runStackT m xs
-- | Executes a computation in the @'StackT' s m@ monad.
--
execStackT :: Monad m => StackT s m a -> [s] -> m [s]
execStackT m xs = snd <$> runStackT m xs
-- | A pure stack monad.
--
type Stack s = StackT s Identity
-- | Runs a computation in the @'Stack' s@ monad.
--
runStack :: Stack s a -> [s] -> (a, [s])
runStack m xs = runIdentity $ runStackT m xs
-- | Evaluates a computation in the @'Stack' s@ monad.
--
evalStack :: Stack s a -> [s] -> a
evalStack m xs = runIdentity $ evalStackT m xs
-- | Executes a computation in the @'Stack' s@ monad.
--
execStack :: Stack s a -> [s] -> [s]
execStack m xs = runIdentity $ execStackT m xs
| {
"content_hash": "14599d23ad1b0eb70ddbb1695becc7e8",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 90,
"avg_line_length": 25.48421052631579,
"alnum_prop": 0.6232961586121437,
"repo_name": "brunjlar/heap",
"id": "0f9db46491c26d9e575633c5dd91294703f83d8c",
"size": "2422",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "benchmark/Data/Utils/Stack.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "449915"
},
{
"name": "Haskell",
"bytes": "61054"
}
],
"symlink_target": ""
} |
export {log, error, warn, info, verbose, debug} from 'winston';
| {
"content_hash": "b66ec09befe6e214fc86d739517186db",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 63,
"avg_line_length": 64,
"alnum_prop": 0.703125,
"repo_name": "DirtyHairy/mayrogue-deathmatch",
"id": "10473d00506506360b0017c8ab06a0fada323b29",
"size": "64",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/server/log.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1008"
},
{
"name": "CoffeeScript",
"bytes": "1014"
},
{
"name": "GLSL",
"bytes": "593"
},
{
"name": "HTML",
"bytes": "5050"
},
{
"name": "JavaScript",
"bytes": "445134"
}
],
"symlink_target": ""
} |
set -xe # print commands and exit on error
# install server
installServerClient -o GsDevKit
createStone ${STONENAME1} $GS_VERSION
ls -altr $GS_HOME/server/stones/${STONENAME1}/snapshots
ls -altr $GS_HOME/server/stones/${STONENAME1}/extents
status
stopStone -b ${STONENAME1}
echo "$0 DONE"
| {
"content_hash": "6b4d8f9af0288a6c8b353211c39e3dbc",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 55,
"avg_line_length": 21.142857142857142,
"alnum_prop": 0.75,
"repo_name": "GsDevKit/GsDevKit_home",
"id": "d94fac7315584920c91a93785fba316e865a7b18",
"size": "652",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tests/basicInstallServer.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Shell",
"bytes": "266598"
},
{
"name": "Smalltalk",
"bytes": "391982"
},
{
"name": "Witcher Script",
"bytes": "6195"
}
],
"symlink_target": ""
} |
package com.planet_ink.coffee_mud.WebMacros;
import com.planet_ink.coffee_web.interfaces.*;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.DatabaseEngine.RoomContent;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
@SuppressWarnings("unchecked")
public class AreaItemNext extends StdWebMacro
{
@Override
public String name()
{
return "AreaItemNext";
}
@Override
public boolean isAdminMacro()
{
return true;
}
protected String spin(final String tag, final Collection<?> set, final HTTPRequest httpReq, final Map<String,String> parms)
{
String last=httpReq.getUrlParameter(tag);
if(parms.containsKey("RESET"))
{
if(last!=null)
httpReq.removeUrlParameter(tag);
return "";
}
String lastID="";
for(final Object name : set)
{
if((last==null)||((last.length()>0)&&(last.equals(lastID))&&(!(""+name).equals(lastID))))
{
httpReq.addFakeUrlParameter(tag,""+name);
last=""+name;
return "";
}
lastID=""+name;
}
httpReq.addFakeUrlParameter(tag,"");
return null;
}
@Override
public String runMacro(final HTTPRequest httpReq, final String parm, final HTTPResponse httpResp)
{
final Map<String,String> parms=parseParms(parm);
final String area=httpReq.getUrlParameter("AREA");
if((area==null)||(area.length()==0))
return "@break@";
final Area A=CMLib.map().getArea(area);
if(A==null)
return "@break@";
List<RoomContent> content=(List<RoomContent>)httpReq.getRequestObjects().get("AREA_"+area+"_ITEMCONTENT");
if(content == null)
{
content=Arrays.asList(CMLib.database().DBReadAreaItems(A.Name()));
httpReq.getRequestObjects().put("AREA_"+area+"_ITEMCONTENT",content);
}
if(parms.containsKey("AITEMROOM"))
{
final String itemName=httpReq.getUrlParameter("ITEMNAME");
final String itemHash=httpReq.getUrlParameter("ITEMHASH");
final String roomID=httpReq.getUrlParameter("ROOM");
if(((roomID!=null)&&(roomID.length()>0))
&&((itemName!=null)&&(itemName.length()>0))
&&((itemHash!=null)&&(itemHash.length()>0))
&&(!httpReq.isUrlParameter("ITEM")))
{
String itemID=null;
for(final RoomContent C : content)
{
if((C.name().equalsIgnoreCase(itemName))
&&(C.roomID().equalsIgnoreCase(roomID))
&&(itemHash.equals(""+C.contentHash())))
{
itemID=C.dbKey();
break;
}
}
if(itemID!=null)
{
final Item I=CMLib.database().DBReadRoomItem(roomID, itemID);
String s=CMLib.webMacroFilter().findItemWebCacheCode(I);
if(s.length()==0)
{
CMLib.webMacroFilter().contributeItemsToWebCache(new XVector<Item>(I));
s=CMLib.webMacroFilter().findItemWebCacheCode(I);
}
if(s.length()>0)
{
httpReq.addFakeUrlParameter("ITEM", s);
return s;
}
}
}
return "";
}
final String itemHash=parms.get("AITEMHASH");
final String itemFocus=parms.get("AITEMNAME");
if((itemFocus!=null)&&(itemFocus.length()>0))
{
Map<Integer,Set<String>> itemSets;
itemSets=(Map<Integer,Set<String>>)httpReq.getRequestObjects().get("AREA_"+area+"_ITEMSET_"+itemFocus);
if(itemSets == null)
{
itemSets = new TreeMap<Integer,Set<String>>();
for(final RoomContent C : content)
{
if(C.name().equalsIgnoreCase(itemFocus))
{
final Integer h = Integer.valueOf(C.contentHash());
if(!itemSets.containsKey(h))
itemSets.put(h, new TreeSet<String>());
itemSets.get(h).add(C.roomID());
}
}
httpReq.getRequestObjects().put("AREA_"+area+"_ITEMSET_"+itemFocus,itemSets);
}
if(itemSets.size()==1)
httpReq.addFakeUrlParameter("ITEMHASH",itemSets.keySet().iterator().next().toString());
if((itemHash!=null)&&(itemHash.length()>0))
{
final Set<String> itemHashSets=itemSets.get(Integer.valueOf(itemHash));
if(itemHashSets.size()==1)
httpReq.addFakeUrlParameter("ROOM", itemHashSets.iterator().next());
final String ret = spin("AITEMROOM", itemHashSets, httpReq, parms);
if(ret != null)
return ret;
}
else
{
final String ret = spin("AITEMHASH", itemSets.keySet(), httpReq, parms);
if(ret != null)
return ret;
}
}
else
{
final List<String> itemNames;
if(httpReq.getRequestObjects().containsKey("AREA_"+area+"_ITEMNAMES"))
itemNames=(List<String>)httpReq.getRequestObjects().get("AREA_"+area+"_ITEMNAMES");
else
{
itemNames=new ArrayList<String>();
final Set<String> namesDone = new TreeSet<String>();
for(final RoomContent roomContent : content)
{
if(!namesDone.contains(roomContent.name()))
namesDone.add(roomContent.name());
}
itemNames.addAll(namesDone);
httpReq.getRequestObjects().put("AREA_"+area+"_ITEMNAMES",itemNames);
}
final String ret = spin("AITEMNAME", itemNames, httpReq, parms);
if(ret != null)
return ret;
}
if(parms.containsKey("EMPTYOK"))
return "<!--EMPTY-->";
return " @break@";
}
}
| {
"content_hash": "37100a5ed048b945b4d92e7aea2022d2",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 124,
"avg_line_length": 31.97252747252747,
"alnum_prop": 0.6542361230451967,
"repo_name": "bozimmerman/CoffeeMud",
"id": "0781218a85b58710e35813dd15e9f6fae732ba2a",
"size": "6423",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "com/planet_ink/coffee_mud/WebMacros/AreaItemNext.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5847"
},
{
"name": "CSS",
"bytes": "1619"
},
{
"name": "HTML",
"bytes": "12319179"
},
{
"name": "Java",
"bytes": "38979811"
},
{
"name": "JavaScript",
"bytes": "45220"
},
{
"name": "Makefile",
"bytes": "23191"
},
{
"name": "Shell",
"bytes": "8783"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:state_enabled="true"
android:alpha="@dimen/highlight_alpha_material_colored"
android:color="?android:attr/colorControlActivated" />
<item android:color="?android:attr/colorControlHighlight" />
</selector><!-- From: file:/usr/local/google/buildbot/repo_clients/https___googleplex-android.googlesource.com_a_platform_manifest.git/mnc-sdk-release/frameworks/support/v7/appcompat/res/color-v23/abc_color_highlight_material.xml --><!-- From: file:/C:/Users/CK/AndroidStudioProjects/OMGAndroid/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.0.1/res/color-v23/abc_color_highlight_material.xml --> | {
"content_hash": "bbaf1d11daab87c9098d2a1dc23a4b5a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 422,
"avg_line_length": 62.47826086956522,
"alnum_prop": 0.7369519832985386,
"repo_name": "cmkeene/OMGAndroid",
"id": "58d9f6fa78651f287d8e0c603008e804e29155a4",
"size": "1437",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/build/intermediates/res/merged/debug/color-v23/abc_color_highlight_material.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "454284"
}
],
"symlink_target": ""
} |
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2012 Litecoin Developers
// Copyright (c) 2013 DHcoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHECKPOINT_H
#define BITCOIN_CHECKPOINT_H
#include <map>
class uint256;
class CBlockIndex;
/** Block-chain checkpoints are compiled-in sanity checks.
* They are updated every release or three.
*/
namespace Checkpoints
{
// Returns true if block passes checkpoint checks
bool CheckBlock(int nHeight, const uint256& hash);
// Return conservative estimate of total number of blocks, 0 if unknown
int GetTotalBlocksEstimate();
// Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex);
// Returns the block hash of latest hardened checkpoint
uint256 GetLatestHardenedCheckpoint();
}
#endif
| {
"content_hash": "0180478c17ab4f330f21298580d84909",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 89,
"avg_line_length": 31.8125,
"alnum_prop": 0.7573673870333988,
"repo_name": "lalik5/DHcoin",
"id": "6ae3b1feb8e38bd41b687f2221e3bb726bca0b4c",
"size": "1018",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/checkpoints.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "14838"
},
{
"name": "C++",
"bytes": "1474240"
},
{
"name": "Groff",
"bytes": "12841"
},
{
"name": "Makefile",
"bytes": "4579"
},
{
"name": "NSIS",
"bytes": "5934"
},
{
"name": "Objective-C",
"bytes": "766"
},
{
"name": "Objective-C++",
"bytes": "2463"
},
{
"name": "Python",
"bytes": "47538"
},
{
"name": "QMake",
"bytes": "11293"
},
{
"name": "Shell",
"bytes": "1402"
}
],
"symlink_target": ""
} |
/**
* @file src/modules/imageProc/ImgAnalyzeFactory.cpp
* @date Jun 2018
* @author PhRG - opticalp.fr
*/
/*
Copyright (c) 2018 Ph. Renaud-Goud / Opticalp
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "ImgAnalyzeFactory.h"
#include "modules/GenericLeafFactory.h"
#include "HistogramMod.h"
#include "CenterOfMass.h"
#include "ImgStats.h"
std::vector<std::string> ImgAnalyzeFactory::selectValueList()
{
std::vector<std::string> list;
#ifdef HAVE_OPENCV
list.push_back("simpleStats");
list.push_back("histogram");
list.push_back("centerOfMass");
#endif /* HAVE_OPENCV*/
return list;
}
ModuleFactoryBranch* ImgAnalyzeFactory::newChildFactory(std::string selector)
{
#ifdef HAVE_OPENCV
if (selector.compare("simpleStats") == 0)
{
return new GenericLeafFactory<ImgStats>("SimpleStatsFactory",
"Build simple image stats (min, max, mean, sigma...) module",
this, selector);
}
else if (selector.compare("histogram") == 0)
{
return new GenericLeafFactory<HistogramMod>("HistrogramFactory",
"Build image histogram module",
this, selector);
}
else if (selector.compare("centerOfMass") == 0)
{
return new GenericLeafFactory<CenterOfMass>("CenterOfMassFactory",
"Build image center of mass module",
this, selector);
}
else
#endif /* HAVE_OPENCV */
{
poco_bugcheck_msg("Create: unknown selector");
throw Poco::BugcheckException();
}
}
| {
"content_hash": "5163728a390da9b52f4c62014c7189e1",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 32.50666666666667,
"alnum_prop": 0.7317473338802297,
"repo_name": "Opticalp/instrumentall",
"id": "c2c9af66c74765ffe851f5ce70c52bffe5967dd7",
"size": "2438",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/modules/imageProc/ImgAnalyzeFactory.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2866"
},
{
"name": "C",
"bytes": "36705"
},
{
"name": "C++",
"bytes": "1536212"
},
{
"name": "CMake",
"bytes": "29434"
},
{
"name": "Python",
"bytes": "193446"
},
{
"name": "Shell",
"bytes": "4343"
}
],
"symlink_target": ""
} |
class UsersController < ApplicationController
def create
@user = User.new(user_params)
if @user.save
login(@user)
render :show
else
flash.now[:alerts] = @user.errors.full_messages
render :new
end
end
def new
@user = User.new
end
def destroy
end
def show
end
def edit
end
def update
end
private
def user_params
params.require(:user).permit(:username, :password, :session_token)
end
end
| {
"content_hash": "d1c619ed3db516fba3046f8fa7b3520f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 70,
"avg_line_length": 13.457142857142857,
"alnum_prop": 0.6305732484076433,
"repo_name": "mdgraser/app-academy",
"id": "c3eb6140d8d6c4195a1991cfc79e805ec58b704b",
"size": "471",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "week4/day5/app/controllers/users_controller.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7162"
},
{
"name": "CoffeeScript",
"bytes": "3165"
},
{
"name": "JavaScript",
"bytes": "14791"
},
{
"name": "Ruby",
"bytes": "306975"
}
],
"symlink_target": ""
} |
#ifndef __VDS_USER_MANAGER_KEYS_CONTROL_H_
#define __VDS_USER_MANAGER_KEYS_CONTROL_H_
#include "asymmetriccrypto.h"
#include "encoding.h"
class mock_server;
namespace vds {
class keys_control {
public:
static const_data_buffer root_id() {
auto result = base64::to_bytes(root_id_);
return result.value();
}
class private_info_t {
public:
std::shared_ptr<asymmetric_private_key> root_private_key_;
expected<void> genereate_all();
private:
friend class mock_server;
};
static expected<void> genereate_all(
const private_info_t & private_info);
private:
friend class get_root_app;
friend class mock_server;
static char root_id_[65];
static std::shared_ptr<asymmetric_public_key> load_public_key(const char * data) {
auto rb = base64::to_bytes(data);
#if __cpp_exceptions
if (rb.has_error()) {
throw std::runtime_error(rb.error()->what());
}
#endif
auto rc = asymmetric_public_key::parse_der(rb.value());
#if __cpp_exceptions
if (rc.has_error()) {
throw std::runtime_error(rc.error()->what());
}
#endif
return std::make_shared<asymmetric_public_key>(std::move(rc.value()));
}
static std::shared_ptr<asymmetric_private_key> load_private_key(const char * data) {
auto rb = base64::to_bytes(data);
#if __cpp_exceptions
if (rb.has_error()) {
throw std::runtime_error(rb.error()->what());
}
#endif
auto rc = asymmetric_private_key::parse_der(rb.value(), std::string());
#if __cpp_exceptions
if (rc.has_error()) {
throw std::runtime_error(rc.error()->what());
}
#endif
return std::make_shared<asymmetric_private_key>(std::move(rc.value()));
}
};
}
#endif //__VDS_USER_MANAGER_KEYS_CONTROL_H_
| {
"content_hash": "a8de5f7d5b130fd8d0adfced42329736",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 88,
"avg_line_length": 24.554054054054053,
"alnum_prop": 0.6186020913593836,
"repo_name": "lboss75/vds",
"id": "3e304103e33f7337a6b463c539b584c6ca045ccf",
"size": "1896",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kernel/vds_crypto/keys_control.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "8860"
},
{
"name": "C",
"bytes": "8554796"
},
{
"name": "C#",
"bytes": "9325"
},
{
"name": "C++",
"bytes": "1356529"
},
{
"name": "CMake",
"bytes": "30570"
},
{
"name": "CSS",
"bytes": "1396"
},
{
"name": "HTML",
"bytes": "69902"
},
{
"name": "Java",
"bytes": "3368"
},
{
"name": "JavaScript",
"bytes": "7482"
},
{
"name": "Objective-C",
"bytes": "802"
},
{
"name": "PHP",
"bytes": "1944"
},
{
"name": "Shell",
"bytes": "10847"
}
],
"symlink_target": ""
} |
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg" module="modA" revision="1.0" />
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" />
<conf name="optional" visibility="public" description="contains all optional dependencies"/>
</configurations>
<dependencies>
<dependency org="myorg" name="modB" rev="1.0" />
</dependencies>
</ivy-module>
| {
"content_hash": "b403305d1518b1acb98d244ddab11f25",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 133,
"avg_line_length": 45.892857142857146,
"alnum_prop": 0.7245136186770428,
"repo_name": "jaikiran/ant-ivy",
"id": "8ee7a6d0833a4bbc7176e442ee0fac73bc69839b",
"size": "1285",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "test/repositories/IVY-1178/myorg/modA/1.0/ivy-1.0.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "19116"
},
{
"name": "HTML",
"bytes": "124298"
},
{
"name": "Java",
"bytes": "4392206"
},
{
"name": "JavaScript",
"bytes": "7341"
},
{
"name": "Ruby",
"bytes": "5974"
},
{
"name": "XSLT",
"bytes": "81934"
}
],
"symlink_target": ""
} |
import * as React from 'react';
interface ISectorNameProps {
name: string;
}
class SectorName extends React.Component<ISectorNameProps, null> {
shouldComponentUpdate (nextProps:ISectorNameProps) {
return this.props.name !== nextProps.name;
}
render() {
return (
<section className="sector">
<div>{this.props.name}</div>
</section>
);
}
}
export default SectorName; | {
"content_hash": "71d07a0c5563d9c875bb056b444e9e69",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 19.61904761904762,
"alnum_prop": 0.6650485436893204,
"repo_name": "guptag/js-frameworks",
"id": "cce8562e7d72f30e232a8469a71ef0d77c6e849c",
"size": "412",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Redux/examples/redux-perf-test/src/ui/components/ticker-list/Sector.tsx",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21283"
},
{
"name": "HTML",
"bytes": "38160"
},
{
"name": "JavaScript",
"bytes": "74469"
},
{
"name": "TypeScript",
"bytes": "106466"
}
],
"symlink_target": ""
} |
package bootstrappolicy
// known namespaces
const (
DefaultOpenShiftSharedResourcesNamespace = "openshift"
DefaultOpenShiftInfraNamespace = "openshift-infra"
)
// users
const (
DefaultServiceAccountName = "default"
BuilderServiceAccountName = "builder"
DeployerServiceAccountName = "deployer"
MasterUnqualifiedUsername = "openshift-master"
AggregatorUnqualifiedUsername = "openshift-aggregator"
MasterUsername = "system:" + MasterUnqualifiedUsername
AggregatorUsername = "system:" + AggregatorUnqualifiedUsername
SystemAdminUsername = "system:admin"
// Not granted any API permissions, just an identity for a client certificate for the API proxy to use
// Should not be changed without considering impact to pods that may be verifying this identity by default
MasterProxyUnqualifiedUsername = "master-proxy"
MasterProxyUsername = "system:" + MasterProxyUnqualifiedUsername
// Previous versions used this as the username for the master to connect to the kubelet
// This should remain in the default role bindings for the NodeAdmin role
LegacyMasterKubeletAdminClientUsername = "system:master"
MasterKubeletAdminClientUsername = "system:openshift-node-admin"
)
// groups
const (
UnauthenticatedUsername = "system:anonymous"
AuthenticatedGroup = "system:authenticated"
AuthenticatedOAuthGroup = "system:authenticated:oauth"
UnauthenticatedGroup = "system:unauthenticated"
ClusterAdminGroup = "system:cluster-admins"
ClusterReaderGroup = "system:cluster-readers"
MastersGroup = "system:masters"
NodesGroup = "system:nodes"
NodeAdminsGroup = "system:node-admins"
NodeReadersGroup = "system:node-readers"
)
// Roles
const (
ClusterAdminRoleName = "cluster-admin"
SudoerRoleName = "sudoer"
ScopeImpersonationRoleName = "system:scope-impersonation"
ClusterReaderRoleName = "cluster-reader"
StorageAdminRoleName = "storage-admin"
ClusterDebuggerRoleName = "cluster-debugger"
AdminRoleName = "admin"
EditRoleName = "edit"
ViewRoleName = "view"
SelfProvisionerRoleName = "self-provisioner"
BasicUserRoleName = "basic-user"
StatusCheckerRoleName = "cluster-status"
SelfAccessReviewerRoleName = "self-access-reviewer"
RegistryAdminRoleName = "registry-admin"
RegistryViewerRoleName = "registry-viewer"
RegistryEditorRoleName = "registry-editor"
TemplateServiceBrokerClientRoleName = "system:openshift:templateservicebroker-client"
BuildStrategyDockerRoleName = "system:build-strategy-docker"
BuildStrategyCustomRoleName = "system:build-strategy-custom"
BuildStrategySourceRoleName = "system:build-strategy-source"
BuildStrategyJenkinsPipelineRoleName = "system:build-strategy-jenkinspipeline"
ImageAuditorRoleName = "system:image-auditor"
ImagePullerRoleName = "system:image-puller"
ImagePusherRoleName = "system:image-pusher"
ImageBuilderRoleName = "system:image-builder"
ImagePrunerRoleName = "system:image-pruner"
ImageSignerRoleName = "system:image-signer"
DeployerRoleName = "system:deployer"
RouterRoleName = "system:router"
RegistryRoleName = "system:registry"
MasterRoleName = "system:master"
NodeRoleName = "system:node"
NodeProxierRoleName = "system:node-proxier"
SDNReaderRoleName = "system:sdn-reader"
SDNManagerRoleName = "system:sdn-manager"
OAuthTokenDeleterRoleName = "system:oauth-token-deleter"
WebHooksRoleName = "system:webhook"
DiscoveryRoleName = "system:discovery"
PersistentVolumeProvisionerRoleName = "system:persistent-volume-provisioner"
// NodeAdmin has full access to the API provided by the kubelet
NodeAdminRoleName = "system:node-admin"
// NodeReader has read access to the metrics and stats provided by the kubelet
NodeReaderRoleName = "system:node-reader"
OpenshiftSharedResourceViewRoleName = "shared-resource-viewer"
NodeBootstrapRoleName = "system:node-bootstrapper"
)
// RoleBindings
const (
SelfAccessReviewerRoleBindingName = SelfAccessReviewerRoleName + "s"
SelfProvisionerRoleBindingName = SelfProvisionerRoleName + "s"
DeployerRoleBindingName = DeployerRoleName + "s"
ClusterAdminRoleBindingName = ClusterAdminRoleName + "s"
ClusterReaderRoleBindingName = ClusterReaderRoleName + "s"
BasicUserRoleBindingName = BasicUserRoleName + "s"
OAuthTokenDeleterRoleBindingName = OAuthTokenDeleterRoleName + "s"
StatusCheckerRoleBindingName = StatusCheckerRoleName + "-binding"
ImagePullerRoleBindingName = ImagePullerRoleName + "s"
ImageBuilderRoleBindingName = ImageBuilderRoleName + "s"
RouterRoleBindingName = RouterRoleName + "s"
RegistryRoleBindingName = RegistryRoleName + "s"
MasterRoleBindingName = MasterRoleName + "s"
NodeRoleBindingName = NodeRoleName + "s"
NodeProxierRoleBindingName = NodeProxierRoleName + "s"
NodeAdminRoleBindingName = NodeAdminRoleName + "s"
NodeReaderRoleBindingName = NodeReaderRoleName + "s"
SDNReaderRoleBindingName = SDNReaderRoleName + "s"
SDNManagerRoleBindingName = SDNManagerRoleName + "s"
WebHooksRoleBindingName = WebHooksRoleName + "s"
DiscoveryRoleBindingName = DiscoveryRoleName + "-binding"
RegistryAdminRoleBindingName = RegistryAdminRoleName + "s"
RegistryViewerRoleBindingName = RegistryViewerRoleName + "s"
RegistryEditorRoleBindingName = RegistryEditorRoleName + "s"
BuildStrategyDockerRoleBindingName = BuildStrategyDockerRoleName + "-binding"
BuildStrategyCustomRoleBindingName = BuildStrategyCustomRoleName + "-binding"
BuildStrategySourceRoleBindingName = BuildStrategySourceRoleName + "-binding"
BuildStrategyJenkinsPipelineRoleBindingName = BuildStrategyJenkinsPipelineRoleName + "-binding"
OpenshiftSharedResourceViewRoleBindingName = OpenshiftSharedResourceViewRoleName + "s"
)
| {
"content_hash": "eae2e834a5452d9f5478711fb93961bc",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 107,
"avg_line_length": 45.91970802919708,
"alnum_prop": 0.7207121284374504,
"repo_name": "pmorie/origin",
"id": "4401ee901fe330beeac73d81752baf0d4bdf8032",
"size": "6291",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "pkg/cmd/server/bootstrappolicy/constants.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "1842"
},
{
"name": "DIGITAL Command Language",
"bytes": "117"
},
{
"name": "Go",
"bytes": "20427505"
},
{
"name": "Groovy",
"bytes": "5024"
},
{
"name": "HTML",
"bytes": "74732"
},
{
"name": "Makefile",
"bytes": "24417"
},
{
"name": "Protocol Buffer",
"bytes": "668184"
},
{
"name": "Python",
"bytes": "34268"
},
{
"name": "Roff",
"bytes": "2049"
},
{
"name": "Ruby",
"bytes": "484"
},
{
"name": "Shell",
"bytes": "2237192"
},
{
"name": "Smarty",
"bytes": "626"
}
],
"symlink_target": ""
} |
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
...
Print the above list in order sorted by word (python will sort punctuation to
come before letters -- that's fine). Store all the words as lowercase,
so 'The' and 'the' count as the same word.
2. For the --topcount flag, implement a print_top(filename) which is similar
to print_words() but which prints just the top 20 most common words sorted
so the most common word is first, then the next most common, and so on.
Use str.split() (no arguments) to split on all whitespace.
Workflow: don't build the whole program at once. Get it to an intermediate
milestone and print your data structure and sys.exit(0).
When that's working, try for the next milestone.
Optional: define a helper function to avoid code duplication inside
print_words() and print_top().
"""
import sys
# +++your code here+++
# Define print_words(filename) and print_top(filename) functions.
# You could write a helper utility function that reads a file
# and builds and returns a word/count dict for it.
# Then print_words() and print_top() can just call the utility function.
def build_dict(file_name):
dict = {}
f = open(file_name, 'rU')
for line in f:
list = line.split()
for word in list:
if word.lower() in dict:
dict[word.lower()] = dict[word.lower()] + 1
else:
dict[word.lower()] = 1
f.close()
return dict
def print_words(file_name):
dict = build_dict(file_name)
for k, v in sorted(dict.items()): print k, ' ', v
def get_count(word_count_tuple):
return word_count_tuple[1]
def print_top(file_name):
dict = build_dict(file_name)
sortedlist = sorted(dict.items(), key=get_count, reverse=True)
for k, v in sortedlist[:20]: print k, ' ', v
###
# This basic command line argument parsing code is provided and
# calls the print_words() and print_top() functions which you must define.
def main():
if len(sys.argv) != 3:
print 'usage: ./wordcount.py {--count | --topcount} file'
sys.exit(1)
option = sys.argv[1]
filename = sys.argv[2]
if option == '--count':
print_words(filename)
elif option == '--topcount':
print_top(filename)
else:
print 'unknown option: ' + option
sys.exit(1)
if __name__ == '__main__':
main()
| {
"content_hash": "17777c47c14c58b3812be7b0bdf3843e",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 29.658823529411766,
"alnum_prop": 0.6925823086076953,
"repo_name": "custom22/google-python-exercises",
"id": "5aaac4724d191edd4cc35e3afc86c5d8e8c092c4",
"size": "2752",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "basic/wordcount.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "DIGITAL Command Language",
"bytes": "191608"
},
{
"name": "HTML",
"bytes": "653443"
},
{
"name": "Python",
"bytes": "60069"
}
],
"symlink_target": ""
} |
glmFeatureLabel::glmFeatureLabel(): m_text("NONE"), m_alpha(0.0), m_cameraPos(NULL), bVisible(false), m_bChanged(true) {
}
glmFeatureLabel::glmFeatureLabel(const std::string &_text):m_text(_text), m_alpha(0.0), m_cameraPos(NULL), bVisible(false), m_bChanged(true){
}
glmFeatureLabel::~glmFeatureLabel(){
FONScontext* ctx = m_font->getContext();
glfonsUnbufferText(ctx, m_fsid);
};
std::string glmFeatureLabel::getText(){
return m_text;
}
void glmFeatureLabel::setFont(glmFontRef &_fontRef){
m_font = _fontRef;
m_bChanged = true;
if(m_font != NULL && m_font->isLoaded()) {
FONScontext* ctx = m_font->getContext();
glfonsBufferText(ctx, m_text.c_str(), &m_fsid, m_font->getEffect());
}
}
void glmFeatureLabel::setText(const std::string &_text){
m_text = _text;
stringPurifier(m_text);
m_bChanged = true;
}
void glmFeatureLabel::setCameraPos(glm::vec3 *_camPos){
m_cameraPos = _camPos;
}
unsigned int glmFeatureLabel::getId() const {
return m_fsid;
} | {
"content_hash": "14cc7e67312a4e417e8956a8626a6059",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 141,
"avg_line_length": 25.825,
"alnum_prop": 0.6573088092933205,
"repo_name": "tangrams/ofxVectorTile",
"id": "5afed0f7f24ba4ee62c21fdcd941f845d883215c",
"size": "1226",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "libs/glmTile/Labels/glmFeatureLabel.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "147502"
},
{
"name": "C++",
"bytes": "99584"
},
{
"name": "GLSL",
"bytes": "1396"
},
{
"name": "Makefile",
"bytes": "3200"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>User agent detail - SonyEricsson290i/R101</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="../circle.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="section">
<h1 class="header center orange-text">User agent detail</h1>
<div class="row center">
<h5 class="header light">
SonyEricsson290i/R101
</h5>
</div>
</div>
<div class="section">
<table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Test suite</th></tr><tr><td>UAParser<br /><small>v0.5.0.2</small><br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">SonyEricsson</td><td>290i</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-cfed3005-df48-4fa8-bf03-4f6ef8988f59">Detail</a>
<!-- Modal Structure -->
<div id="modal-cfed3005-df48-4fa8-bf03-4f6ef8988f59" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">Array
(
[user_agent_string] => SonyEricsson290i/R101
[family] => Ericsson 290i
[brand] => SonyEricsson
[model] => 290i
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapFull<br /><small>6014</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>BrowscapLite<br /><small>6014</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>BrowscapPhp<br /><small>6014</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>DonatjUAParser<br /><small>v0.5.1</small><br /></td><td>SonyEricsson290i R101</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050">Detail</a>
<!-- Modal Structure -->
<div id="modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] =>
[browser] => SonyEricsson290i
[version] => R101
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>JenssegersAgent<br /><small>v2.3.3</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-b85a2b91-6a55-4436-a82c-1ea0d46e2e51">Detail</a>
<!-- Modal Structure -->
<div id="modal-b85a2b91-6a55-4436-a82c-1ea0d46e2e51" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>JenssegersAgent result detail</h4>
<p><pre><code class="php">Array
(
[browserName] =>
[browserVersion] =>
[osName] =>
[osVersion] =>
[deviceModel] => Sony
[isMobile] => 1
[isRobot] =>
[botName] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>NeutrinoApiCom<br /><small></small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Sony Ericsson</td><td>290i</td><td>mobile-browser</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.20501</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b">Detail</a>
<!-- Modal Structure -->
<div id="modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>NeutrinoApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[mobile_screen_height] => 0
[is_mobile] => 1
[type] => mobile-browser
[mobile_brand] => Sony Ericsson
[mobile_model] => 290i
[version] =>
[is_android] =>
[browser_name] => unknown
[operating_system_family] => unknown
[operating_system_version] =>
[is_ios] =>
[producer] => Sony Ericsson
[operating_system] => unknown
[mobile_screen_width] => 0
[mobile_browser] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Sony Ericsson</td><td>290i</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.004</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-4a941d34-a8d3-4914-9724-346f60ad7046">Detail</a>
<!-- Modal Structure -->
<div id="modal-4a941d34-a8d3-4914-9724-346f60ad7046" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] =>
[operatingSystem] => Array
(
)
[device] => Array
(
[brand] => SE
[brandName] => Sony Ericsson
[model] => 290i
[device] => 1
[deviceName] => smartphone
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] =>
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] => 1
[isTablet] =>
[isTV] =>
[isDesktop] =>
[isMobile] => 1
[isTouchEnabled] =>
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.1</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>UAParser<br /><small>v3.4.5</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">SonyEricsson</td><td>290i</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-3160e405-8a8f-46dd-8f47-5115f06462d2">Detail</a>
<!-- Modal Structure -->
<div id="modal-3160e405-8a8f-46dd-8f47-5115f06462d2" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UAParser result detail</h4>
<p><pre><code class="php">UAParser\Result\Client Object
(
[ua] => UAParser\Result\UserAgent Object
(
[major] =>
[minor] =>
[patch] =>
[family] => Other
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] =>
[minor] =>
[patch] =>
[patchMinor] =>
[family] => Other
)
[device] => UAParser\Result\Device Object
(
[brand] => SonyEricsson
[model] => 290i
[family] => Ericsson 290i
)
[originalUserAgent] => SonyEricsson290i/R101
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentApiCom<br /><small></small><br /></td><td> </td><td> </td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>Mobile</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.15401</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-afeb05fb-26b9-4509-b8ac-0c604a9e97d6">Detail</a>
<!-- Modal Structure -->
<div id="modal-afeb05fb-26b9-4509-b8ac-0c604a9e97d6" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>UserAgentApiCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[platform_name] => Sony Ericsson
[platform_version] => 290
[platform_type] => Mobile
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>UserAgentStringCom<br /><small></small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>WhatIsMyBrowserCom<br /><small></small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Sony Ericsson</td><td>Sony Ericsson 290i</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.24501</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c">Detail</a>
<!-- Modal Structure -->
<div id="modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhatIsMyBrowserCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[operating_system_name] =>
[simple_sub_description_string] =>
[simple_browser_string] =>
[browser_version] =>
[extra_info] => Array
(
)
[operating_platform] => Sony Ericsson 290i
[extra_info_table] => Array
(
)
[layout_engine_name] =>
[detected_addons] => Array
(
)
[operating_system_flavour_code] =>
[hardware_architecture] =>
[operating_system_flavour] =>
[operating_system_frameworks] => Array
(
)
[browser_name_code] =>
[operating_system_version] =>
[simple_operating_platform_string] => Sony Ericsson 290i
[is_abusive] =>
[layout_engine_version] =>
[browser_capabilities] => Array
(
)
[operating_platform_vendor_name] => Sony Ericsson
[operating_system] =>
[operating_system_version_full] =>
[operating_platform_code] => 290i
[browser_name] =>
[operating_system_name_code] =>
[user_agent] => SonyEricsson290i/R101
[browser_version_full] =>
[browser] =>
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Sony Ericsson</td><td>290i</td><td>mobile:feature</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.003</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-083a336f-5d73-4505-84f3-c5fc9bb78652">Detail</a>
<!-- Modal Structure -->
<div id="modal-083a336f-5d73-4505-84f3-c5fc9bb78652" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[device] => Array
(
[type] => mobile
[subtype] => feature
[manufacturer] => Sony Ericsson
[model] => 290i
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Woothee<br /><small>v1.2.0</small><br /></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>Wurfl<br /><small>1.7.1.0</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">SonyEricsson</td><td>T290i</td><td>Feature Phone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.02</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50">Detail</a>
<!-- Modal Structure -->
<div id="modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => false
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => false
[is_mobile] => true
[is_robot] => false
[is_smartphone] => false
[is_touchscreen] => false
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => true
[is_html_preferred] => false
[advertised_device_os] =>
[advertised_device_os_version] =>
[advertised_browser] =>
[advertised_browser_version] =>
[complete_device_name] => SonyEricsson T290i
[device_name] => SonyEricsson T290i
[form_factor] => Feature Phone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => SonyEricsson
[model_name] => T290i
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => false
[has_qwerty_keyboard] => false
[can_skip_aligned_link_row] => false
[uaprof] => http://wap.sonyericsson.com/UAprof/T290iR101.xml
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] =>
[mobile_browser] =>
[mobile_browser_version] =>
[device_os_version] =>
[pointing_method] =>
[release_date] => 2002_january
[marketing_name] =>
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => true
[table_support] => true
[numbered_menus] => false
[menu_with_select_element_recommended] => false
[menu_with_list_of_links_recommended] => true
[icons_on_menu_items_support] => false
[break_list_of_links_with_br_element_recommended] => true
[access_key_support] => false
[wrap_mode_support] => false
[times_square_mode_support] => false
[deck_prefetch_support] => false
[elective_forms_recommended] => true
[wizards_recommended] => false
[image_as_link_support] => false
[insert_br_element_after_widget_recommended] => false
[wml_can_display_images_and_text_on_same_line] => false
[wml_displays_image_in_center] => true
[opwv_wml_extensions_support] => false
[wml_make_phone_call_string] => wtai://wp/mc;
[chtml_display_accesskey] => false
[emoji] => false
[chtml_can_display_images_and_text_on_same_line] => false
[chtml_displays_image_in_center] => false
[imode_region] => none
[chtml_make_phone_call_string] => tel:
[chtml_table_support] => false
[xhtml_honors_bgcolor] => false
[xhtml_supports_forms_in_table] => false
[xhtml_support_wml2_namespace] => false
[xhtml_autoexpand_select] => false
[xhtml_select_as_dropdown] => false
[xhtml_select_as_radiobutton] => false
[xhtml_select_as_popup] => false
[xhtml_display_accesskey] => true
[xhtml_supports_invisible_text] => false
[xhtml_supports_inline_input] => false
[xhtml_supports_monospace_font] => false
[xhtml_supports_table_for_layout] => true
[xhtml_supports_css_cell_table_coloring] => false
[xhtml_format_as_css_property] => true
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => false
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => false
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => utf8
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => application/vnd.wap.xhtml+xml
[xhtml_table_support] => true
[xhtml_send_sms_string] => none
[xhtml_send_mms_string] => none
[xhtml_file_upload] => not_supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => none
[xhtml_avoid_accesskeys] => false
[xhtml_can_embed_video] => none
[ajax_support_javascript] => false
[ajax_manipulate_css] => false
[ajax_support_getelementbyid] => false
[ajax_support_inner_html] => false
[ajax_xhr_type] => none
[ajax_manipulate_dom] => false
[ajax_support_events] => false
[ajax_support_event_listener] => false
[ajax_preferred_geoloc_api] => none
[xhtml_support_level] => 2
[preferred_markup] => html_wi_oma_xhtmlmp_1_0
[wml_1_1] => true
[wml_1_2] => true
[wml_1_3] => true
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => false
[html_wi_imode_html_2] => false
[html_wi_imode_html_3] => false
[html_wi_imode_html_4] => false
[html_wi_imode_html_5] => false
[html_wi_imode_htmlx_1] => false
[html_wi_imode_htmlx_1_1] => false
[html_wi_imode_compact_generic] => false
[html_web_3_2] => false
[html_web_4_0] => false
[voicexml] => false
[multipart_support] => false
[total_cache_disable_support] => false
[time_to_live_support] => false
[resolution_width] => 101
[resolution_height] => 80
[columns] => 15
[max_image_width] => 101
[max_image_height] => 60
[rows] => 6
[physical_screen_width] => 27
[physical_screen_height] => 27
[dual_orientation] => false
[density_class] => 1.0
[wbmp] => true
[bmp] => false
[epoc_bmp] => false
[gif_animated] => true
[jpg] => true
[png] => false
[tiff] => false
[transparent_png_alpha] => false
[transparent_png_index] => false
[svgt_1_1] => false
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 4096
[webp_lossy_support] => false
[webp_lossless_support] => false
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => true
[wta_voice_call] => false
[wta_phonebook] => true
[wta_misc] => false
[wta_pdc] => false
[https_support] => true
[phone_id_provided] => false
[max_data_rate] => 40
[wifi] => false
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 12288
[max_url_length_in_requests] => 128
[max_url_length_homepage] => 0
[max_url_length_bookmark] => 0
[max_url_length_cached_page] => 0
[max_no_of_connection_settings] => 0
[max_no_of_bookmarks] => 0
[max_length_of_username] => 0
[max_length_of_password] => 0
[max_object_size] => 0
[downloadfun_support] => false
[directdownload_support] => true
[inline_support] => true
[oma_support] => true
[ringtone] => true
[ringtone_3gpp] => false
[ringtone_midi_monophonic] => false
[ringtone_midi_polyphonic] => true
[ringtone_imelody] => true
[ringtone_digiplug] => false
[ringtone_compactmidi] => false
[ringtone_mmf] => false
[ringtone_rmf] => false
[ringtone_xmf] => false
[ringtone_amr] => true
[ringtone_awb] => false
[ringtone_aac] => false
[ringtone_wav] => false
[ringtone_mp3] => false
[ringtone_spmidi] => false
[ringtone_qcelp] => false
[ringtone_voices] => 32
[ringtone_df_size_limit] => 0
[ringtone_directdownload_size_limit] => 61440
[ringtone_inline_size_limit] => 61440
[ringtone_oma_size_limit] => 0
[wallpaper] => true
[wallpaper_max_width] => 0
[wallpaper_max_height] => 0
[wallpaper_preferred_width] => 101
[wallpaper_preferred_height] => 80
[wallpaper_resize] => none
[wallpaper_wbmp] => false
[wallpaper_bmp] => false
[wallpaper_gif] => true
[wallpaper_jpg] => true
[wallpaper_png] => false
[wallpaper_tiff] => false
[wallpaper_greyscale] => false
[wallpaper_colors] => 12
[wallpaper_df_size_limit] => 0
[wallpaper_directdownload_size_limit] => 61440
[wallpaper_inline_size_limit] => 61440
[wallpaper_oma_size_limit] => 0
[screensaver] => true
[screensaver_max_width] => 0
[screensaver_max_height] => 0
[screensaver_preferred_width] => 0
[screensaver_preferred_height] => 0
[screensaver_resize] => none
[screensaver_wbmp] => false
[screensaver_bmp] => false
[screensaver_gif] => true
[screensaver_jpg] => false
[screensaver_png] => false
[screensaver_greyscale] => false
[screensaver_colors] => 2
[screensaver_df_size_limit] => 0
[screensaver_directdownload_size_limit] => 61440
[screensaver_inline_size_limit] => 61440
[screensaver_oma_size_limit] => 0
[picture] => true
[picture_max_width] => 0
[picture_max_height] => 0
[picture_preferred_width] => 0
[picture_preferred_height] => 0
[picture_resize] => none
[picture_wbmp] => false
[picture_bmp] => false
[picture_gif] => true
[picture_jpg] => false
[picture_png] => false
[picture_greyscale] => false
[picture_colors] => 2
[picture_df_size_limit] => 0
[picture_directdownload_size_limit] => 61440
[picture_inline_size_limit] => 61440
[picture_oma_size_limit] => 0
[video] => false
[oma_v_1_0_forwardlock] => true
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => false
[streaming_video] => false
[streaming_3gpp] => false
[streaming_mp4] => false
[streaming_mov] => false
[streaming_video_size_limit] => 0
[streaming_real_media] => none
[streaming_flv] => false
[streaming_3g2] => false
[streaming_vcodec_h263_0] => -1
[streaming_vcodec_h263_3] => -1
[streaming_vcodec_mpeg4_sp] => -1
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => -1
[streaming_acodec_amr] => none
[streaming_acodec_aac] => none
[streaming_wmv] => none
[streaming_preferred_protocol] => rtsp
[streaming_preferred_http_protocol] => none
[wap_push_support] => true
[connectionless_service_indication] => false
[connectionless_service_load] => false
[connectionless_cache_operation] => true
[connectionoriented_unconfirmed_service_indication] => false
[connectionoriented_unconfirmed_service_load] => false
[connectionoriented_unconfirmed_cache_operation] => true
[connectionoriented_confirmed_service_indication] => true
[connectionoriented_confirmed_service_load] => true
[connectionoriented_confirmed_cache_operation] => true
[utf8_support] => false
[ascii_support] => false
[iso8859_support] => false
[expiration_date] => false
[j2me_cldc_1_0] => false
[j2me_cldc_1_1] => false
[j2me_midp_1_0] => false
[j2me_midp_2_0] => false
[doja_1_0] => false
[doja_1_5] => false
[doja_2_0] => false
[doja_2_1] => false
[doja_2_2] => false
[doja_3_0] => false
[doja_3_5] => false
[doja_4_0] => false
[j2me_jtwi] => false
[j2me_mmapi_1_0] => false
[j2me_mmapi_1_1] => false
[j2me_wmapi_1_0] => false
[j2me_wmapi_1_1] => false
[j2me_wmapi_2_0] => false
[j2me_btapi] => false
[j2me_3dapi] => false
[j2me_locapi] => false
[j2me_nokia_ui] => false
[j2me_motorola_lwt] => false
[j2me_siemens_color_game] => false
[j2me_siemens_extension] => false
[j2me_heap_size] => 0
[j2me_max_jar_size] => 0
[j2me_storage_size] => 0
[j2me_max_record_store_size] => 0
[j2me_screen_width] => 0
[j2me_screen_height] => 0
[j2me_canvas_width] => 0
[j2me_canvas_height] => 0
[j2me_bits_per_pixel] => 0
[j2me_audio_capture_enabled] => false
[j2me_video_capture_enabled] => false
[j2me_photo_capture_enabled] => false
[j2me_capture_image_formats] => none
[j2me_http] => false
[j2me_https] => false
[j2me_socket] => false
[j2me_udp] => false
[j2me_serial] => false
[j2me_gif] => false
[j2me_gif89a] => false
[j2me_jpg] => false
[j2me_png] => false
[j2me_bmp] => false
[j2me_bmp3] => false
[j2me_wbmp] => false
[j2me_midi] => false
[j2me_wav] => false
[j2me_amr] => false
[j2me_mp3] => false
[j2me_mp4] => false
[j2me_imelody] => false
[j2me_rmf] => false
[j2me_au] => false
[j2me_aac] => false
[j2me_realaudio] => false
[j2me_xmf] => false
[j2me_wma] => false
[j2me_3gpp] => false
[j2me_h263] => false
[j2me_svgt] => false
[j2me_mpeg4] => false
[j2me_realvideo] => false
[j2me_real8] => false
[j2me_realmedia] => false
[j2me_left_softkey_code] => -6
[j2me_right_softkey_code] => -7
[j2me_middle_softkey_code] => 0
[j2me_select_key_code] => -5
[j2me_return_key_code] => -11
[j2me_clear_key_code] => -8
[j2me_datefield_no_accepts_null_date] => false
[j2me_datefield_broken] => false
[receiver] => true
[sender] => true
[mms_max_size] => 100100
[mms_max_height] => 120
[mms_max_width] => 160
[built_in_recorder] => false
[built_in_camera] => false
[mms_jpeg_baseline] => true
[mms_jpeg_progressive] => false
[mms_gif_static] => true
[mms_gif_animated] => false
[mms_png] => false
[mms_bmp] => false
[mms_wbmp] => true
[mms_amr] => true
[mms_wav] => false
[mms_midi_monophonic] => false
[mms_midi_polyphonic] => false
[mms_midi_polyphonic_voices] => 32
[mms_spmidi] => false
[mms_mmf] => false
[mms_mp3] => false
[mms_evrc] => false
[mms_qcelp] => false
[mms_ota_bitmap] => false
[mms_nokia_wallpaper] => false
[mms_nokia_operatorlogo] => false
[mms_nokia_3dscreensaver] => false
[mms_nokia_ringingtone] => false
[mms_rmf] => false
[mms_xmf] => false
[mms_symbian_install] => false
[mms_jar] => false
[mms_jad] => false
[mms_vcard] => true
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => false
[mms_mp4] => false
[mms_3gpp] => false
[mms_3gpp2] => false
[mms_max_frame_rate] => 0
[nokiaring] => false
[picturemessage] => false
[operatorlogo] => false
[largeoperatorlogo] => false
[callericon] => false
[nokiavcard] => false
[nokiavcal] => false
[sckl_ringtone] => false
[sckl_operatorlogo] => false
[sckl_groupgraphic] => false
[sckl_vcard] => false
[sckl_vcalendar] => false
[text_imelody] => false
[ems] => true
[ems_variablesizedpictures] => false
[ems_imelody] => false
[ems_odi] => false
[ems_upi] => false
[ems_version] => 0
[siemens_ota] => false
[siemens_logo_width] => 101
[siemens_logo_height] => 29
[siemens_screensaver_width] => 101
[siemens_screensaver_height] => 50
[gprtf] => false
[sagem_v1] => false
[sagem_v2] => false
[panasonic] => false
[sms_enabled] => true
[wav] => false
[mmf] => false
[smf] => false
[mld] => false
[midi_monophonic] => false
[midi_polyphonic] => false
[sp_midi] => false
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => true
[au] => false
[amr] => false
[awb] => false
[aac] => false
[mp3] => false
[voices] => 32
[qcelp] => false
[evrc] => false
[flash_lite_version] =>
[fl_wallpaper] => false
[fl_screensaver] => false
[fl_standalone] => false
[fl_browser] => false
[fl_sub_lcd] => false
[full_flash_support] => false
[css_supports_width_as_percentage] => true
[css_border_image] => none
[css_rounded_corners] => none
[css_gradient] => none
[css_spriting] => false
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => false
[progressive_download] => false
[playback_vcodec_h263_0] => -1
[playback_vcodec_h263_3] => -1
[playback_vcodec_mpeg4_sp] => -1
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => -1
[playback_real_media] => none
[playback_3gpp] => false
[playback_3g2] => false
[playback_mp4] => false
[playback_mov] => false
[playback_acodec_amr] => none
[playback_acodec_aac] => none
[playback_df_size_limit] => 0
[playback_directdownload_size_limit] => 0
[playback_inline_size_limit] => 0
[playback_oma_size_limit] => 0
[playback_acodec_qcelp] => false
[playback_wmv] => none
[hinted_progressive_download] => false
[html_preferred_dtd] => xhtml_mp1
[viewport_supported] => false
[viewport_width] =>
[viewport_userscalable] =>
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => none
[image_inlining] => false
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => false
[jqm_grade] => none
[is_sencha_touch_ok] => false
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr><tr><td>Zsxsoft<br /><small>1.3</small><br /></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">SonyEricsson</td><td>290i</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-5d43e024-b46c-44f6-8914-529b05569bc2">Detail</a>
<!-- Modal Structure -->
<div id="modal-5d43e024-b46c-44f6-8914-529b05569bc2" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Zsxsoft result detail</h4>
<p><pre><code class="php">Array
(
[browser] => Array
(
[link] => #
[title] => Unknown
[name] => Unknown
[version] =>
[code] => null
[image] => img/16/browser/null.png
)
[os] => Array
(
[link] =>
[name] =>
[version] =>
[code] => null
[x64] =>
[title] =>
[type] => os
[dir] => os
[image] => img/16/os/null.png
)
[device] => Array
(
[link] => http://en.wikipedia.org/wiki/SonyEricsson
[title] => SonyEricsson 290i
[model] => 290i
[brand] => SonyEricsson
[code] => sonyericsson
[dir] => device
[type] => device
[image] => img/16/device/sonyericsson.png
)
[platform] => Array
(
[link] => http://en.wikipedia.org/wiki/SonyEricsson
[title] => SonyEricsson 290i
[model] => 290i
[brand] => SonyEricsson
[code] => sonyericsson
[dir] => device
[type] => device
[image] => img/16/device/sonyericsson.png
)
)
</code></pre></p>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a>
</div>
</div>
</td></tr></table>
</div>
<div class="section">
<h1 class="header center orange-text">About this comparison</h1>
<div class="row center">
<h5 class="header light">
The primary goal of this project is simple<br />
I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br />
<br />
The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br />
<br />
You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br />
<br />
The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a>
</h5>
</div>
</div>
<div class="card">
<div class="card-content">
Comparison created <i>2016-05-10 08:09:45</i> | by
<a href="https://github.com/ThaDafinser">ThaDafinser</a>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script>
<script>
$(document).ready(function(){
// the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
$('.modal-trigger').leanModal();
});
</script>
</body>
</html> | {
"content_hash": "1c912f2525a68dd00f6451604c959e9a",
"timestamp": "",
"source": "github",
"line_count": 1041,
"max_line_length": 964,
"avg_line_length": 40.603266090297794,
"alnum_prop": 0.5214346550582001,
"repo_name": "ThaDafinser/UserAgentParserComparison",
"id": "689e51c540550869ffbfb250ec4101abc336fac7",
"size": "42269",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "v5/user-agent-detail/e2/f9/e2f95609-f4ab-476b-ae9f-d2c8935b6746.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2060859160"
}
],
"symlink_target": ""
} |
# ----------------------------------------
# SRCH_02: GENERATE STATISTICS ABOUT SITE TRAFFIC
# ----------------------------------------
param([string]$LogFolderPath)
$UserStory = "SRCH_02"
$0 = $myInvocation.MyCommand.Definition
$CommandDirectory = [System.IO.Path]::GetDirectoryName($0)
$values = @{"User Story: " = $UserStory}
New-HeaderDrawing -Values $Values
# =============================== #
# ========= PROPERTY BAGS ========== #
# =============================== #
$values = @{"Step: " = "#1 Setup Property Bags"}
New-HeaderDrawing -Values $Values
$Script = $CommandDirectory + '\Setup-PropertyBag.ps1'
& $Script
# =============================== #
# ========= FEATURES ========== #
# =============================== #
$values = @{"Step: " = "#2 Enable the feature"}
New-HeaderDrawing -Values $Values
$Script = $CommandDirectory + '\Setup-Control.ps1'
& $Script | {
"content_hash": "eabdc7a11795671e792d9db8cfff07a8",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 58,
"avg_line_length": 26.96969696969697,
"alnum_prop": 0.4820224719101124,
"repo_name": "GSoft-SharePoint/Dynamite-Components",
"id": "ac522af817e81615f956fedcd7d6a6ee33c21375",
"size": "892",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "Libraries/GSoft.Dynamite.StandardPublishingCMS.2.2.2-pre10639/tools/Modules/Search/SRCH_02/Install-SRCH02.ps1",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "72275"
},
{
"name": "C#",
"bytes": "814274"
},
{
"name": "CSS",
"bytes": "8967"
},
{
"name": "Cucumber",
"bytes": "59480"
},
{
"name": "HTML",
"bytes": "77894"
},
{
"name": "JavaScript",
"bytes": "23958"
},
{
"name": "PowerShell",
"bytes": "1282356"
}
],
"symlink_target": ""
} |
package com.javarush.task.task11.task1115;
/*
От школьника до квалифицированного раба
*/
public class Solution {
public static void main(String[] args) {
}
public class Schoolboy {
}
public class Student extends Schoolboy {
}
public class Worker extends Student {
}
public class Slave extends Worker {
}
}
| {
"content_hash": "64b6663284fc0f72d75fbf60d2a9b457",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 44,
"avg_line_length": 13.25925925925926,
"alnum_prop": 0.6536312849162011,
"repo_name": "Sukora-Stas/JavaRushTasks",
"id": "0da69a662140b54f06b3324b51936a3604837a38",
"size": "393",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "2.JavaCore/src/com/javarush/task/task11/task1115/Solution.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "317223"
},
{
"name": "Java",
"bytes": "1322306"
}
],
"symlink_target": ""
} |
package default_constructors;
public class Functions {
static default_constructors_md.Root root = new default_constructors_md.Root();
public static final void main(String[] args) {
main(new java.util.ArrayList(java.util.Arrays.asList(args)));
}
public static void main(java.util.ArrayList<String> args) {
B b = new B("Bob");
(b).greet();
C c = new C("arole");
(c).greet();
Y y = new Y("asdf");
(y).test();
}
}
| {
"content_hash": "0159263dec23e9f059ea63ff5dbe6723",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 82,
"avg_line_length": 24.55,
"alnum_prop": 0.5824847250509165,
"repo_name": "bozzzzo/quark",
"id": "1206a191f124994f3a8b7ab042ccff6395b5bd91",
"size": "491",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "quarkc/test/emit/expected/java/default-constructors/src/main/java/default_constructors/Functions.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "496221"
},
{
"name": "JavaScript",
"bytes": "466971"
},
{
"name": "Python",
"bytes": "590150"
},
{
"name": "Shell",
"bytes": "1328"
}
],
"symlink_target": ""
} |
#ifndef SVGFEConvolveMatrixElement_h
#define SVGFEConvolveMatrixElement_h
#include "core/svg/SVGAnimatedBoolean.h"
#include "core/svg/SVGAnimatedEnumeration.h"
#include "core/svg/SVGAnimatedInteger.h"
#include "core/svg/SVGAnimatedIntegerOptionalInteger.h"
#include "core/svg/SVGAnimatedNumber.h"
#include "core/svg/SVGAnimatedNumberList.h"
#include "core/svg/SVGAnimatedNumberOptionalNumber.h"
#include "core/svg/SVGFilterPrimitiveStandardAttributes.h"
#include "platform/graphics/filters/FEConvolveMatrix.h"
#include "platform/heap/Handle.h"
namespace blink {
template<> const SVGEnumerationStringEntries& getStaticStringEntries<EdgeModeType>();
class SVGFEConvolveMatrixElement final : public SVGFilterPrimitiveStandardAttributes {
DEFINE_WRAPPERTYPEINFO();
public:
DECLARE_NODE_FACTORY(SVGFEConvolveMatrixElement);
SVGAnimatedBoolean* preserveAlpha() { return m_preserveAlpha.get(); }
SVGAnimatedNumber* divisor() { return m_divisor.get(); }
SVGAnimatedNumber* bias() { return m_bias.get(); }
SVGAnimatedNumber* kernelUnitLengthX() { return m_kernelUnitLength->firstNumber(); }
SVGAnimatedNumber* kernelUnitLengthY() { return m_kernelUnitLength->secondNumber(); }
SVGAnimatedNumberList* kernelMatrix() { return m_kernelMatrix.get(); }
SVGAnimatedString* in1() { return m_in1.get(); }
SVGAnimatedEnumeration<EdgeModeType>* edgeMode() { return m_edgeMode.get(); }
SVGAnimatedInteger* orderX() { return m_order->firstInteger(); }
SVGAnimatedInteger* orderY() { return m_order->secondInteger(); }
SVGAnimatedInteger* targetX() { return m_targetX.get(); }
SVGAnimatedInteger* targetY() { return m_targetY.get(); }
DECLARE_VIRTUAL_TRACE();
private:
explicit SVGFEConvolveMatrixElement(Document&);
virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&) override;
virtual void svgAttributeChanged(const QualifiedName&) override;
virtual PassRefPtrWillBeRawPtr<FilterEffect> build(SVGFilterBuilder*, Filter*) override;
RefPtrWillBeMember<SVGAnimatedNumber> m_bias;
RefPtrWillBeMember<SVGAnimatedNumber> m_divisor;
RefPtrWillBeMember<SVGAnimatedString> m_in1;
RefPtrWillBeMember<SVGAnimatedEnumeration<EdgeModeType>> m_edgeMode;
RefPtrWillBeMember<SVGAnimatedNumberList> m_kernelMatrix;
RefPtrWillBeMember<SVGAnimatedNumberOptionalNumber> m_kernelUnitLength;
RefPtrWillBeMember<SVGAnimatedIntegerOptionalInteger> m_order;
RefPtrWillBeMember<SVGAnimatedBoolean> m_preserveAlpha;
RefPtrWillBeMember<SVGAnimatedInteger> m_targetX;
RefPtrWillBeMember<SVGAnimatedInteger> m_targetY;
};
} // namespace blink
#endif // SVGFEConvolveMatrixElement_h
| {
"content_hash": "0b0cb39e6379d12c3894f2325626fcb3",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 92,
"avg_line_length": 43.29032258064516,
"alnum_prop": 0.783532041728763,
"repo_name": "PeterWangIntel/blink-crosswalk",
"id": "3becdcff86d4ae9ae1ac39aaf56f1df19123a6e3",
"size": "3518",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "Source/core/svg/SVGFEConvolveMatrixElement.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "1835"
},
{
"name": "Assembly",
"bytes": "14768"
},
{
"name": "Batchfile",
"bytes": "35"
},
{
"name": "C",
"bytes": "124680"
},
{
"name": "C++",
"bytes": "44958218"
},
{
"name": "CSS",
"bytes": "570706"
},
{
"name": "CoffeeScript",
"bytes": "163"
},
{
"name": "GLSL",
"bytes": "11578"
},
{
"name": "Groff",
"bytes": "28067"
},
{
"name": "HTML",
"bytes": "58724841"
},
{
"name": "Java",
"bytes": "109391"
},
{
"name": "JavaScript",
"bytes": "24396968"
},
{
"name": "Objective-C",
"bytes": "48694"
},
{
"name": "Objective-C++",
"bytes": "293932"
},
{
"name": "PHP",
"bytes": "194683"
},
{
"name": "Perl",
"bytes": "585293"
},
{
"name": "Python",
"bytes": "3819714"
},
{
"name": "Ruby",
"bytes": "141818"
},
{
"name": "Shell",
"bytes": "10037"
},
{
"name": "XSLT",
"bytes": "49926"
},
{
"name": "Yacc",
"bytes": "61184"
}
],
"symlink_target": ""
} |
package org.camunda.bpm.model.bpmn.impl.instance;
import org.camunda.bpm.model.bpmn.RelationshipDirection;
import org.camunda.bpm.model.bpmn.instance.BaseElement;
import org.camunda.bpm.model.bpmn.instance.Relationship;
import org.camunda.bpm.model.xml.ModelBuilder;
import org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext;
import org.camunda.bpm.model.xml.type.ModelElementTypeBuilder;
import org.camunda.bpm.model.xml.type.attribute.Attribute;
import org.camunda.bpm.model.xml.type.child.ChildElementCollection;
import org.camunda.bpm.model.xml.type.child.SequenceBuilder;
import java.util.Collection;
import static org.camunda.bpm.model.bpmn.impl.BpmnModelConstants.*;
import static org.camunda.bpm.model.xml.type.ModelElementTypeBuilder.ModelTypeInstanceProvider;
/**
* The BPMN relationship element
*
* @author Sebastian Menski
*/
public class RelationshipImpl extends BaseElementImpl implements Relationship {
protected static Attribute<String> typeAttribute;
protected static Attribute<RelationshipDirection> directionAttribute;
protected static ChildElementCollection<Source> sourceCollection;
protected static ChildElementCollection<Target> targetCollection;
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Relationship.class, BPMN_ELEMENT_RELATIONSHIP)
.namespaceUri(BPMN20_NS)
.extendsType(BaseElement.class)
.instanceProvider(new ModelTypeInstanceProvider<Relationship>() {
public Relationship newInstance(ModelTypeInstanceContext instanceContext) {
return new RelationshipImpl(instanceContext);
}
});
typeAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TYPE)
.required()
.build();
directionAttribute = typeBuilder.enumAttribute(BPMN_ATTRIBUTE_DIRECTION, RelationshipDirection.class)
.build();
SequenceBuilder sequenceBuilder = typeBuilder.sequence();
sourceCollection = sequenceBuilder.elementCollection(Source.class)
.minOccurs(1)
.build();
targetCollection = sequenceBuilder.elementCollection(Target.class)
.minOccurs(1)
.build();
typeBuilder.build();
}
public RelationshipImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getType() {
return typeAttribute.getValue(this);
}
public void setType(String type) {
typeAttribute.setValue(this, type);
}
public RelationshipDirection getDirection() {
return directionAttribute.getValue(this);
}
public void setDirection(RelationshipDirection direction) {
directionAttribute.setValue(this, direction);
}
public Collection<Source> getSources() {
return sourceCollection.get(this);
}
public Collection<Target> getTargets() {
return targetCollection.get(this);
}
}
| {
"content_hash": "007dd71f36c25a85041d4c73ec4b78f3",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 112,
"avg_line_length": 32.57954545454545,
"alnum_prop": 0.7732821764911056,
"repo_name": "camunda/camunda-bpm-platform",
"id": "96ff4ab024bf3875798004547c414ed36f44a4ff",
"size": "3674",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "model-api/bpmn-model/src/main/java/org/camunda/bpm/model/bpmn/impl/instance/RelationshipImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "8608"
},
{
"name": "CSS",
"bytes": "5486"
},
{
"name": "Fluent",
"bytes": "3111"
},
{
"name": "FreeMarker",
"bytes": "1443842"
},
{
"name": "Groovy",
"bytes": "1904"
},
{
"name": "HTML",
"bytes": "961289"
},
{
"name": "Handlebars",
"bytes": "759"
},
{
"name": "Java",
"bytes": "44079665"
},
{
"name": "JavaScript",
"bytes": "3064086"
},
{
"name": "Less",
"bytes": "154956"
},
{
"name": "Python",
"bytes": "192"
},
{
"name": "Ruby",
"bytes": "60"
},
{
"name": "SQLPL",
"bytes": "44180"
},
{
"name": "Shell",
"bytes": "11634"
}
],
"symlink_target": ""
} |
package net.folab.oxpath;
public class OxAttrribute extends OxExpression {
private final OxExpression prefix;
private final String attrName;
public OxAttrribute(String attrName) {
prefix = null;
this.attrName = attrName;
}
public OxAttrribute(OxExpression prefix, String attrName) {
this.prefix = prefix;
this.attrName = attrName;
}
@Override
public String expr() {
if (prefix != null)
if (prefix instanceof OxElement)
return pack(prefix.expr() + "/@" + attrName);
else
return pack(prefix.expr() + "@" + attrName);
else
return pack("@" + attrName);
}
}
| {
"content_hash": "c2a4348061faf54b01820e92791a12a1",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 63,
"avg_line_length": 23.733333333333334,
"alnum_prop": 0.5786516853932584,
"repo_name": "leafriend/oxpath",
"id": "588f3384e20e7c9ef133f148cf91f1125b80fac3",
"size": "712",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/folab/oxpath/OxAttrribute.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "6702"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
Cornus macrophylla Wall.
### Remarks
null | {
"content_hash": "d744d26f3864c780342b7a8dcb6439b2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 11.23076923076923,
"alnum_prop": 0.726027397260274,
"repo_name": "mdoering/backbone",
"id": "ef6f11b7c17474e0a06903b8329d8c07387ed6a7",
"size": "204",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Cornales/Cornaceae/Swida/Swida macrophylla/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#pragma once
#include "UIElement.h"
namespace Lupus {
namespace Windows {
// TODO: Implement Grid.
class LUPUSWINDOWS_API Grid : public UIElement
{
public:
virtual ~Grid() = default;
};
}
}
| {
"content_hash": "4fff9d6e81adc18b458a1f7e8cf82a8c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 15.875,
"alnum_prop": 0.5393700787401575,
"repo_name": "chronos38/lupus-core",
"id": "2b38beae194e71cde63ff50e122f4c12cec6ee5d",
"size": "1417",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/BlackWolf.Lupus.Windows/Grid.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "8107095"
},
{
"name": "C#",
"bytes": "7202"
},
{
"name": "C++",
"bytes": "101525928"
},
{
"name": "Objective-C",
"bytes": "26536"
},
{
"name": "Perl",
"bytes": "6080"
},
{
"name": "Shell",
"bytes": "2289"
}
],
"symlink_target": ""
} |
// Provides the OData model implementation of a tree binding
sap.ui.define(['jquery.sap.global', 'sap/ui/model/TreeBinding', 'sap/ui/model/odata/CountMode', 'sap/ui/model/ChangeReason', 'sap/ui/model/odata/ODataUtils'],
function(jQuery, TreeBinding, CountMode, ChangeReason, ODataUtils) {
"use strict";
/**
*
* @class
* Tree binding implementation for odata models. The ODataTreeBinding does only support CountMode.Inline.
* This CountMode is set as default. To use the ODataTreeBinding with an odata service, which exposed hierarchy annotations, please
* consult the "SAP Annotations for OData Version 2.0" Specification. The necessary property annotations, as well as accepted/defaukt values
* are documented in the specification.
*
* @param {sap.ui.model.Model} oModel
* @param {string} sPath
* @param {sap.ui.model.Context} oContext
* @param {sap.ui.model.Filter[]} [aFilters] predefined filter/s (can be either a filter or an array of filters)
* @param {object} [mParameters] Parameter Object
*
* @param {object} [mParameters.treeAnnotationProperties] This parameter defines the mapping between data properties and
* the hierarchy used to visualize the tree, if not provided by the services metadata.
* For correct metadata annotation, please check the "SAP Annotations for OData Version 2.0" Specification.
* @param {int} [mParameters.treeAnnotationProperties.hierarchyLevelFor] Mapping to the property holding the level information,
* @param {string} [mParameters.treeAnnotationProperties.hierarchyNodeFor] Mapping to the property holding the hierarchy node id,
* @param {string} [mParameters.treeAnnotationProperties.hierarchyParentNodeFor] Mapping to the property holding the parent node id,
* @param {string} [mParameters.treeAnnotationProperties.hierarchyDrillStateFor] Mapping to the property holding the drill state for the node,
*
* @param {int} [mParameters.numberOfExpandedLevels=0] This property defines the number of levels, which will be expanded initially.
* Please be aware, that this property leads to multiple backend requests. Default value is 0.
* @param {int} [mParameters.rootLevel=0] The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services.
* Conforming to the "SAP Annotations for OData Version 2.0" Specification, the root level must start at 0.
* Default value is thus 0.
* @param {sap.ui.model.Sorter[]} [aSorters] predefined sorter/s (can be either a sorter or an array of sorters)
* @alias sap.ui.model.odata.v2.ODataTreeBinding
* @extends sap.ui.model.TreeBinding
*/
var ODataTreeBinding = TreeBinding.extend("sap.ui.model.odata.v2.ODataTreeBinding", /** @lends sap.ui.model.odata.v2.ODataTreeBinding.prototype */ {
constructor : function(oModel, sPath, oContext, aFilters, mParameters, aSorters){
TreeBinding.apply(this, arguments);
//make sure we have at least an empty parameter object
this.mParameters = this.mParameters || mParameters || {};
this.oFinalLengths = {};
this.oLengths = {};
this.oKeys = {};
this.bNeedsUpdate = false;
this._bRootMissing = false;
this.sFilterParams = "";
// a queue containing all parallel running requests
// a request is identified by (node id, startindex, length)
this.mRequestHandles = {};
this.oRootContext = null;
this.iNumberOfExpandedLevels = (mParameters && mParameters.numberOfExpandedLevels) || 0;
this.iRootLevel = (mParameters && mParameters.rootLevel) || 0;
if (mParameters && mParameters.countMode && mParameters.countMode !== CountMode.Inline) {
jQuery.log.fatal("ODataTreeBinding only supports CountMode.Inline!");
} else {
this.sCountMode = CountMode.Inline;
}
//this.sCountMode = (mParameters && mParameters.countMode) || this.oModel.sDefaultCountMode;
this.bInitial = true;
this._mLoadedSections = {};
this._iPageSize = 0;
}
});
/**
* Drill-States for Hierarchy-Nodes
*
* From the spec:
* A property holding the drill state of a hierarchy node includes this attribute.
* The drill state is indicated by one of the following values: collapsed, expanded, leaf.
* The value of this attribute is always the name of another property in the same type.
* It points to the related property holding the hierarchy node ID.
*/
ODataTreeBinding.DRILLSTATES = {
Collapsed: "collapsed",
Expanded: "expanded",
Leaf: "leaf"
};
/**
* Validates the binding parameters against eachother.
* If no root node ID is given, the root level must be set!
* @private
*/
ODataTreeBinding.prototype._validateParameters = function () {
var sRootNodeID = this.mParameters.rootNodeID;
var iRootLevel = this.mParameters.rootLevel;
//var iNumberOfExpandedLevels = this.mParameters.numberOfExpandedLevels;
//case 1: root node id is given -> life's good
if (sRootNodeID) {
return true;
}
//case 2: NO root node id is given -> we need a root level
if (!sRootNodeID) {
jQuery.sap.assert(iRootLevel >= 0, "ODataTreeBinding: If no root node ID is given, a root entry level is mandatory, e.g. 0!");
// ... and the displayRootNode flag must be set, because initially we need to filter on the level
this.bDisplayRootNode = true;
//jQuery.sap.assert(bDisplayRootNode, "ODataTreeBinding: When providing a root node level, the parameter 'displayRootNode' must be set to 'true'!");
}
};
/**
* Tries to load the entity with the HierarchyNode ID of sRootNodeID.
* In case the backend returns nothing, the this._bRootMissing flag is set.
*
* @param {string} sRootNodeID the property value of the annotated HierarchyNode property, on which a $filter is performed
* @param {string} sRequestKey a key for the request, used to keep track of pending requests
* @private
*/
ODataTreeBinding.prototype._loadSingleRootByHierarchyNodeID = function (sRootNodeID, sRequestKey) {
var that = this;
var _handleSuccess = function (oData) {
if (oData.results && oData.results.length > 0) {
// we expect only one root node
var oEntry = oData.results[0];
var sKey = that.oModel._getKey(oEntry);
that.oRootContext = that.oModel.getContext('/' + sKey);
} else {
//we received an empty response, this means the root is not there and should not be requested again
that._bRootMissing = true;
}
that.bNeedsUpdate = true;
delete that.mRequestHandles[sRequestKey];
that.fireDataReceived();
};
var _handleError = function (oError) {
//check if the error handler was executed because of an intentionally aborted request:
if (oError && oError.statusCode != 0 && oError.statusText != "abort") {
var sErrorMsg = "Request for root node failed: " + oError.message;
if (oError.response){
sErrorMsg += ", " + oError.response.statusCode + ", " + oError.response.statusText + ", " + oError.response.body;
}
jQuery.sap.log.fatal(sErrorMsg);
that.bNeedsUpdate = true;
that._bRootMissing = true;
delete that.mRequestHandles[sRequestKey];
that.fireDataReceived();
}
};
var aParams = [];
var sFilterParams = this.getFilterParams() ? "%20and%20" + this.getFilterParams() : "";
aParams.push("$filter=" + jQuery.sap.encodeURL(this.oTreeProperties["hierarchy-node-for"] + " eq '" + sRootNodeID + "'") + sFilterParams);
// make sure to abort previous requests, with the same paging parameters
// this is necessary to make sure, that only the most recent request gets processed
// e.g. the (Tree)Table performs multiple calls to the binding (see BindingTimer in Table.js)
if (this.mRequestHandles[sRequestKey]) {
this.mRequestHandles[sRequestKey].abort();
}
this.fireDataRequested();
this.mRequestHandles[sRequestKey] = this.oModel.read(this.getPath(), {
urlParameters: aParams,
success: _handleSuccess,
error: _handleError,
sorters: this.aSorters
});
};
/**
* Retrieves the root node given through sNodeId
* @param {string} sNodeId the ID od the root node which should be loaded (e.g. when bound to a single entity)
* @param {string} sRequestKey a key string used to store/clean-up request handles
*/
ODataTreeBinding.prototype._loadSingleRootNodeByNavigationProperties = function (sNodeId, sRequestKey) {
var that = this;
if (this.mRequestHandles[sRequestKey]) {
this.mRequestHandles[sRequestKey].abort();
}
this.mRequestHandles[sRequestKey] = this.oModel.read(sNodeId, {
success: function (oData) {
var sNavPath = that._getNavPath(that.getPath());
if (oData) {
// we expect only one root node
var oEntry = oData;
var sKey = that.oModel._getKey(oEntry);
var oNewContext = that.oModel.getContext('/' + sKey);
that.oRootContext = oNewContext;
that._processODataObject(oNewContext.getObject(), sNodeId, sNavPath);
} else {
that._bRootMissing = true;
}
that.bNeedsUpdate = true;
delete that.mRequestHandles[sRequestKey];
that.fireDataReceived();
},
error: function (oError) {
//Only perform error handling if the request was not aborted intentionally
if (oError && oError.statusCode != 0 && oError.statusText != "abort") {
that.bNeedsUpdate = true;
that._bRootMissing = true;
delete that.mRequestHandles[sRequestKey];
that.fireDataReceived();
}
}
});
};
/**
* Returns root contexts for the tree. You can specify the start index and the length for paging requests
* @param {integer} [iStartIndex=0] the start index of the requested contexts
* @param {integer} [iLength=v2.ODataModel.sizeLimit] the requested amount of contexts. If none given, the default value is the size limit of the underlying
* sap.ui.model.odata.v2.ODataModel instance.
* @param {integer} [iThreshold=0] the number of entities which should be retrieved in addition to the given length.
* A higher threshold reduces the number of backend requests, yet these request blow up in size, since more data is loaded.
* @return {sap.ui.model.Context[]} an array containing the contexts for the entities returned by the backend, might be fewer than requested
* if the backend does not have enough data.
* @protected
*/
ODataTreeBinding.prototype.getRootContexts = function(iStartIndex, iLength, iThreshold) {
var sNodeId = null,
mRequestParameters = {
numberOfExpandedLevels: this.iNumberOfExpandedLevels
},
aRootContexts = [],
sRootNodeID = this.mParameters.rootNodeID || null;
if (this.isInitial()) {
return aRootContexts;
}
// make sure the input parameters are not undefined
iStartIndex = iStartIndex || 0;
iLength = iLength || this.oModel.sizeLimit;
iThreshold = iThreshold || 0;
// node ID for the root context(s) ~> null
// startindex/length may differ due to paging
// same node id + different paging sections are treated as different requests and will not abort each other
var sRequestKey = "" + sNodeId + "-" + iStartIndex + "-" + this._iPageSize + "-" + iThreshold;
if (this.bHasTreeAnnotations) {
this._validateParameters();
// load single root node via rootNodeID (if given)
if (this.bDisplayRootNode && sRootNodeID) {
// if we already have a root context, return it
if (this.oRootContext) {
return [this.oRootContext];
} else if (this._bRootMissing) {
// the backend may not return anything for the given rootNodeID, so in this case our root node is missing
return [];
} else {
//trigger loading of the single root node
this._loadSingleRootByHierarchyNodeID(sRootNodeID, sRequestKey);
}
} else {
// load root level, rootNodeID is "null" in this case
aRootContexts = this._getContextsForNodeId(sRootNodeID, iStartIndex, iLength, iThreshold);
}
} else {
sNodeId = this.oModel.resolve(this.getPath(), this.getContext());
var bIsList = this.oModel.isList(this.sPath, this.getContext());
if (bIsList) {
this.bDisplayRootNode = true;
}
if (this.bDisplayRootNode && !bIsList) {
if (this.oRootContext) {
return [this.oRootContext];
} else if (this._bRootMissing) {
// the backend may not return anything for the given rootNodeID, so in this case our root node is missing
return [];
} else {
this._loadSingleRootNodeByNavigationProperties(sNodeId, sRequestKey);
}
} else {
mRequestParameters.navPath = this._getNavPath(this.getPath());
//append nav path if binding path is not a collection and the root node should not be displayed
if (!this.bDisplayRootNode) {
sNodeId += "/" + mRequestParameters.navPath;
}
aRootContexts = this._getContextsForNodeId(sNodeId, iStartIndex, iLength, iThreshold, mRequestParameters);
}
}
return aRootContexts;
};
/**
* Returns the contexts of the child nodes for the given context.
*
* @param {sap.ui.model.Context} oContext the context for which the child nodes should be retrieved
* @param {integer} iStartIndex the start index of the requested contexts
* @param {integer} iLength the requested amount of contexts
* @param {integer} iThreshold
* @return {sap.ui.model.Context[]} the contexts array
* @protected
*/
ODataTreeBinding.prototype.getNodeContexts = function(oContext, iStartIndex, iLength, iThreshold) {
var sNodeId,
mRequestParameters = {};
if (this.isInitial()) {
return [];
}
if (this.bHasTreeAnnotations) {
sNodeId = oContext.getProperty(this.oTreeProperties["hierarchy-node-for"]);
mRequestParameters.level = parseInt(oContext.getProperty(this.oTreeProperties["hierarchy-level-for"]), 10) + 1;
} else {
var sNavPath = this._getNavPath(oContext.getPath());
//If no nav path was found no nav property is defined and we cannot find any more data
if (!sNavPath) {
return [];
}
sNodeId = this.oModel.resolve(sNavPath, oContext);
mRequestParameters.navPath = this.oNavigationPaths[sNavPath];
}
return this._getContextsForNodeId(sNodeId, iStartIndex, iLength, iThreshold, mRequestParameters);
};
/**
* Returns if the node has child nodes.
* If the ODataTreeBinding is running with hierarchy annotations, a context with the property values "expanded" or "collapsed"
* for the drilldown state property, returns true. Entities with drilldown state "leaf" return false.
*
* @param {sap.ui.model.Context} oContext the context element of the node
* @return {boolean} true if node has children
*
* @public
*/
ODataTreeBinding.prototype.hasChildren = function(oContext) {
if (this.bHasTreeAnnotations) {
if (!oContext) {
return false;
}
var sDrilldownState = oContext.getProperty(this.oTreeProperties["hierarchy-drill-state-for"]);
var sHierarchyNode = oContext.getProperty(this.oTreeProperties["hierarchy-node-for"]);
var iLength = this.oLengths[sHierarchyNode];
// if the server returned no children for a node (even though it has a DrilldownState of "expanded"),
// the length for this node is set to 0 and finalized -> no children available
if (iLength === 0 && this.oFinalLengths[sHierarchyNode]) {
return false;
}
// leaves do not have childre, only "expanded" and "collapsed" nodes
// Beware: the drilldownstate may be undefined/empty string,
// in case the entity (oContext) has no value for the drilldown state property
if (sDrilldownState === "expanded" || sDrilldownState === "collapsed") {
return true;
} else if (sDrilldownState === "leaf"){
return false;
} else {
jQuery.sap.log.warning("The entity '" + oContext.getPath() + "' has not specified Drilldown State property value.");
//fault tolerance for empty property values (we optimistically say that those nodes can be expanded/collapsed)
if (sDrilldownState === undefined || sDrilldownState === "") {
return true;
}
return false;
}
} else {
if (!oContext) {
return this.oLengths[this.getPath()] > 0;
}
var iLength = this.oLengths[oContext.getPath() + "/" + this._getNavPath(oContext.getPath())];
//only return false if we definitely know that the length is 0, otherwise, we have either a known length or none at all (undefined)
return iLength !== 0;
}
};
/**
* Returns the number of child nodes
*
* @param {Object} oContext the context element of the node
* @return {integer} the number of children
*
* @public
*/
ODataTreeBinding.prototype.getChildCount = function(oContext) {
if (this.bHasTreeAnnotations) {
var vHierarchyNode;
// only the root node should have no context
// the child count is either stored via the rootNodeId or (if only the rootLevel is given) as "null", because we do not know the root id
if (!oContext) {
vHierarchyNode = this.mParameters.rootNodeID || null;
} else {
vHierarchyNode = oContext.getProperty(this.oTreeProperties["hierarchy-node-for"]);
}
return this.oLengths[vHierarchyNode];
} else {
if (!oContext) {
// if no context was given, we retrieve the top-level child count:
// 1. in case the binding path is a collection we need use the binding path as a key in the length map
// 2. in case the binding path is a single entity, we need to add the navigation property from the "$expand" query option
if (!this.bDisplayRootNode) {
return this.oLengths[this.getPath() + "/" + this._getNavPath(this.getPath())];
} else {
return this.oLengths[this.getPath()];
}
}
return this.oLengths[oContext.getPath() + "/" + this._getNavPath(oContext.getPath())];
}
};
/**
* Merges together oNewSection into a set of other sections (aSections)
* The array/objects are not modified, the function returns a new section array.
* @param {object[]} aSections the sections into which oNewSection will be merged
* @param {objec} oNewSection the section which should be merged into aNewSections
* @return {object[]} a new array containing all sections from aSections merged with oNewSection
* @private
*/
ODataTreeBinding.prototype._mergeSections = function (aSections, oNewSection) {
// Iterate over all known/loaded sections of the node
var aNewSections = [];
for (var i = 0; i < aSections.length; i++) {
var oCurrentSection = aSections[i];
var iCurrentSectionEndIndex = oCurrentSection.startIndex + oCurrentSection.length;
var iNewSectionEndIndex = oNewSection.startIndex + oNewSection.length;
if (oNewSection.startIndex <= iCurrentSectionEndIndex && iNewSectionEndIndex >= iCurrentSectionEndIndex
&& oNewSection.startIndex >= oCurrentSection.startIndex) {
//new section expands to the left
oNewSection.startIndex = oCurrentSection.startIndex;
oNewSection.length = iNewSectionEndIndex - oCurrentSection.startIndex;
} else if (oNewSection.startIndex <= oCurrentSection.startIndex && iNewSectionEndIndex >= oCurrentSection.startIndex
&& iNewSectionEndIndex <= iCurrentSectionEndIndex) {
//new section expands to the right
oNewSection.length = iCurrentSectionEndIndex - oNewSection.startIndex;
} else if (oNewSection.startIndex >= oCurrentSection.startIndex && iNewSectionEndIndex <= iCurrentSectionEndIndex) {
//new section is contained in old one
oNewSection.startIndex = oCurrentSection.startIndex;
oNewSection.length = oCurrentSection.length;
} else if (iNewSectionEndIndex < oCurrentSection.startIndex || oNewSection.startIndex > iCurrentSectionEndIndex) {
//old and new sections do not overlap, either the new section is completely left or right from the old one
aNewSections.push(oCurrentSection);
}
}
aNewSections.push(oNewSection);
return aNewSections;
};
/**
* Gets or loads all contexts for a specified node id (dependent on mode)
*
* @param {String} sNodeId the value of the hierarchy node property on which a parent node filter will be performed
* @param {integer} iStartIndex start index of the page
* @param {integer} iLength length of the page
* @param {integer} iThreshold additionally loaded entities
* @param {object} mParameters additional request parameters
*
* @return {sap.ui.model.Context[]} Array of contexts
*
* @private
*/
ODataTreeBinding.prototype._getContextsForNodeId = function(sNodeId, iStartIndex, iLength, iThreshold, mRequestParameters) {
var aContexts = [],
sKey,
iRootLevel;
// Set default values if startindex, threshold or length are not defined
iStartIndex = iStartIndex || 0;
iLength = iLength || this.oModel.iSizeLimit;
iThreshold = iThreshold || 0;
if (!this._mLoadedSections[sNodeId]) {
this._mLoadedSections[sNodeId] = [];
}
if (this.bHasTreeAnnotations) {
//the ID of the root node must be defined via parameters in case we use an annotated service
if (sNodeId == null) {
iRootLevel = this.iRootLevel;
}
}
// make sure we only request the maximum length available (length is known and final)
if (this.oFinalLengths[sNodeId] && this.oLengths[sNodeId] < iStartIndex + iLength) {
iLength = Math.max(this.oLengths[sNodeId] - iStartIndex, 0);
}
var that = this;
// check whether a start index was already requested
var fnFindInLoadedSections = function(iStartIndex) {
// check in the sections which where loaded
for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) {
var oSection = that._mLoadedSections[sNodeId][i];
// try to find i in the loaded sections. If i is within one of the sections it needs not to be loaded again
if (iStartIndex >= oSection.startIndex && iStartIndex < oSection.startIndex + oSection.length) {
return true;
}
}
// check requested sections where we still wait for an answer
};
var aMissingSections = [];
// Loop through known data and check whether we already have all rows loaded
// make sure to also check that the entities before the requested start index can be served
var i = Math.max((iStartIndex - iThreshold - this._iPageSize), 0);
if (this.oKeys[sNodeId]) {
for (i; i < iStartIndex + iLength + (iThreshold); i++) {
sKey = this.oKeys[sNodeId][i];
if (!sKey) {
if (!fnFindInLoadedSections(i)) {
aMissingSections = this._mergeSections(aMissingSections, {startIndex: i, length: 1});
}
}
// collect requested contexts if loaded
if (i >= iStartIndex && i < iStartIndex + iLength) {
if (sKey) {
aContexts.push(this.oModel.getContext('/' + sKey));
} else {
aContexts.push(undefined);
}
}
}
// check whether the missing section already spans the complete page. If this is the case, we don't need to request an additional page
var iBegin = Math.max((iStartIndex - iThreshold - this._iPageSize), 0);
var iEnd = iStartIndex + iLength + (iThreshold);
var bExpandThreshold = aMissingSections[0] && aMissingSections[0].startIndex === iBegin && aMissingSections[0].startIndex + aMissingSections[0].length === iEnd;
if (aMissingSections.length > 0 && !bExpandThreshold) {
//first missing section will be prepended with additional threshold ("negative")
i = Math.max((aMissingSections[0].startIndex - iThreshold - this._iPageSize), 0);
var iFirstStartIndex = aMissingSections[0].startIndex;
for (i; i < iFirstStartIndex; i++) {
var sKey = this.oKeys[sNodeId][i];
if (!sKey) {
if (!fnFindInLoadedSections(i)) {
aMissingSections = this._mergeSections(aMissingSections, {startIndex: i, length: 1});
}
}
}
//last missing section will be appended with additional threshold ("positive")
i = aMissingSections[aMissingSections.length - 1].startIndex + aMissingSections[aMissingSections.length - 1].length;
var iEndIndex = i + iThreshold + this._iPageSize;
for (i; i < iEndIndex; i++) {
var sKey = this.oKeys[sNodeId][i];
if (!sKey) {
if (!fnFindInLoadedSections(i)) {
aMissingSections = this._mergeSections(aMissingSections, {startIndex: i, length: 1});
}
}
}
}
} else {
// for initial loading of a node use this shortcut.
if (!fnFindInLoadedSections(iStartIndex)) {
// "i" is our shifted forward startIndex for the "negative" thresholding
// in this case i is always smaller than iStartIndex, but minimum is 0
var iLengthShift = iStartIndex - i;
aMissingSections = this._mergeSections(aMissingSections, {startIndex: i, length: iLength + iLengthShift + iThreshold});
}
}
// check if metadata are already available
if (this.oModel.getServiceMetadata()) {
// If rows are missing send a request
if (aMissingSections.length > 0) {
var aParams = [];
if (this.bHasTreeAnnotations) {
var sFilterParams = this.getFilterParams() ? "%20and%20" + this.getFilterParams() : "";
if (sNodeId) {
aParams.push("$filter=" + jQuery.sap.encodeURL(this.oTreeProperties["hierarchy-parent-node-for"] + " eq '" + sNodeId + "'") + sFilterParams);
} else {
// no root node id is given: sNodeId === null
// in this case we use the root level
aParams.push("$filter=" + jQuery.sap.encodeURL(this.oTreeProperties["hierarchy-level-for"] + " eq " + iRootLevel) + sFilterParams);
}
}
/*else {
if (mRequestParameters.navPath) {
aParams.push("$expand=" + mRequestParameters.navPath);
}
}*/
if (this.sCustomParams) {
aParams.push(this.sCustomParams);
}
for (i = 0; i < aMissingSections.length; i++) {
var oRequestedSection = aMissingSections[i];
this._mLoadedSections[sNodeId] = this._mergeSections(this._mLoadedSections[sNodeId], {startIndex: oRequestedSection.startIndex, length: oRequestedSection.length});
this._loadSubNodes(sNodeId, oRequestedSection.startIndex, oRequestedSection.length, 0, aParams, mRequestParameters, oRequestedSection);
}
}
}
return aContexts;
};
ODataTreeBinding.prototype._getCountForNodeId = function(sNodeId, iStartIndex, iLength, iThreshold, mParameters) {
var that = this;
// create a request object for the data request
var aParams = [];
function _handleSuccess(oData) {
that.oFinalLengths[sNodeId] = true;
that.oLengths[sNodeId] = parseInt(oData, 10);
}
function _handleError(oError) {
//Only perform error handling if the request was not aborted intentionally
if (oError && oError.statusCode === 0 && oError.statusText === "abort") {
return;
}
var sErrorMsg = "Request for $count failed: " + oError.message;
if (oError.response){
sErrorMsg += ", " + oError.response.statusCode + ", " + oError.response.statusText + ", " + oError.response.body;
}
jQuery.sap.log.warning(sErrorMsg);
}
var sPath;
if (this.bHasTreeAnnotations) {
sPath = this.oModel.resolve(this.getPath(), this.getContext());
var sFilterParams = this.getFilterParams() ? "%20and%20" + this.getFilterParams() : "";
aParams.push("$filter=" + jQuery.sap.encodeURL(this.oTreeProperties["hierarchy-parent-node-for"] + " eq '" + sNodeId + "'") + sFilterParams);
} else {
sPath = sNodeId;
}
// Only send request, if path is defined
if (sPath) {
this.oModel.read(sPath + "/$count", {
urlParameters: aParams,
success: _handleSuccess,
error: _handleError,
sorters: this.aSorters
});
}
};
/**
* Triggers backend requests to load the child nodes of the node with the given sNodeId.
*
* @param {String} sNodeId the value of the hierarchy node property on which a parent node filter will be performed
* @param {integer} iStartIndex start index of the page
* @param {integer} iLength length of the page
* @param {integer} iThreshold additionally loaded entities
* @param {array} aParams odata url parameters, already concatenated with "="
* @param {object} mParameters additional request parameters
* @param {object} mParameters.navPath the navigation path
*
* @return {sap.ui.model.Context[]} Array of contexts
*
* @private
*/
ODataTreeBinding.prototype._loadSubNodes = function(sNodeId, iStartIndex, iLength, iThreshold, aParams, mParameters, oRequestedSection) {
var that = this,
bInlineCountRequested = false;
if (iStartIndex || iLength) {
aParams.push("$skip=" + iStartIndex + "&$top=" + (iLength + iThreshold));
}
if (!this.oFinalLengths[sNodeId] && (this.sCountMode == CountMode.Inline || this.sCountMode == CountMode.Both)) {
aParams.push("$inlinecount=allpages");
bInlineCountRequested = true;
}
var sRequestKey = "" + sNodeId + "-" + iStartIndex + "-" + this._iPageSize + "-" + iThreshold;
function fnSuccess(oData) {
// Collecting contexts
//beware: oData.results can be an empty array -> so the length has to be checked
if (oData.results && oData.results.length > 0) {
//Case 1: Result is an entity set
if (that.bHasTreeAnnotations) {
var mLastNodeIdIndices = {};
// evaluate the count
if (bInlineCountRequested && oData.__count) {
that.oLengths[sNodeId] = parseInt(oData.__count, 10);
that.oFinalLengths[sNodeId] = true;
}
for (var i = 0; i < oData.results.length; i++) {
var oEntry = oData.results[i];
var sEntryNodeId = sNodeId;
if (i == 0) {
mLastNodeIdIndices[sEntryNodeId] = iStartIndex;
} else if (mLastNodeIdIndices[sEntryNodeId] == undefined) {
mLastNodeIdIndices[sEntryNodeId] = 0;
}
if (!(sEntryNodeId in that.oKeys)) {
that.oKeys[sEntryNodeId] = [];
// update length (only when the inline count was requested and is available)
if (bInlineCountRequested && oData.__count) {
that.oLengths[sEntryNodeId] = parseInt(oData.__count, 10);
that.oFinalLengths[sEntryNodeId] = true;
} else {
//calculate the number of children for this node/context
var iResultLength = parseInt(oData.results.length, 10);
that.oLengths[sEntryNodeId] = Math.max(that.oLengths[sEntryNodeId] || 0, iStartIndex + iResultLength);
// if we received fewer items than requested, the length is final
if (iResultLength < iLength) {
that.oFinalLengths[sEntryNodeId] = true;
}
//send an additional count request, in case no inline count was sent
if (!that.oFinalLengths[sEntryNodeId] && that.oModel.isCountSupported()) {
that._getCountForNodeId(sEntryNodeId);
}
}
}
that.oKeys[sEntryNodeId][mLastNodeIdIndices[sEntryNodeId]] = that.oModel._getKey(oEntry);
mLastNodeIdIndices[sEntryNodeId]++;
}
} else {
// update length (only when the inline count was requested and is available)
if (bInlineCountRequested && oData.__count) {
that.oLengths[sNodeId] = parseInt(oData.__count, 10);
that.oFinalLengths[sNodeId] = true;
} else {
if (that.oModel.isCountSupported()) {
that._getCountForNodeId(sNodeId);
}
}
that.oKeys[sNodeId] = [];
for (var i = 0; i < oData.results.length; i++) {
var oEntry = oData.results[i];
var sKey = that.oModel._getKey(oEntry);
that._processODataObject(oEntry, "/" + sKey, mParameters.navPath);
that.oKeys[sNodeId][i + iStartIndex] = sKey;
}
}
} else if (oData.results && oData.results.length === 0) {
//Case 2: we have an empty result (and possible a count)
if (bInlineCountRequested && oData.__count) {
that.oLengths[sNodeId] = parseInt(oData.__count, 10);
}
that.oFinalLengths[sNodeId] = true;
} else {
//Case 3: Single entity (this only happens if you bind to a single entity as root element)
that.oKeys[null] = that.oModel._getKey(oData);
if (!that.bHasTreeAnnotations) {
that._processODataObject(oData, sNodeId, mParameters.navPath);
}
}
that.oRequestHandle = null;
delete that.mRequestHandles[sRequestKey];
that.bNeedsUpdate = true;
that.fireDataReceived();
}
function fnError(oError) {
//Only perform error handling if the request was not aborted intentionally
if (oError && oError.statusCode === 0 && oError.statusText === "abort") {
return;
}
that.oRequestHandle = null;
delete that.mRequestHandles[sRequestKey];
that.fireDataReceived();
if (oRequestedSection) {
// remove section from loadedSections so the data can be requested again.
// this might be required when e.g. when the service was not available for a short time
var aLoadedSections = [];
for (var i = 0; i < that._mLoadedSections[sNodeId].length; i++) {
var oCurrentSection = that._mLoadedSections[sNodeId][i];
if (oRequestedSection.startIndex >= oCurrentSection.startIndex && oRequestedSection.startIndex + oRequestedSection.length <= oCurrentSection.startIndex + oCurrentSection.length) {
// remove the section interval and maintain adapted sections. If start index and length are the same, ignore the section
if (oRequestedSection.startIndex !== oCurrentSection.startIndex && oRequestedSection.length !== oCurrentSection.length) {
aLoadedSections = that._mergeSections(aLoadedSections, {startIndex: oCurrentSection.startIndex, length: oRequestedSection.startIndex - oCurrentSection.startIndex});
aLoadedSections = that._mergeSections(aLoadedSections, {startIndex: oRequestedSection.startIndex + oRequestedSection.length, length: (oCurrentSection.startIndex + oCurrentSection.length) - (oRequestedSection.startIndex + oRequestedSection.length)});
}
} else {
aLoadedSections.push(oCurrentSection);
}
}
that._mLoadedSections[sNodeId] = aLoadedSections;
}
}
// !== because we use "null" as sNodeId in case the user only provided a root level
if (sNodeId !== undefined) {
if ((!this.oFinalLengths[sNodeId] || this.bHasTreeAnnotations)) {
// execute the request and use the metadata if available
this.fireDataRequested();
var sAbsolutePath;
if (this.bHasTreeAnnotations) {
sAbsolutePath = this.oModel.resolve(this.getPath(), this.getContext());
} else {
sAbsolutePath = sNodeId;
}
if (this.mRequestHandles[sRequestKey]) {
this.mRequestHandles[sRequestKey].abort();
}
this.mRequestHandles[sRequestKey] = this.oModel.read(sAbsolutePath, {
urlParameters: aParams,
success: fnSuccess,
error: fnError,
sorters: this.aSorters
});
}
}
};
/**
* Resets the current tree data and the lengths of the different nodes/groups.
*
* @param {object} oContext the context for which the lengths values should be resetted.
*
* @private
*/
ODataTreeBinding.prototype.resetData = function(oContext, mParameters) {
if (oContext) {
//Only reset specific content
var sPath = oContext.getPath();
delete this.oKeys[sPath];
delete this.oLengths[sPath];
delete this.oFinalLengths[sPath];
delete this._mLoadedSections[sPath];
} else {
this.oKeys = {};
this.oLengths = {};
this.oFinalLengths = {};
this.oRootContext = null;
this._bRootMissing = false;
this.mRequestHandles = {};
this._mLoadedSections = {};
this._iPageSize = 0;
this.sFilterParams = "";
}
};
/**
* Refreshes the binding, check whether the model data has been changed and fire change event
* if this is the case. For server side models this should refetch the data from the server.
* To update a control, even if no data has been changed, e.g. to reset a control after failed
* validation, please use the parameter bForceUpdate.
*
* @param {boolean} [bForceUpdate] Update the bound control even if no data has been changed
* @param {object} [mChangedEntities]
* @param {string} [mEntityTypes]
*
* @public
*/
ODataTreeBinding.prototype.refresh = function(bForceUpdate, mChangedEntities, mEntityTypes) {
var bChangeDetected = false;
if (!bForceUpdate) {
if (mEntityTypes){
var sResolvedPath = this.oModel.resolve(this.sPath, this.oContext);
// remove url parameters if any to get correct path for entity type resolving
if (sResolvedPath.indexOf("?") !== -1) {
sResolvedPath = sResolvedPath.split("?")[0];
}
var oEntityType = this.oModel.oMetadata._getEntityTypeByPath(sResolvedPath);
if (oEntityType && (oEntityType.entityType in mEntityTypes)) {
bChangeDetected = true;
}
}
if (mChangedEntities && !bChangeDetected) {
jQuery.each(this.oKeys, function(i, aNodeKeys) {
jQuery.each(aNodeKeys, function(i, sKey) {
if (sKey in mChangedEntities) {
bChangeDetected = true;
return false;
}
});
if (bChangeDetected) {
return false;
}
});
}
if (!mChangedEntities && !mEntityTypes) { // default
bChangeDetected = true;
}
}
if (bForceUpdate || bChangeDetected) {
this.resetData();
this.bNeedsUpdate = false;
this.bRefresh = true;
this._fireRefresh({reason: sap.ui.model.ChangeReason.Refresh});
}
};
/**
* Filtering is currently not supported.
*
* @param {sap.ui.model.Filter[]|sap.ui.model.Filter} aFilters
* @see sap.ui.model.TreeBinding.prototype.filter
* @return {sap.ui.model.odata.v2.ODataTreeBinding} returns <code>this</code> to facilitate method chaining
* @public
*/
ODataTreeBinding.prototype.filter = function(aFilters){
jQuery.sap.log.warning("Filtering is currently not possible in the ODataTreeBinding");
return this;
};
/**
* Sorts the Tree according to the given Sorter(s)
*
* @param {sap.ui.model.Sorter[]|sap.ui.model.Sorter} aSorters the Sorter or an Array of sap.ui.model.Sorter instances
* @return {sap.ui.model.odata.v2.ODataTreeBinding} returns <code>this</code> to facilitate method chaining
* @public
*/
ODataTreeBinding.prototype.sort = function(aSorters, bReturnSuccess) {
var bSuccess = false;
if (aSorters instanceof sap.ui.model.Sorter) {
aSorters = [aSorters];
}
this.aSorters = aSorters || [];
if (!this.bInitial) {
this.resetData(undefined, {reason: ChangeReason.Sort});
// abort running request, since new requests will be sent containing $orderby
jQuery.each(this.mRequestHandles, function (sRequestKey, oRequestHandle) {
if (oRequestHandle) {
oRequestHandle.abort();
}
});
this._fireRefresh({reason : ChangeReason.Sort});
bSuccess = true;
}
if (bReturnSuccess) {
return bSuccess;
} else {
return this;
}
};
/**
* Check whether this Binding would provide new values and in case it changed,
* inform interested parties about this.
*
* @param {boolean} bForceUpdate
*
*/
ODataTreeBinding.prototype.checkUpdate = function(bForceUpdate, mChangedEntities){
var bChangeDetected = false;
if (!bForceUpdate) {
if (this.bNeedsUpdate || !mChangedEntities) {
bChangeDetected = true;
} else {
jQuery.each(this.oKeys, function(i, aNodeKeys) {
jQuery.each(aNodeKeys, function(i, sKey) {
if (sKey in mChangedEntities) {
bChangeDetected = true;
return false;
}
});
if (bChangeDetected) {
return false;
}
});
}
}
if (bForceUpdate || bChangeDetected) {
this.bNeedsUpdate = false;
this._fireChange();
}
};
/**
* Splits the given path along the navigation properties.
* Only used when bound against a service, which describes the tree via navigation properties.
*
* @param {string} sPath
* @private
*/
ODataTreeBinding.prototype._getNavPath = function(sPath) {
//Check the last part of the path
var sAbsolutePath = this.oModel.resolve(sPath, this.getContext());
if (!sAbsolutePath) {
return;
}
var aPathParts = sAbsolutePath.split("/"),
sEntityName = aPathParts[aPathParts.length - 1],
sNavPath;
//Only if part contains "(" we are working on a specific entity with children
var sCurrent = sEntityName.split("(")[0];
if (sCurrent && this.oNavigationPaths[sCurrent]) {
//Replace context with subitems context
sNavPath = this.oNavigationPaths[sCurrent];
}
return sNavPath;
};
/**
* Processes the odata entries returned after a backend request.
* navigation property paths are split and stored internally.
*
* @param {object} oObject the object which will be processed
* @param {string} sPath the binding path of the object
* @param {string} sNavPath the path through the data object along the navigation properties
* @private
*/
ODataTreeBinding.prototype._processODataObject = function(oObject, sPath, sNavPath) {
var aNavPath = [],
that = this;
if (sNavPath && sNavPath.indexOf("/") > -1) {
aNavPath = sNavPath.split("/");
sNavPath = aNavPath[0];
aNavPath.splice(0,1);
}
var oRef = this.oModel._getObject(sPath);
if (jQuery.isArray(oRef)) {
this.oKeys[sPath] = oRef;
this.oLengths[sPath] = oRef.length;
this.oFinalLengths[sPath] = true;
} else if (oRef) {
this.oLengths[sPath] = 1;
this.oFinalLengths[sPath] = true;
}
if (sNavPath && oObject[sNavPath]) {
if (jQuery.isArray(oRef)) {
jQuery.each(oRef, function(iIndex, sRef) {
var oObject = that.getModel().getData("/" + sRef);
that._processODataObject(oObject, "/" + sRef + "/" + sNavPath, aNavPath.join("/"));
});
} else if (typeof oRef === "object") {
that._processODataObject(oObject, sPath + "/" + sNavPath, aNavPath.join("/"));
}
}
};
/**
* Checks the metadata for Hierarchy Tree Annotations.
* The property mapping describing the tree will be placed in "this.oTreeProperties".
* Also checks if clientside property mappings are given.
*/
ODataTreeBinding.prototype._hasTreeAnnotations = function() {
var oModel = this.oModel,
oMetadata = oModel.oMetadata,
sAbsolutePath = oModel.resolve(this.getPath(), this.getContext()),
oEntityType,
sTreeAnnotationNamespace = oMetadata.mNamespaces["sap"],
that = this;
//List of all annotations that are required for the OdataTreebinding to work
this.oTreeProperties = {
"hierarchy-level-for": false,
"hierarchy-parent-node-for": false,
"hierarchy-node-for": false,
"hierarchy-drill-state-for": false
};
// Checks if no tree annotations are missing
// true: everythings fine
// false: we can't proceed
var fnSanityCheckTreeAnnotations = function () {
var iFoundAnnotations = 0;
var iMaxAnnotationLength = 0;
jQuery.each(that.oTreeProperties, function (sPropName, sPropValue) {
iMaxAnnotationLength++;
if (sPropValue) {
iFoundAnnotations += 1;
}
});
if (iFoundAnnotations === iMaxAnnotationLength){
return true;
} else if (iFoundAnnotations > 0 && iFoundAnnotations < iMaxAnnotationLength) {
jQuery.sap.log.warning("Incomplete hierarchy tree annotations. Please check your service metadata definition!");
}
//if no annotations where found -> we are in the navigtion property mode
return false;
};
// support for locally annotated tree hierarchy properties
if (this.mParameters && this.mParameters.treeAnnotationProperties) {
this.oTreeProperties["hierarchy-level-for"] = this.mParameters.treeAnnotationProperties.hierarchyLevelFor;
this.oTreeProperties["hierarchy-parent-node-for"] = this.mParameters.treeAnnotationProperties.hierarchyParentNodeFor;
this.oTreeProperties["hierarchy-node-for"] = this.mParameters.treeAnnotationProperties.hierarchyNodeFor;
this.oTreeProperties["hierarchy-drill-state-for"] = this.mParameters.treeAnnotationProperties.hierarchyDrillStateFor;
return fnSanityCheckTreeAnnotations();
}
// remove url parameters if any to get correct path for entity type resolving
if (sAbsolutePath.indexOf("?") !== -1) {
sAbsolutePath = sAbsolutePath.split("?")[0];
}
oEntityType = oMetadata._getEntityTypeByPath(sAbsolutePath);
if (!oEntityType) {
jQuery.sap.log.fatal("EntityType for path " + sAbsolutePath + " could not be found.");
return false;
}
//Check if all required proeprties are available
jQuery.each(oEntityType.property, function(iIndex, oProperty) {
if (!oProperty.extensions) {
return true;
}
jQuery.each(oProperty.extensions, function(iIndex, oExtension) {
var sName = oExtension.name;
if (oExtension.namespace === sTreeAnnotationNamespace &&
sName in that.oTreeProperties &&
!that.oTreeProperties[sName]) {
that.oTreeProperties[sName] = oProperty.name;
}
});
});
return fnSanityCheckTreeAnnotations();
};
/**
* Initialize binding. Fires a change if data is already available ($expand) or a refresh.
* If metadata is not yet available, do nothing, method will be called again when
* metadata is loaded.
*
* @public
*/
ODataTreeBinding.prototype.initialize = function() {
if (this.oModel.oMetadata && this.oModel.oMetadata.isLoaded()) {
this.bInitial = false;
this.bHasTreeAnnotations = this._hasTreeAnnotations();
this._processSelectParameters();
this.oEntityType = this._getEntityType();
this._fireRefresh({reason: sap.ui.model.ChangeReason.Refresh});
}
return this;
};
/**
* Internal function to evaluate the select parameters for the binding.
* @private
*/
ODataTreeBinding.prototype._processSelectParameters = function () {
if (this.mParameters) {
this.oNavigationPaths = this.mParameters.navigation;
// put navigation params also to select params if there are select params
if (this.mParameters.select) {
//split all select params
var aSelectParams = this.mParameters.select.split(",");
var aNewSelectParams = [];
if (this.oNavigationPaths) {
jQuery.each(this.oNavigationPaths, function(sParamKey, sParamName){
if (jQuery.inArray(sParamName, aNewSelectParams) == -1) {
aNewSelectParams.push(sParamName);
}
});
}
// add new select params to custom select params
jQuery.each(aNewSelectParams, function(sParamKey, sParamName){
if (jQuery.inArray(sParamName, aSelectParams) == -1) {
aSelectParams.push(sParamName);
}
});
// add hierarchy annotation properties to select params if not there already
if (this.bHasTreeAnnotations) {
jQuery.each(this.oTreeProperties, function(sAnnotationName, sTreePropName){
if (sTreePropName) {
if (jQuery.inArray(sTreePropName, aSelectParams) == -1) {
aSelectParams.push(sTreePropName);
}
}
});
}
this.mParameters.select = aSelectParams.join(",");
}
this.sCustomParams = this.oModel.createCustomParams(this.mParameters);
}
//after parameter processing:
//check if we have navigation parameters
if (!this.bHasTreeAnnotations && !this.oNavigationPaths) {
jQuery.sap.log.error("Neither navigation paths parameters, nor (complete/valid) tree hierarchy annotations where provided to the TreeBinding.");
this.oNavigationPaths = {};
}
};
/**
* Builds a download URL
* @param {string} sFormat The format for the result data, when accessing the Download-URL
*/
ODataTreeBinding.prototype.getDownloadUrl = function(sFormat) {
var aParams = [],
sPath;
if (sFormat) {
aParams.push("$format=" + encodeURIComponent(sFormat));
}
// sort and filter not supported yet
/*if (this.sSortParams) {
aParams.push(this.sSortParams);
}*/
if (this.getFilterParams()) {
aParams.push("$filter=" + this.getFilterParams());
}
//also includes the selct parameters
//in hierarchy annotated trees, the mapping properties are mandatory
if (this.sCustomParams) {
aParams.push(this.sCustomParams);
}
sPath = this.oModel.resolve(this.sPath,this.oContext);
if (sPath) {
return this.oModel._createRequestUrl(sPath, null, aParams);
}
};
/**
* Setting the number of expanded levels leads to different requests.
* This function is used by the TreeTable for the ungroup/ungroup-all feature.
* @see sap.ui.table.TreeTable#_getGroupHeaderMenu
* @param {int} iLevels the number of levels which should be expanded, minimum is 0
* @protected
* @name sap.ui.model.odata.ODataTreeBinding#setNumberOfExpandedLevels
* @function
*/
ODataTreeBinding.prototype.setNumberOfExpandedLevels = function(iLevels) {
iLevels = iLevels || 0;
if (iLevels < 0) {
jQuery.sap.log.warning("ODataTreeBinding: numberOfExpandedLevels was set to 0. Negative values are prohibited.");
iLevels = 0;
}
// set the numberOfExpandedLevels on the binding directly
// this.mParameters is inherited from the Binding super class
this.iNumberOfExpandedLevels = iLevels;
this._fireChange();
};
/**
* Retrieves the currently set number of expanded levels from the Binding (commonly an ODataTreeBinding).
* @protected
* @name sap.ui.model.odata.ODataTreeBinding#getNumberOfExpandedLevels
* @function
* @returns {int} the number of expanded levels
*/
ODataTreeBinding.prototype.getNumberOfExpandedLevels = function() {
return this.iNumberOfExpandedLevels;
};
/**
* Sets the rootLevel
* The root level is the level of the topmost tree nodes, which will be used as an entry point for OData services.
* @param {int} iRootLevel
*/
ODataTreeBinding.prototype.setRootLevel = function(iRootLevel) {
iRootLevel = parseInt(iRootLevel || 0, 10);
if (iRootLevel < 0) {
jQuery.sap.log.warning("ODataTreeBinding: rootLevels was set to 0. Negative values are prohibited.");
iRootLevel = 0;
}
// set the rootLevel on the binding directly
this.iRootLevel = iRootLevel;
this.refresh();
};
/**
* Returns the rootLevel
* @returns {int}
*/
ODataTreeBinding.prototype.getRootLevel = function() {
return this.iRootLevel;
};
ODataTreeBinding.prototype._getEntityType = function(){
var sResolvedPath = this.oModel.resolve(this.sPath, this.oContext);
if (sResolvedPath) {
var oEntityType = this.oModel.oMetadata._getEntityTypeByPath(sResolvedPath);
jQuery.sap.assert(oEntityType, "EntityType for path " + sResolvedPath + " could not be found!");
return oEntityType;
}
return undefined;
};
ODataTreeBinding.prototype.getFilterParams = function() {
if (this.aFilters && this.aFilters.length > 0) {
if (!this.sFilterParams) {
this.sFilterParams = ODataUtils._createFilterParams(this.aFilters, this.oModel.oMetadata, this.oEntityType);
this.sFilterParams = this.sFilterParams ? this.sFilterParams : "";
}
} else {
this.sFilterParams = "";
}
return this.sFilterParams;
};
return ODataTreeBinding;
}, /* bExport= */ true);
| {
"content_hash": "a9c03d6c478863447dc7c0e603f8c375",
"timestamp": "",
"source": "github",
"line_count": 1357,
"max_line_length": 255,
"avg_line_length": 37.389830508474574,
"alnum_prop": 0.6887342819977137,
"repo_name": "mindmill/open-cmis-explorer",
"id": "535c574042a15045c9e68c169c593192c6fbd457",
"size": "50934",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "resources/sap/ui/model/odata/v2/ODataTreeBinding-dbg.js",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "3031036"
},
{
"name": "HTML",
"bytes": "21087"
},
{
"name": "JavaScript",
"bytes": "34905004"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<title>Jon Chen</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="referrer" content="no-referrer">
<link rel="stylesheet" href="./compiled.css">
</head>
<body>
<div class="container">
<div id="intro">
<dl>
<dt class="who">Jon Chen</dt>
<dd class="where">San Francisco, CA</dd>
<dd class="where"><a href="https://github.com/bsdlp">github.com/bsdlp</a></dd>
<dd class="where"><a href="mailto:[email protected]">[email protected]</a></dd>
</dl>
</div>
<div id="twitch-auth" class="job">
<dl>
<dt>Software Engineer (Auth) at <a target="_blank" href="https://twitch.tv">Twitch</a></dt>
<dd class="when">February 2021 - Current</dd>
<dd>
<ul class="what">
<li>Tech Lead, Twitch App AuthN/Z</li>
<ol>
<li>Redesigned database layer for authentication service operating at hundreds of thousands of requests
per second</li>
<li>Led team of 6 engineers to execute on refactoring authentication service</li>
<li>Defined Twitch App AuthN/Z ratelimiting for cross-functional Twitch App Review working group</li>
<li>Redefining how first party and third party applications authenticate to Twitch</li>
</ol>
<li>Tech Lead, Twitch Connections Service</li>
<ol>
<li>Scaled up Twitch's identity platform for high throughput and high visibility partner events</li>
</ol>
<li>Tech Lead, Signed In Devices</li>
</ul>
</dd>
</dl>
</div>
<div id="twitch-identity" class="job">
<dl>
<dt>Software Engineer (Identity) at <a target="_blank" href="https://twitch.tv">Twitch</a></dt>
<dd class="when">January 2020 - February 2021</dd>
<dd>
<ul class="what">
<li>Tech Lead, Twitch Sessions service</li>
<li>Worked on security and operational improvements across Twitch services</li>
</ul>
</dd>
</dl>
</div>
<div id="twitch-security" class="job">
<dl>
<dt>Software Engineer (Security) at <a target="_blank" href="https://twitch.tv">Twitch</a></dt>
<dd class="when">January 2015 - January 2020</dd>
<dd>
<ul class="what">
<li>Tech lead on service to service auth product</li>
<li>Tech lead on employee user auth service</li>
<li>Major contributor to secrets management system</li>
</ul>
</dd>
</dl>
</div>
<div id="linode" class="job">
<dl>
<dt>Junior Developer at <a target="_blank" href="https://linode.com">Linode</a></dt>
<dd class="when">August 2014 - January 2015</dd>
<dd>
<ul class="what">
<li>Designed and implemented auto-balancing backups system for customer data</li>
<li>Managed fleet of Xen hypervisors hosting customer VMs</li>
</ul>
</dd>
</dl>
</div>
</div>
</body>
</html> | {
"content_hash": "e5692ed2323123d696c1024aca3ac8bc",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 117,
"avg_line_length": 35.81818181818182,
"alnum_prop": 0.5678934010152284,
"repo_name": "bsdlp/bsdlp.github.io",
"id": "51ace3b012440c36e23587a937eb49904fb440c3",
"size": "3152",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "index.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "752"
},
{
"name": "HTML",
"bytes": "3152"
},
{
"name": "JavaScript",
"bytes": "697"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
Index Fungorum
#### Published in
S. Afr. J. Sci. 22: 168 (1925)
#### Original name
Hypochnus eylesii Van der Byl
### Remarks
null | {
"content_hash": "b5643cb02c5616942e9946e3cfe0e179",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 30,
"avg_line_length": 12.307692307692308,
"alnum_prop": 0.675,
"repo_name": "mdoering/backbone",
"id": "8fbc1a746e03b924a9d8aafbf3acf12f464e96b2",
"size": "213",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Basidiomycota/Agaricomycetes/Thelephorales/Thelephoraceae/Tomentella/Hypochnus eylesii/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.